Re: Finding device filenames for USB devices

From: Mogens V. (monz_at_danbbs.dk)
Date: 08/23/05


Date: Tue, 23 Aug 2005 23:32:26 +0200

Matt wrote:
> Suppose I plug a USB device such as a camera or UPS or keyboard into a
> USB port.
>
> How do I find the filename of the linux device associated with the port?

cat /proc/scsi/scsi

lists the various scsi devices. USB devs becomes the first free scsi
device after any scsi disks. Look in your /etc/fstab for scsi disks, use
mount to see what's mounted.
In my case /dev/sd{a,b} are the two SATA disks, so any USB/Firewire
device will be some variation of /dev/sdc :

bash-2.05b# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
   Vendor: ATA Model: ST3160023AS Rev: 3.05
   Type: Direct-Access ANSI SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
   Vendor: ATA Model: ST3160023AS Rev: 3.05
   Type: Direct-Access ANSI SCSI revision: 05
Host: scsi7 Channel: 00 Id: 00 Lun: 00
   Vendor: USB Model: Flash Drive Rev: 1.12
   Type: Direct-Access ANSI SCSI revision: 02

bash-2.05b# cat /proc/bus/usb/devices

...snipped...

T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1005 ProdID=b113 Rev= 1.00
S: Product=USB Flash Drive
S: SerialNumber=123456789ABCDEF
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

bash-2.05b# grep sdc /etc/fstab
/dev/sdc /usbflash auto
noauto,rw,user,exec,dev,sync 0 0
/dev/sdc6 /usbntfs auto
noauto,rw,user,exec,dev,sync 0 0
/dev/sdc1 /usbbackup ext2 defaults 1 2
/dev/sdc5 /usbext2 ext2 defaults 1 2

There are tools to handle this annoying changing of devicenames; just
don't remember what's what rite now.

Something to use with the ufs filesystem, IMMSMR.

Oh... lots'a Xpostings, probably not to every ones likings. YMMV :)

-- 
Kind regards,
/Mogens V.
PCIe virtualisation: Imagine cat herding with a firehose
and firecrackers. That is notably easier than getting all
the peripheral makers to play along.
   -- fun on theinquirer.net


Relevant Pages