[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hotplugging more USB devices



On Tue, Jan 24, 2006 at 05:50:03PM -0600, Ken Bloom wrote:
> Ralph Kutschera wrote:
> > Hi List!
> > 
> >   I have a 4-in-1-CardReader and an external hard disk connected to my
> > PC via USB. Ok, hotplugging would work if I could trust that same card
> > slots or disk would be mapped to the same scsi devices always. However,
> > depending upon when i turn on/off the external hard disk or
> > inserting/ejecting a card to the reader, the devices are sometimes
> > /dev/sda, /dev/sde, whatever.
> > 
> >   My question now: How can I setup hotplugging so, that disk partition 1
> > mounts to /mnt/ext1, the other partition to /mnt/ext2. Or my slot for
> > SD-Cards mounts to /mnt/cards/sd. Whatever. You know.
> 
> You'll need to learn about how to do this with udev rules. Doing it with
> udev rules will take a little creativity (becasue what have to do will
> depend on your hardware configuration), but not much more than is normal
> when working with udev.
> 
> http://www.reactivated.net/writing_udev_rules.html
> 

Let me offer a little more encouraging view of what is needed.  The
above URL tells you how to display information that the kernel
discovers from a USB device when it is plugged in.

You need to find something in these displays that is unique for each
device that you intend to plug in.  I like to look for a device serial
number, but anything that is unique in the limited domain of the stuff
that you own, will do. I have several flash memory devices, all from
Sandisk. I want to keep them separate. I have several cameras. Camera
serial #s and flash memory serial #s have different formats so the
kernel will not confuse one for the other.

Then, for each USB device, you need to decide what you would like to use
as a device name in /dev. Do not try to trigger your /dev node name on
which socket you use in your 4in1 USB box. Decide on a unique name for
each USB gadget that you want to plug into your computer. 

Follow the document to have your rule create a device node using the
kernel convention for device node naming. And, add to that rule an
indication that you want a symlink with your unique device name.

Key in these rules and restart udev. When you plug in a USB device,
the rule will be triggered by the unique string you discovered in
step one, and a device node and a symlink to that device node will
be created.

To mount the device use pmount, which is available as a debian
package.  This does not require root access.

This is supposed to be simple. If it doesn't appear simple, it's
because I didn't do a good job of writing, not because it is really
complicated.

-- 
Paul E Condon           
pecondon@mesanetworks.net



Reply to: