Thanks for the great post, Daniel! I've been using udev for a while now, but never really took advantage of it like that yet.

Good info, much appreciated - it's posts like this that I like reading these lists for - it's not something I was looking for information on, but I've learned something new that will improve the Linux Experience. :)

Paul

Daniel Drake wrote:

Collins Richey wrote:

Cool. Does it do anything for you that devfs doesn't?


I too have it running. devfsd is unmerged, and devfs is not compiled into the kernel.


There are a few advantages over devfs - devfs has not been developed for quite a while, udev has had years of planning and months of active development..

For me, udev's most useful feature is the workaround to naming problems.
I have one of those USB hard disk (pen drive) things, and I also have a USB digital camera. Both identify themself as usb-storage devices, and they use the "scsi disk support" part of the kernel.
When I plug in the first device, /dev/sda1 is created. I can mount /dev/sda1 to wherever I like and access the files/pictures.
The second device becomes /dev/sdb1.


Now imagine that you wanted to set up a script to download images from your camera, while the USB flash drive is also plugged in. You don't know if it is sda1 or sdb1, because it depends which device was plugged in first.

udev provides a solution here, you can write rules so that as well as sdx1 being created, it creates a second link. You can make your usb drive *always* be /dev/usbdrive and camera /dev/camera - no matter which order they were plugged in.

I have used udev rules to create a directory, /dev/user/, of the nodes which I personally use in scripts/mountpoints. I have nodes in there such as: dvd, cdrw, camera, usbdrive, floppy.

If you are interested, here's my camera rule.
#digicam
BUS="usb", SYSFS_product="USB 2.0M DSC", SYSFS_dev="*:1", NAME="%k", SYMLINK="user/camera"


Often rule writing isnt quite as complex as that, the _dev bit was needed here because the camera created /dev/sda and /dev/sda1. I only wanted the sda1 bit as /dev/user/camera.
Rule writing is made easy by a program named "udevinfo". Or you can just read the values out of /sys yourself.


Its nice :)

--
[EMAIL PROTECTED] mailing list




--
[EMAIL PROTECTED] mailing list



Reply via email to