Re: autodetect USB MTP device characteristics without libusb_open()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 5 Nov 2012, Linus Walleij wrote:

> Hi,
> 
> we had the following problem in libmtp:
> 
> - We have to autoprobe every plugged-in device to figure out if it is
>   MTP or not. These devices are numerous and we can no longer
>   count on users reporting each and every VID+PID out there
> 
> - Class codes cannot be used
> 
> - Have to look for devices with interfaces with certain endpoints:
>   - 1 BULK in
>   - 1 BULK out
>   - 1 INTERRUPT in
> 
> - Then we do deeper probing.
> 
> - However some devices bug out on libusb_open() which is in turn
>   needed to use libusb to figure out if the interface has these
>   BULK and INTERRUPT characteristics
> 
> So since I cannot use libusb_open() I have added code like below
> to libmtp to instead inspect sysfs *before* starting any libusb-based
> business. It is run from udev and udev provides the sysfs node and
> that is passed to check_sysfs().
> 
> So:
> 
> - Is this a good idea?

It's perfectly fine and should work okay.

> - What is the scary business that libusb_open() does that makes
>   a lot of substandard USB devices totally freak out?

I have no idea.  As far as I know, libusb_open() doesn't do any 
communication with the device.

Try collecting a usbmon trace to see what libusb is doing.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux