Distinguish between USB HDD & USB Pen drive
Hi,
I want to differentiate a USB HDD from a USB Pen driver from my application by just reading the USB device/interface descriptors. I observed in both the cases the following are the same: Device Class - 0x00 InterfaceClass - 0x08 InterfaceSubClass - 0x06 InterfaceProtocol - 0x50 That why I am not able to distinguish these two. Any idea is appreciated. Thanks in advance. Regards, Deb |
|
Hi aus9,
No I am trying to find all the device descriptors from my application without using libusb & UDEV. Actually I can retrieve all the descriptors but couldn't distinguish USB HDD & USB Pen drive. Regards, Deb |
hmm well not sure what you are attempting but udev and its tools can get you information on serial numbers which may be the easiest way to distinguish between devices?
|
Ok, even if I use LibUSB, can you tell me how can I identify if the inserted device is Hard disk or Pen drive? Only thing I can tell that the inserted device is Mass Storage Device. That also from the Interface Class number.
Regards, Deb |
hi
well I still do not understand what the issue. Maybe you can be more verbose? 2) in my file manager...my hal and udev so my device names are different for my 2 usb sticks....sorry don't own an usb hd. here is one way to see it thru the file manager...Your pathway may differ...its to give you an idea? /sys/block/sdb/device/vendor or by command cat /pathway above/vendor shows my usb makername. which for me is easy as my other usb is different coy name. 3) so if same coy name you could look at a different file? model...for me shows flash disk whereas the hd may show different? /sys/block/sdb/size maybe useful? 4) if you like commands try inserting one usb device at a time and running with root powers tail -n 20 /var/log/messages mine shows usb serial number |
Hi aus9,
Ok let me give you all the information behind my question. I want to write an application which will identify any inserted or attached USB device without using LibUSB. From the Sysfs my applicatin can retrieve all the USB related information (i.e. device descriptors) about all the connected USB devices. From the device descriptors, the application can easily identify whether the connected device is USB mouse or USB BT Dongle or USB Mass Storage Device, but what it couldn't identify is whether the connected Mass storage device is USB HDD or USB Pen Drive as in both the cases, all the device descriptors are same. My development PC is Ubuntu 8.10. Regards, Dev |
ahh ok.
edit I still think udev rule will identify the correct devices because you can create an ATTRS udev rule because your log tells you the serial numbers otherwise if you refuse to write udev rule....create a script with an if then if cat /var/log/messages | grep (serialnumberfor pen)....then device is sdx ditto for hd...and you may need to post to programming forum now that I can not help you |
All times are GMT -5. The time now is 07:19 PM. |