|
From: Antão A. <ant...@gm...> - 2016-03-15 14:23:54
|
I'm using the Gritzman fork (https://github.com/Gritzman/libusb), based on the OPENNI fork, that fixes the known Android file descriptor and SELinux issues. Root is not required. Looking at the source I found that the file descriptor is not passed in as a libusb_open() parameter. It's inferred by the linux backend from the libusb_device passed in. I need then to get the libusb_device from the device enumeration and validate using the known vendor and product ids. I'm using Android USB Accessory mode where the connected device is the host and implements Android Open Acessory (AOA). My app is not running on the host and the issue now is that the device does not show up in the device enumeration... :( I'm going through all this because using the Android public API I'm getting too many ENODEV errors. Unfortunately this is a known Android bug (feature?) so I'm trying to find a workaround. Thanks, Antao On Tue, Mar 15, 2016 at 9:26 AM Xiaofan Chen <xia...@gm...> wrote: > On Tue, Mar 15, 2016 at 12:39 AM, Antão Almada <ant...@gm...> > wrote: > > Hi all, > > > > I've been researching for a while but I'm misssing some essential parts. > > > > I already know that I need to request the user permission to access the > > device and then pass the respective file descriptor to libusb. > > > > I successfuly built the latest libusb source but then how do I pass in > the > > file descriptor? > > Take note the latest libusb source has not integrated any of > the patches for Android with regard to file descriptor enhancement. > > https://github.com/libusb/libusb/tree/master/android > > > I also tried to use some of the many forks that add an fd parameter to > > libusb_open() but then what do I pass in for the first parameter? Do I > have > > to get it from libusb_get_device_list()? If so, how do I map the Android > > UsbDevice or UsbAccessory to a libusb_device? > > > > I do not know about the answer. But anyway, personally I think without the > official integration, libusb under Android is basically a no-go for most > users > since it requires root. > > -- > Xiaofan > |