LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] usb autodetection

[ILUG] usb autodetection

Gavin McCullagh ilug_gmc at fiachra.ucd.ie
Sun Feb 1 21:00:31 GMT 2004


On Sun, 01 Feb 2004, Darragh Bailey wrote:

> Got a problem with the way devices are plugged into usb ports and assigned
> devices. As I've a couple of devices, printer, pen-drive & memory-card reader I'd
> like to have /etc/fstab entries for them so that if anyone else in my family
> needs to use the computer (I've persuaded them to use linux over windows) that
> they can access these devices without any problems.
> 
> At the moment the devices /dev/sd[a-c] are assigned based on what order the usb
> devices are plugged in and activeded. 

I may be wrong here but as I understand it one change in the 2.6 kernel
quite directly addresses this.  

http://www.infoworld.com/infoworld/article/04/01/30/05FElinux_1.html

"Using udev, the system is able to follow devices as they move around on
connected busses, with the device identifier remaining static. For
instance, the first-seen SCSI device will remain as device sda, using the
serial number of the device as an identifier regardless of the order in
which it’s found during a later boot."

However, unless you're feeling rather brave I'd wait until Fedora are
packaging 2.6.  They're not yet right?

> so is there any way that I can control which /dev/sd[a-c] entry is assigned to
> which device. 

You could write yourself a little script which does it for you.  They're
likely all formatted vfat.  If you can identify something on each device
which characterises it as opposed to the others your script can pick the
mount point on that basis.  One possibility is the serial number.  I have a
pen-drive inserted now.  Looking in /proc:

gavin at robin gavin> cat /proc/scsi/usb-storage-0/1 
   Host scsi1: usb-storage
       Vendor: TwinMOS-PDM 
      Product: USB 2.0 Mobile Disk    
Serial Number: B090614503861
     Protocol: Transparent SCSI
    Transport: Bulk
         GUID: 126f1325000b090614503861
     Attached: No

so, your script might read the above file and have mount points associated 
with known serial numbers (and guests).  When they insert the device,
either the system or the user runs your simple script and it mounts all
devices it finds according to the mapping.  If it finds a new disk, it
should allocate a new mount-point automatically.

I'm afraid I'm going to leave the script as an exercise rather than
embarrass myself ;)

Gavin




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell