Re: device names given to USB devices on Linux
From: Vikas (vikas.dogra_at_tabs.toshiba.com)
Date: 8 Sep 2004 12:14:00 -0700
dmesg some times does not gives you a device name . .
for example i attached this flash drive and did'nt get the name
hub.c: new USB device 00:1f.2-2.2, assigned address 5
scsi1 : SCSI emulation for USB Mass Storage devices
Vendor: MicroAdv Model: QuickiDrive128M Rev: 2.00
Type: Direct-Access ANSI SCSI revision: 02
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 5
I tried deriving the name by the order in which they appear in
/proc/scsi/scsi but that also didn't work ...coz you don't know which
device is getting attached .if you attach a device which was attached
earlier then the previous entry is used.
Dances With Crows <danSPANceswitTRAPhcrows@gmail.com> wrote in message news:<slrncjsfu6.cs3.danSPANceswitTRAPhcrows@samantha.crow202.dyndns.org>...
> On 7 Sep 2004 15:52:46 -0700, Vikas staggered into the Black Sun and
> > I have an application which needs to mount the flash drives getting
> > attached to the USB port on the Linux system. These flash drives can
> > be of any model and from any vendor. To mount these flash drives i
> > need to know the device name given to the flash drives like
> > /dev/sd??.I know you can get the name by looking into the dmesg or
> > /var/log/messages but i want to do it Programmatically.
> So write a Program that parses the output of "dmesg | grep SCSI device
> sd" then. Don't make things harder than they should be, eh? If you're
> using devfs/udev, you can always try polling /dev/discs/ at 5-second
> intervals looking for changes, but you didn't say anything about that.
> > I went through lot of stuff regarding this but can't find the
> > solution. Does anybody has an answer?
> Where did you look, what did you find, what have you tried already?
> Parse dmesg's output; it'd be doable in one regular expression.