Windows: Fix devices enumeration #235

Merged
jm4R merged 1 commit from master into master 2021-01-30 07:20:02 -06:00
jm4R commented 2021-01-21 07:14:22 -06:00 (Migrated from github.com)

Based on
https://github.com/microsoft/Windows-driver-samples/blob/master/hid/hclient/pnp.c#L32

Fixes wrong detection of the class of devices.

Fixes: #234

Based on https://github.com/microsoft/Windows-driver-samples/blob/master/hid/hclient/pnp.c#L32 Fixes wrong detection of the class of devices. Fixes: #234
Youw (Migrated from github.com) approved these changes 2021-01-21 07:24:14 -06:00
Youw (Migrated from github.com) left a comment

what are the chances we will fail to filter out a non-hid devices?
I understand that HID class GUID should do the trick, but still, this implementation been here like forever, and I'like to give it some thinking, just in case.

what are the chances we will fail to filter out a non-hid devices? I understand that HID class GUID should do the trick, but still, this implementation been here like forever, and I'like to give it some thinking, just in case.
@ -309,14 +309,16 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
struct hid_device_info *root = NULL; /* return object */
Youw (Migrated from github.com) commented 2021-01-21 07:22:29 -06:00

remove it completely?

remove it completely?
@ -378,32 +380,18 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
goto cont;
}
Youw (Migrated from github.com) commented 2021-01-21 07:21:57 -06:00

please update or remove this comment, it is outdated

please update or remove this comment, it is outdated
jm4R (Migrated from github.com) reviewed 2021-01-21 07:45:58 -06:00
@ -309,14 +309,16 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
struct hid_device_info *root = NULL; /* return object */
jm4R (Migrated from github.com) commented 2021-01-21 07:45:58 -06:00

What about "Make sure this device has a driver bound to it" section? This buffer is used there. I am not sure why we check it - HID device without any driver should still work, right?

@Oh, sorry, you mean i - it is not used anymore.

What about "Make sure this device has a driver bound to it" section? This buffer is used there. I am not sure why we check it - HID device without any driver should still work, right? @Oh, sorry, you mean `i` - it is not used anymore.
Youw (Migrated from github.com) reviewed 2021-01-21 08:00:49 -06:00
@ -309,14 +309,16 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
struct hid_device_info *root = NULL; /* return object */
Youw (Migrated from github.com) commented 2021-01-21 08:00:49 -06:00

yeap, only i

yeap, only `i`
jm4R commented 2021-01-21 08:16:03 -06:00 (Migrated from github.com)

what are the chances we will fail to filter out a non-hid devices?
I understand that HID class GUID should do the trick, but still, this implementation been here like forever, and I'like to give it some thinking, just in case.

I am not WinApi expert but because this PR is based on the code straight from Microsoft, I assume it should be correct. I also read the documentation of each changed function and indicated that it should work. If the bug I fixed by this PR was there "forever" too (and I am 100% sure it is a bug), I am confused nobody discovered it yet. But maybe some people did - there are a number of open issues in the old repository, that could be caused by this. For example:
https://github.com/signal11/hidapi/issues/290
https://github.com/signal11/hidapi/issues/221

In my use case the old code didn't work (described in #234), but it is my use case :)

> what are the chances we will fail to filter out a non-hid devices? > I understand that HID class GUID should do the trick, but still, this implementation been here like forever, and I'like to give it some thinking, just in case. I am not WinApi expert but because this PR is based on the code straight from Microsoft, I assume it should be correct. I also read the documentation of each changed function and indicated that it should work. If the bug I fixed by this PR was there "forever" too (and I am 100% sure it is a bug), I am confused nobody discovered it yet. But maybe some people did - there are a number of open issues in the old repository, that could be caused by this. For example: https://github.com/signal11/hidapi/issues/290 https://github.com/signal11/hidapi/issues/221 In my use case the old code didn't work (described in #234), but it is my use case :)
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!235
No description provided.