[Mac] Set a valid interface number on hid_device_info for USB HID devices#380
Open
dylanmckay wants to merge 2 commits intosignal11:masterfrom
Open
[Mac] Set a valid interface number on hid_device_info for USB HID devices#380dylanmckay wants to merge 2 commits intosignal11:masterfrom
dylanmckay wants to merge 2 commits intosignal11:masterfrom
Conversation
ef1a735 to
d483207
Compare
d483207 to
2bfcd3e
Compare
samflores23
reviewed
Mar 16, 2018
mac/hid.c
Outdated
| if ((vendor_id == 0x0 || vendor_id == dev_vid) && | ||
| (product_id == 0x0 || product_id == dev_pid)) { | ||
| struct hid_device_info *tmp; | ||
| bool is_hid; /* Is this an actual HID usb device */ |
There was a problem hiding this comment.
Maybe rename this to is_usb_hid since technically an IOHIDDeviceRef is a HID device object
…ices Previously the interface would never be set on Mac. This presents a big pain because retrieving interface numbers can be the only way to distinguish between the interfaces returned by HIDAPI. This change makes it possible to retrieve interface number from an hid_device_info on Mac for USB HID devices only. It is unclear if the Mac OS IOKit library returns valid interface numbers for non-HID USB devices. Because of this, I have opted to simply skip that case - leave it initialised to `-1`. In the future, we can easily relax this restriction if it turns out IOKit correctly returns interface number with non-HID USB devices. For now, this PR brings 90% of the value at 5% of the risk.
2bfcd3e to
c283c71
Compare
|
I would vote yes on this pull request. Interface number definitely comes in handy |
|
Can confirm this patch working for OpenHMD on OSX, please merge as it currently means that OSX is broken for our library. |
TheOnlyJoey
referenced
this pull request
in OpenHMD/OpenHMD
Apr 2, 2018
pH5
added a commit
to OpenHMD/OpenHMD
that referenced
this pull request
Apr 24, 2018
Instead of trying to parse the device path to match the interface number, use the interface_number field in hid_device_info. This currently does not work on recent Mac OS X [1]. Since there is nothing we can do about it here, warn loudly. Also ignore all but the IMU interfaces when building the device list. Besides removing bogus devices from the list, this should also fix multiple PSVR headsets connected at the same time. [1] signal11/hidapi#380
…ices Previously the interface would never be set on Mac. This presents a big pain because retrieving interface numbers can be the only way to distinguish between the interfaces returned by HIDAPI. This change makes it possible to retrieve interface number from an hid_device_info on Mac for USB HID devices only. It is unclear if the Mac OS IOKit library returns valid interface numbers for non-HID USB devices. Because of this, I have opted to simply skip that case - leave it initialised to `-1`. In the future, we can easily relax this restriction if it turns out IOKit correctly returns interface number with non-HID USB devices. For now, this PR brings 90% of the value at 5% of the risk.
23cb76c to
2357fb5
Compare
Author
|
Gentle ping |
cbedgar
approved these changes
Jan 1, 2019
This was referenced Jun 3, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the interface would never be set on Mac.
This presents a big pain because retrieving interface numbers can be the
only way to distinguish between the interfaces returned by HIDAPI.
This change makes it possible to retrieve interface number from an
hid_device_info on Mac for USB HID devices only.
It is unclear if the Mac OS IOKit library returns valid interface numbers for non-HID USB devices. Because of this, I have opted to simply skip that case - leave it initialised to
-1.In the future, we can easily relax this restriction if it turns out IOKit correctly returns interface number with non-HID USB devices. For now, this PR brings 90% of the value at 5% of the risk.