-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS: empty path for devices in long USB chain #236
Comments
It looks like perhaps a solution is to use |
Related to #127 and flirc/hidapi@8d251c3 (the fix)? |
I think so. I'll be attempting it this weekend. |
@Youw Maybe this can be merged as well. flirc/hidapi@8d251c3 |
I'd suggest a few changes to flirc/hidapi@8d251c3 before accepting it. |
I was hit by this issue as well, since I have two external powered USB hubs (one 7-port and one 11-port) which are actually complicate hubs (nested hub). So even the first hub (D-Link USB 3 powered 7-port hub) already cause issues. |
@Youw @todbot It seems to me that hidapi has changed a lot that commit todbot@8839e54 no longer applies. Please help if you got time. Thanks. |
I'll work on it this week. |
Maybe we could use (Since Notice that the Swift version of this function just uses a char buffer of any size and the docs mention nothing about a 512 character limit. |
I'm confident that won't work. The implementation of |
I think it might be worth a shot. The documentation reads like it just expect a char buffer of any length not just 512. E.g. „IORegistryEntryGetPath() will fail […] if the buffer is not large enough to contain the path.“ |
With some device connection configurations, the device paths become over 512 bytes (io_string_t max length) which makes them unusable with current implementation. Rather than using ServiceRegistry string path, use its ID, which is uint64_t and easily serializable/deserializable into a string. Implementation idea by felix.schwarz@iospirit.com flirc/hidapi@8d251c3 Fixes: #127, #236.
And the documentation is missleading. The buffer size is not passed into |
With some device connection configurations, the device paths become over 512 bytes (io_string_t max length) which makes them unusable with current implementation. Rather than using ServiceRegistry string path, use its ID, which is uint64_t and easily serializable/deserializable into a string. Implementation idea by felix.schwarz@iospirit.com flirc/hidapi@8d251c3 Fixes: #127, #236.
This probably isn't relevant anymore since the ID-based method is already implemented, but just out of interest, I dug through the Apple open source files and took a look at the implementation of However I found a newer pair of functions called However they are only available starting with macOS 10.11. |
With some device connection configurations, the device paths become over 512 bytes (io_string_t max length) which makes them unusable with current implementation. Rather than using ServiceRegistry string path, use its ID, which is uint64_t and easily serializable/deserializable into a string. Implementation idea by felix.schwarz@iospirit.com flirc/hidapi@8d251c3 Fixes: #127, #236.
This should be fixed by #322. Tested with my Mac Mini M1. |
Problem: Plug two 8-port USB hubs in a chain, add a HID device to second hub: hidapi returns empty string for path.
This was an old signal11 issue signal11/hidapi#301 and I think we still have it. Over in
node-hid
land (node-hid/node-hid#417), someone was experiencing this problem and had a good test showing bothhidapitester
andnode-hid
being able to get a path when the device is plugged in at one leaf of the USB tree but not at the other.I think the issue happens at Line 464 of hidapi/mac/hid.c and I think it's because
io_string_t
is 512 characters and MacOS USB paths are already > 200 chars if you have just a single external USB hub.I'm looking into finding definitions of
io_string_t
andIORegistryEntryGetPath()
to see what our options are.(The reason why I specify 8-port hubs above is those are implemented as two 4-port hubs, meaning the external USB tree look can look like: hub->hub->hub->hub->device, depending on where you plug what into what)
The text was updated successfully, but these errors were encountered: