On Fri, 27 May 2005, Wakko Warner wrote: > I was working on a program that searches out for all block devices in the > system via /sys (kernel is currently 2.6.12-rc5). I needed to tell the > difference between a usb floppy and other usb disk devices (If possible, I'd > like to beable to also differentiate between flash and disk). I tried the > interface file that's in /sys/block/<device>/device/../../../ > Unfortunately, it's not reliable. I tried a floppy from a dell system which > this file does not exist.
As far as I know, there is no way to do this reliably. Probably the most direct approach would be to check the capacity of the device, since a floppy will have a capacity of only a few MB. But that's not possible if no medium is loaded. In general, USB floppy devices do not report any special values to indicate that they are floppies. > 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 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. 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. 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
