[TriLUG] finding udev renamed flashkeys

Joseph Mack NA3T jmack at wm7d.net
Mon Apr 13 07:53:32 EDT 2009


On Sun, 12 Apr 2009, Rodney Radford wrote:

> This is what I get from 'lsusb':
>
>   $ lsusb
>   Bus 002 Device 003: ID 0781:5406 SanDisk Corp. Cruzer Micro 1/4GB Flash Drive
>
> I think your question is how can I map sdc1 to the above usb device - right?

yes

> So checking the /sys/devices directory tree for sdc, we see:
>
>   $ find /sys/devices -name sdc
>   /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0/host3/target3:0:0/3:0:0:0/block/sdc
>
> So now we know that sdc is a USB device (usb2 in the path), but how do we know it is the correct usb device (I only had one usb device, but you could possibly have many mounted).
>
> Take a look at the files:
>
>   $ cat /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-2/idProduct
>   5406
>   $ cat /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-2/idVendor
>   0781
>
> This is the same product and vendor id we saw from lsusb.

ah. thanks. I was hoping for something easier (like the scsi 
device for the usb drive appearing somewhere in /sys). But 
this will do.

> So it seems like you could use walk the /sys/devices tree 
> to find the correct sd* device, and then check the 
> idProduct and idVendor to find one that matches the device 
> you want.
>
> Does that help you in the right direction?

yes. This will do. Greg has an alternative way of doing 
it. I'll figure out something from both of your postings.

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list