-
Notifications
You must be signed in to change notification settings - Fork 83
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
Any plan for supporting libusb_init_context()? #207
Comments
Sorry for the delay in my response. Yes, I can try to add this feature. However, it might be a bit tricky. We also need to verify that we are linking to the new libusb version (>= 1.0.27); otherwise, we will encounter a linking error. |
See: #209 :) |
Actually for android you can use old approache
or But I will try to upgrade rusb to allow the new approach. |
the old libusb_set_option way would trigger segmentation faults on Android, but libusb_init_context with the same option would not. I think it has to do with how set_option is implemented and some faulty assumption about memory allocation or struct padding that doesn't hold up in my environment |
The old And you need to You can take a look here #19 (comment)
|
it seems i was doing this incorrectly. i had mis-re-typed the original sample code in the android directory when writing the C++ sanity-check proof-of-concept code on android (which also segfaulted till i switched to the new API). that behavior is a little unintuitive, i'm glad they deprecated that API haha. closer reading may have saved me. |
Thanks for your brilliant work! It really paves the way between rust and USB devices.
TL:DR: is there any plan to support calling libusb_set_option() before libusb_init(), which is super useful in access-limited situations?
For now, the crate works fine in most situations, however, when it comes to circumstances where access to USB devices is limited, there seems to be no way to call libusb_set_option() with opt equals to LIBUSB_OPTION_NO_DEVICE_DISCOVERY before libusb_init(), which helps the caller to skip scanning devices when calling libsub_init().
Also, the libusb_init() API has already been marked as deprecated , it would be a better choice to turn to libusb_init_context().
Looking forward to your replies!
You may find the following links helpful:
https://libusb.sourceforge.io/api-1.0/group__libusb__lib.html#ga7deaef521cfb1a5b3f8d6c01be11a795
https://libusb.sourceforge.io/api-1.0/group__libusb__lib.html#ga07d4ec54cf575d672ba94c72b3c0de7c
The text was updated successfully, but these errors were encountered: