How do I determine if a connected USB device is a USB flash drive?

how do you determine what kind of media has been attached to the system?
I have Ubuntu, and when I inserted an SD-card, it notices that it is in fact an SD card. Same counts for USB sticks.
But how can I determine on low level when a new device is inserted, what kind of type it is?
There seems to be no information to be found on this at all.
edit: just to be more complete: I said it is a Linux environment, but actually it is Android in an Embedded environment. I tagged it Linux because I am indeed trying to check from command line.
The udevadm command is not available, and lsusb -vv shows:
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 0424:2640
Bus 001 Device 003: ID 0424:4040
Bus 002 Device 001: ID 1d6b:0001

Answers:-

It may be useful to run such a command:
$ udevadm info -a -p $(udevadm info -q path -n /dev/sdX)
The output may looks like follows:
[...]
  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5':
    KERNELS=="1-1.5"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="80"
    ATTRS{bMaxPower}=="200mA"
    ATTRS{urbnum}=="6519"
    ATTRS{idVendor}=="13fe"
    ATTRS{idProduct}=="1d00"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="3"
    ATTRS{devpath}=="1.5"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Kingston"
    ATTRS{product}=="DataTraveler 2.0"
    ATTRS{serial}=="5B7A08A1010F"
[...]
You can see some ATTRS that describes the device.

0 comments:

Post a Comment

Don't Forget to comment