Stabilize path for libusb devices: #406 from signal11/hidapi #117
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!117
Loading…
Reference in a new issue
No description provided.
Delete branch "bgc.port_pr406_from_signal11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MIgrating @derekatkins 's changes from this PR: https://github.com/signal11/hidapi/pull/406
Referenced by this issue: https://github.com/signal11/hidapi/issues/405 in signal11/hidapi
@ -481,16 +481,28 @@ err:static char *make_path(libusb_device *dev, int interface_number)what about checking the result and error handling?
@ -481,16 +481,28 @@ err:static char *make_path(libusb_device *dev, int interface_number)also, why not initialize
num_portsvariable in the same line as it is definedplease follow this document code style:
replace all spaces with tabs, and, I think, we good to go
HI. What is the status of this PR?
I guess it's not been merged??
soon to be merged
I'll play with it a little bit locally
is there a good reason to pack two levels into a 16bit hex number instead of separating each level with a colon?
@bearsh IMHO, to make it look more like an IPv6 address? People are already used to seeing quad-hex strings, so it makes sense to keep it that way. It also shortens the string a little.
I suppose you COULD have a byte-order problem, but these strings are not portable across machines so it shouldn't matter. I find it very improbable that you have one machine that changes byte-order.
@derekatkins valid reason... and in the end I don't really care as long as all levels are in the string
just some thoughts:
/sys/bus/usb/devices/3-1.1.3.4)03-01.01.03.04.00.00.00.00:1dnumbers a hexThis sounds like execent reasoning
@Youw what's your plan on this? do you expect a change in the PR?
The more I think about this, the more I like the idea to have device path look as much similar to what linux kernel have as possible. Even though current PR gives an improvement, I wouldn't want this to be changed more than once.
Does anyone can reference a linux kernel implementation for this part?
I've found following sites 'talking' about the usb sysfs interface
the most authoritative entry may be the following line from the ABI doc (direct link):
/sys/bus/usb/devices/<busnum>-<port[.port]>…:<config num>-<interface num>/supports_autosuspendVery good. I'm pretty sure that
<busnum>-<port[.port]>…is exactly what we need.if it should be like
<busnum>-<port[.port]>, what about the interface number? appended with with a:or-as separator?Right. I answered this (my) morning in a hurry. Didn't pay attention to all the details.
I say we try to do exactly same way as Linux kernel does:
<busnum>-<port[.port]>…:<config num>-<interface num>So we need to include configuration number/index too.
A also believe, that we shouldn't include all 7 port numbers (as max supported by USB3.0), but only as much as reported by
libusb_get_port_numbersin a return value.I agree with this statement. It should only display the number of ports in use.
something like this?
by the way, according to my running system it's not
<busnum>-<port[.port]>…:<config num>-<interface num>but
<busnum>-<port[.port]>…:<config num>.<interface num>(dot instead of a hyphen between config num and interface num)I've created a new pull request for this: #291
Locking this thread if favour of #291
Pull request closed