Repository navigation
New NO_DEVICE_DISCOVERY option to replace WEAK_AUTHORITY option - #935
tormodvolden wants to merge 1 commit into
Conversation
|
It would be good if those who introduced the original WEAK_AUTHORITY could comment on this, and in particular its deprecation. Maybe I missed something? Any plans for extending WEAK_AUTHORITY to do more than NO_ENUMERATION? |
|
For my part I approve with tormodvolden. If there were no negations, we could merge this PR too. |
|
It looks like most of the changes happened in #925 . It's notable that there could be race conditions since a static flag was used here, but that was already the case. #874 will likely be further delayed to be changed for these but the improved code organisation is great. I do believe this flag changes more than just disabling device enumeration. For example, it also disables hotplug. |
|
Yes, it prevents the hotplug event monitoring from starting. I think this makes sense, since the hotplug add event handling depends on enumeration of the device, AFAICS. We could also call the new option NO_DEVICE_DISCOVERY - it would be less specific to the mechanism of enumeration, clearly cover hotplug deactivation, and maybe be more explanatory for the user? |
|
I vote for One question @tormodvolden: why do you change the value of |
|
@LudovicRousseau I was thinking in case we wanted to display a deprecation message for WEAK_AUTHORITY later. |
|
As soon as there is agreement on the naming, I will change that too. Would you like me to squash and repush in the end, or do you do that anyway with the NANO bump process? |
|
I am fine with NO_DEVICE_DISCOVERY as well. |
|
Yep, |
The option disables device enumeration (and hotplug, which depends on enumeration). Since this has a much broader usage scope than "weak authority", give the option a name reflecting what it does. For now, keep the old option name working as an alias. Signed-off-by: Tormod Volden <[email protected]>
8061d89 to
84ae27b
Compare
|
I see the potential issue if someone is using 1.0.25 and WEAK_AUTHORITY, the application will set option 3. If the same binary is later run-time linked against a newer libusb where we use 3 for something different after having dropped WEAK_AUTHORITY, unexpected things will happen. I don't know if we guarantee backwards binary compatibility for minor releases? Or we will have to keep number 3 reserved until next major release. Alternatively we use 2 for both now, and we won't be able to give a run-time warning. A build-time warning would be better anyway but I don't see how to do that. Or we do it the brutal way and drop it now, so compile will fail. The option hasn't been in much use yet, only on the experimental(?) Android platform. If an application must be able to compile smoothly against both 1.0.24 and 1.0.25 the preprocessor will have to check libusb version and pick name accordingly. |
|
If this is merged with additional option 3, I'll try to make time to merge with #874 (which currently uses options 3 and 4) so anybody using my other pr will discover the new numbering sooner rather than later. |
|
Edit: sorry for spam. The issue I mentioned had already been addressed. There are 3 PRs outstanding for this option now, be good to merge them quickly so conflicts can be resolved. |
|
LIBUSB_OPTION_WEAK_AUTHORITY is used when there is no permission to directly access the usb port, such as cannot scan the usb port and hot plug detect. |
|
I just wonder if it would be better to leave the deprecated LIBUSB_OPTION_WEAK_AUTHORITY at value 2 as well. We wouldn't be able to issue a deprecation warning then, but it prevents some possible future issues with binary compatibility and technical debt. And as soon as we drop LIBUSB_OPTION_WEAK_AUTHORITY altogether, the word should be well out already, and a broken application build can be fixed promptly. Comments? |
If the value is always the same we retain binary compatibility. References libusb#935 Signed-off-by: Tormod Volden <[email protected]>
If the value is always the same we retain binary compatibility. References #935 Signed-off-by: Tormod Volden <[email protected]> Signed-off-by: Nathan Hjelm <[email protected]>
All that the old option was doing, was skipping the device enumeration.
Since this has a much broader usage scope than "weak authority", give
the option a name reflecting exactly what it does.
For now, keep the old option name working as an alias.
Signed-off-by: Tormod Volden [email protected]