On Fri, 27 May 2005, Wakko Warner wrote:

> > In general, USB floppy devices do not report any special values to
> > indicate that they are floppies.
> 
> I found this out.  I don't know yet how to query a scsi disk device to see
> if it has media loaded.  The ioctl commands I've read through in the kernel
> seems to indicate that I need to use SG_IO because the ones that I want to
> use are obsolete.

If you use the sg driver then you don't need ioctl at all.

> I do know that Windows can detect if a usb device is floppy or other media. 
> There has to be some way to tell this.  Of course, windows may just have a
> list of ids or something to do this.  I'm not exactly sure what information
> is in the sysfs for each usb device.  I can see InterfaceClass and other
> stuff, but I have no idea what the numbers are.  Is there a place for this
> information?

Broadly speaking it's documented at the official USB web site, 
www.usb.org.  You'll have to dig a bit to find the appropriate developer 
documents.  A good place to start is the USB 2.0 Specification.  It has 
lots of stuff you're probably not interested in, and it doesn't list the 
assigned values for things like bInterfaceClass (another document does), 
but it does explain the overall framework and meaning of these values.

> > > Another question (not related, not worth a seperate message either), is it
> > > possible to detect a usb2.0 device plugged into a usb1.1 port?
> > 
> > Yes.  In fact you can see it directly just by reading
> > /proc/bus/usb/devices.  The USB version of the device is the "Ver=" field
> 
> I did this on my machine that is my gateway.  My internet device is a
> NETGEAR EA101 USB Ethernet Adapter (P:  Vendor=0846 ProdID=1001 Rev= 2.02)
> When I cat this file, it hung for a few seconds and this device went into a
> bad state (quit working) until I unplugged and replugged.  This is not the
> first time I've hit this problem (2.6.10, I plan to upgrade to 2.6.12-rc5 or
> newer next week)

The newer kernel should work better.  Until recently the device strings 
were fetched from the device every time the file was read.  Some 
not-so-hot devices (like your adapter apparently) would get confused by 
this if they were busy doing other things at the time.  Now the most 
recent kernels read the strings only once, when the device is probed, and 
save the results.

> > on the D: line.  To find the USB version of the port, use the "Bus=" field
> > on the T: line, and search the file for an entry with the same Bus value
> > and with "Lev=00" (or "Prnt=00", they mean the same thing).  That's the
> > entry for the computer's USB controller, and its "Ver=" value will tell
> > you what sort of port it is.
> 
> Found it on my box, ver= was blank for that bus.

That's weird.  Can you post the relevant entries from your
/proc/bus/usb/devices?

> > Your question suggests that you might be more interested in the device's
> > speed rather than its USB version.  (Note that it's perfectly legal for a
> > USB 2.0 device to run only at low or full speed, although a USB 1.1 device
> > will never support high speed.)  The kernel will print a message in the
> > system log if a high-speed device is plugged into a full-speed port when a
> > high-speed port exists.  Unfortunately it's not so easy to tell from
> > /proc/bus/usb/devices or from sysfs whether or not a USB 2.00 device
> > supports high speed.  You can tell that the device is USB 2.00 and that
> > it's currently running at full speed, but then the only way to know
> > whether it supports high speed is by reading the DEVICE QUALIFIER
> > descriptor.  You can probably write a program to do that using usbfs.
> 
> Any pointers on how to write this?  I will be writing this in perl.  The
> target system is mostly perl based (it's sorta like embedded but runs off a
> tmpfs filesystem)

Now's not a good time, but later on I'll send a sample routine in C 
demonstrating how to do it.  Translating from C to Perl will be your job!

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to