From: Vianney le C. de Saint-M. <co...@qu...> - 2018-12-05 21:42:42
|
This patch series adds support for recent Android devices (tested up to 8.1). On such devices, SELinux policies prevent the use of sysfs and reading /dev/bus/usb. The only way to use libusb as a regular user is to get a file descriptor through the Android Platform API and pass it on. All operations must use that file descriptor. This series adds an API function to libusb to wrap an open platform-specific device handle as a libusb_device_handle. On Linux, the only platform supported in this series, a platform-specific device handle is a file descriptor. To ease reviewing, the series is decomposed as follows: * Patches 1-3 contain light refactoring and small utility extensions needed later on. * Patch 4 adds the public API function. * Patch 5 implements the new API for the Linux platform. * Patch 6-7 ensure the libusb library is able to initialize on Android. Please note that patch 7 (disable hotplug events on Android) means that libusb cannot be used anymore standalone on a rooted Android device. Is that an issue? If so, I guess the way to go is to make it a compile-time option. Could you please keep me in CC when reviewing the patches, as I am not subscribed to the list. Thanks. Vianney le Clément de Saint-Marcq (7): linux_usbfs: Fallback to usbfs if device has no sysfs_dir linux_usbfs: Extract device handle initialization from op_open() linux_usbfs: Get device address from file descriptor core: Add libusb_wrap_sys_device() API linux_usbfs: Implement libusb_wrap_sys_device() linux_usbfs: Use fallback usbfs path on Android linux_usbfs: Disable hotplug events and scanning on Android libusb/core.c | 72 +++++++++++++++ libusb/libusb.h | 1 + libusb/libusbi.h | 28 ++++++ libusb/os/linux_udev.c | 2 +- libusb/os/linux_usbfs.c | 196 ++++++++++++++++++++++++++++++---------- libusb/os/linux_usbfs.h | 2 +- 6 files changed, 249 insertions(+), 52 deletions(-) -- 2.19.2 |