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

Re: udev - easy setup ?



On Sunday 31 July 2005 21:15, Uwe Dippel <udippel@uniten.edu.my>
(<pan.2005.08.01.03.15.43.865975@uniten.edu.my>) wrote:

> Hi, and yes, I read the great source written by Dan:
> http://www.reactivated.net/writing_udev_rules.html

That's some good documentation.

> Only, it is too difficult for me to understand, and I read it a few times.

I read it many times and it still took me several tries to get it working.

> Though I have to consider the idea to create the device nodes as
> phantastic

It's a great idea: move naming policy into user-space.

> I also have to dismiss its current implementation as 
> 'braindead', because nobody can be expected to devise rules like

Even I was able to write the few udev rules I wanted; I'm not an expert, but
I'll try to offer you some advice.

> BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device",
> NAME="%k", SYMLINK="usbhd%n"

Are you using this rule?  Do you have others?

> I have a notebook with USB-floppy; with udev.
> When I plug the floppy, it comes up as sda1. So I put it into fstab,
> otherwise it wouldn't mount. Now it mounts fine.

When you put 'sda1' into /etc/fstab, you're using the kernel's name for the
device, corresponding to the 'NAME="%k"' parameter.  You're finding that
the kernel's name changes at the kernel's pleasure and this isn't what you
want.

Both NAME and SYMLINK are used to names for particular devices.  The rule
you quoted does two things: it creates a device node using the kernel's
name (/dev/sda1) and it creates a symbolic link to that node
(e.g., /dev/usbhd0).

> When I plug a thumb-drive to the notebook, udev allocates sdi1.

The rule you quoted may be too general for your intended use.  After
mounting both devices, run 'ls -l /dev/*' and look for symbolic links from
sda1 and sdi1.  If they're not both udbhd? links, you should be able to use
the link names in /etc/fstab in place of the "sd[ai]1" names.

If both devices have 'usbhd' names, the trick is to give the floppy drive a
specific name, such as /dev/usb_floppy, and then give thumb drives names
such as /dev/usbhd0, /dev/usbhd1, etc.  You'll want to create a specific
rule for the floppy so that it doesn't get a name which
matches /dev/hdbhd*.  Put the floppy rule before thumb drive rule).

I'm personally unable to work out the solution for you as I have but a
single USB device.  Unless someone can provide specifics for you, reread
the section

  http://www.reactivated.net/writing_udev_rules.html#identify-keys

and, using 'udevinfo', find some key or set of keys that allow you to
identify your floppy specifically.  Use that information in the
floppy-drive rule with a different SYMLINK.  If you'll "never" connect more
than floppy, you can use something like SYMLINK="usb_floppy"; similarly for
your thumb drive.

> Can anyone get me closer to a solution, please?

If you find my rambling hints ineffective, do this (copied from Dan's
article):

Mount your devices as you've done previously, so that they're sda1 and sdi1. 
Then run

  udevinfo -a -p $(udevinfo -q path -n /dev/sda)

and

  udevinfo -a -p $(udevinfo -q path -n /dev/sdi)

and post the output here.  This is where you'll find what you need for the
magical udev incantations.



Reply to: