2013/8/19 Toby Gray <toby.g...@realvnc.com>
> On 18/08/13 13:01, Anton Smirnov wrote:
>
> Android can return file descriptor for native code:
>
> http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection.html#getFileDescriptor()
> Does libusbx support it?
>
>
> Not currently. It would be quite a change to be able to support it as
> libusb would need to map the open file descriptor back to a bus and device,
> which would be hard.
>
Not sure that it's true but anyway. Behind the scene libusb get's file
descriptor as int and holds it in internal structure. So android just
returns exactly the same int file descriptor, so there is no need to open
file using liusb_open() - we just need to inject ready file descriptor.
>
> An alternative choice would be to add an Android backend which makes use
> of JNI to invoke the UsbDeviceConnection APIs, although that would be
> equally tricky.
>
This is already done in this project (see introduced void
usb_device_set_open_close_func(..)
https://github.com/keesj/librtlsdr-android/blob/android/include/libusb.h
>
> What are you trying to do?
>
I'm trying to communicate with usb device that uses FTDI chip on Android.
>
> If you want to get a list of devices for use with libusb you should call
> the libusb API for it ( libusb_get_device_list). If you want to use the
> android.hardware.usb.* APIs to access the device you should use those APIs.
>
This already works for me using libusb_get_device_list().
The problem is that any request fails with -32 error even if request data
is exactly the same as required.
The same code works great for CDC-devices so general approach is working
for me.
>
> Also libusb or android has the next issue for ftdi-devices:
> https://code.google.com/p/android/issues/detail?id=58873
>
>
> I'm not familiar with libftdi, but even if libusb somehow supported the
> android.hardware.usb.* APIs, wouldn't you need to make changes to libftdi
> to get it to call the passing file descriptor APIs?
>
libftdi is a small lib to create vendor-specific usb requests (to set baud
rate, line controls, etc), so it does not make sense in general.
the problem is that it works over libusb for usb interaction and it's
libusb error, not libftdi.
>
> Regards,
>
> Toby
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> libusbx-devel mailing list
> libusbx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusbx-devel
>
>
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel