On Mon, 15 Mar 2004 16:17, [EMAIL PROTECTED] wrote: > Hi there, > > On Thu, 11 Mar 2004, Rocky Zhang wrote: > > I connected 4 USB floppy drives into my computer running redhat9. The > > logical device is /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd. I can see > > /proc/bus/usb/deivces USB device information(include bus number and > > port number), but it do not display logical device. How can use > > command or other ways to find physicl location(Bus number and port > > number) of /dev/sda? > > I think this is a lot easier with 2.6 kernels than with 2.4. > > 73, > Ged.
In 2.6 it's now possible to identify which device has just been plugged in terms of its numerical SCSI /dev/sg[0123...] device. But if you're using traditional /dev/sd[abc...] you still need some way of getting from /dev/sgN to /dev/sdX. For those not familiar with the problem: the sequence allocated in the /dev/sg[0123...] doesn't necessarily stay in alignment with the sequence allocated being allocated with /dev/sd[abc...] - so given /dev/sgN there's no simple way to figure out what /dev/sdX should be. I replied to this before - but I was having a bad day and stuffed up the posting. It was a short posting so I'll repeat it here: As far as I can tell, the only way to do this is to use sg_map from sg3_utils ( http://www.torque.net/sg/u_index.html ). I use it in my own usb desktop integration scripts, see http://users.actrix.co.nz/michael/usbmount.html Basically in bash: function scsiDevFromHostNumber { local n=$1 local scsiDiskDev=`sg_map -sd -a -x | awk --assign n=$n '$2 == n && NF == 7 { print $7 }'` if [ -z "$scsiDiskDev" ]; then scsiDiskDev="UNKNOWN" fi echo $scsiDiskDev } ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users
