Repository navigation
Do not restrict "weak authority" option to Android - #925
tormodvolden wants to merge 1 commit into
Conversation
libusb_wrap_sys_device() is an often needed feature on Android, but can also be very convenient on other Linux platforms. In many cases the initial device scanning is not needed and LIBUSB_OPTION_WEAK_AUTHORITY thus provides a performance enhancement. Signed-off-by: Tormod Volden <[email protected]>
|
My own use case for libusb_wrap_sys_device() is using udev rules to create device node aliases that includes the serial number of the devices. Since libusb cannot filter on serial numbers without opening each device and querying the serial number, this is how I avoid a lot of device communication. With the proposed change I can avoid point-less enumeration and further save execution time. My program which simply sends a vendor-specific control transfer to a given device is now 3 times faster (full execution measured with the shell builtin "time"). |
|
Looks fine to me. |
|
I may also benefit from this. |
|
IMO the name of the option is obscure, and with extended use it becomes awkward. It reflects the original motivation for one use-case but not what the option does. We should maybe add a new option, e.g. LIBUSB_OPTION_NO_ENUMERATION, and unless there are plans for having LIBUSB_OPTION_WEAK_AUTHORITY do more than this, let the latter die rather sooner than later. |
|
@tormodvolden So what is your suggestion? LIBUSB_OPTION_NO_ENUMERATION sounds an interesting name. One possibility is take this pull request in 1.0.25, then we can come out with a better one in the next release. Or we just do not take this pull request, then you can create another pull request for LIBUSB_OPTION_NO_ENUMERATION. |
|
@LudovicRousseau @hjelmn Please comment we should take this in 1.0.25 or not. |
|
I can create another pull request for LIBUSB_OPTION_NO_ENUMERATION but probably not before next week. Ideally it should be included in 1.0.25 as well, to avoid further adoption of the old option, which should be marked as obsolete unless it will be extended to do something else. |
|
@tormodvolden No problem, take your time. |
|
I also prefer the name
|
|
@LudovicRousseau Sounds good to me. @tormodvolden Let me know when you have made that change and I will merge this. |
|
My thought was that this can go in anyway, but renaming and obsoleting the old is something I will look at in the weekend. |
| * and used together with libusb_wrap_sys_device(). | ||
| * | ||
| * Only valid for Android builds. | ||
| * Only valid on Linux. |
There was a problem hiding this comment.
"Only valid on Linux and Android."
There was a problem hiding this comment.
I kind of think we need to emphasize Android as well.
There was a problem hiding this comment.
Andoid uses Linux. No? :-)
There was a problem hiding this comment.
Yes, that is true as well. So I just approved the changes.
|
libusb_wrap_sys_device() is an often needed feature on Android, but can
also be very convenient on other Linux platforms.
In many cases the initial device scanning is not needed and
LIBUSB_OPTION_WEAK_AUTHORITY thus provides a performance enhancement.
Signed-off-by: Tormod Volden [email protected]