Skip to content
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

libusb is not working with Android 7.1 #233

Closed
kennethtang4 opened this issue Nov 22, 2016 · 4 comments
Closed

libusb is not working with Android 7.1 #233

kennethtang4 opened this issue Nov 22, 2016 · 4 comments
Labels

Comments

@kennethtang4
Copy link

To start with, it is not a problem of libusb itself but more to the Android system but I am looking if any one have an idea on how to fix this problem.

The library is working perfectly up to Android 6.0 (haven't tested with 6.1 and 7.0 yet).

The problem is happening in the function "sysfs_get_device_list" in the file "linux_usbfs.c". I am getting an errno code of 13 which is permission denied. It seems that Android has changed the permission of accessing the directory /sys/bus/usb/devices. USB Permission has been asked and granted through the USB Manager beforehand (needed for previous Android versions as well) and I tried to request access for READ_EXTERNAL_STORAGE too but this has no effect on it.

So I wonder if any one can come with a workaround for this?

@mcuee mcuee added the android label Nov 22, 2016
@mcuee
Copy link
Member

mcuee commented Nov 25, 2016

Please refer to this one as well. #188

@mcuee
Copy link
Member

mcuee commented Dec 29, 2016

You may want to try Pull Request #242.

@kennethtang4
Copy link
Author

#242 can solve the problem. The naming of the function is confusing though. The function libusb_wrap_fd is escentially opening the usb by file descriptor. Also, it will not add the usb device the to device list in libusb, so mind that some libraries depend on libusb may need to be modified to make it working.

@mcuee
Copy link
Member

mcuee commented Jan 6, 2020

I will close this for now. But the comment is good. I will add this link to the #242 .

@mcuee mcuee closed this as completed Jan 6, 2020
mcuee referenced this issue Jan 6, 2020
On Android, the platform API should be used to scan for and open devices
and pass file descriptors to libusb.  Newer devices (Android 5+) even
prohibit listening for hotplug events, resulting in libusb failing to
initialize without this patch.

Note that this patch effectively renders libusb useless on older devices
that do not have USB support in the platform API (anything before
Android 5).

Closes #242

Signed-off-by: Vianney le Clément de Saint-Marcq <code@quartic.eu>
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants