Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Peter Stuge <peter-Y+HMSxxDrH8 <at> public.gmane.org>
Subject: Re: autodetect USB MTP device characteristics without libusb_open()
Newsgroups: gmane.linux.usb.general
Date: Tuesday 20th November 2012 18:26:06 UTC (over 4 years ago)
Linus Walleij wrote:
> If you insert any kind of device into a Windows machine, and Windows
> does not find a .inf file for it, it will be probed for the OS
> descriptor.
> 
> I think it avoids anything with != 3 endpoints of the right type
> though.
> 
> And basically that is how MTP devices "just work" on Windows,
> as far as I can tell.

Please see my previous description of how this works, in this thread.

Windows requests the 0xee string descriptor from *every* device,
unless the same vid and pid has been seen before on the system.


> it turns out that users want MTP devices to "just work"
> just like they "just work" on Windows.

IMHO there's no other way to accomplish that other than to implement
Microsoft's "extension" to USB; always request the 0xee string
descriptor if the vidpid has not been seen before.

It would mean that Linux systems must start keeping track of every
device that a system has seen. It's atrocious.

But I don't think there's another way. Of course, it could be part of
a non-core package, so that only when the MTP software is installed
will there be some database.

For most (I'm not sure I dare say all) other devices, it would add no
value on Linux.


> So there are devices that crash if you ask for descriptor 0xEE.
> 
> The way Windows gets around it is *probably* by using some
> of the heuristics above, like making sure that there is an
> interface with 3 endpoints and so on.
> 
> I don't know for sure :-(

When a vidpid is attached which has never been seen on the system,
Windows adds lots of values to the registry saying it has now seen
this device, and then asks for the 0xee string descriptor.

When a vidpid is attached which *has* been seen on this system
(Windows looks for those values) the string descriptor is not
requested.

End result: A given device only ever crashes exactly once on a given
Windows system.


> But they have this concept of an .inf file, so the first time
> you insert an alien device, you are asked for an .inf file
> with some driver information. Then you can bind that
> VID+PID to a specific driver, and then  they will not look
> further the next time the same device is plugged in again.
> They will just load the driver given from the .inf file.

Note that everything in the .inf gets stored in the registry.
Noone looks at the .inf again, once the driver has been installed.


> So I could mimic this by starting to cache away any
> successfully initiated MTP devices in some /var/libmtp
> file and just OK them the next time they are plugged in.

You'll have to cache *every* device, so that you do not make a given
device crash more than once, like Windows.


//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
CD: 3ms