Up until recently, udev, was a mystery to me, but I’m starting to learn. Udev is a service you probably want running with recent kernels. What it does is to create a node in the /dev directory whenever a new device is recognized. So, if you plug your m500 Palm Pilot and press the sync button, hotplug will recognize the device and udev should create the node in /dev for you with whatever naming convention you prefer.
First, before we name it, we want to figure out how the device looks to Linux, to do so press the sync button and do
lsusb -v | more
You should see something like this (but more verbose):
Bus 001 Device 014: ID 0830:0001 Palm, Inc.
idVendor 0x0830 Palm, Inc.
iManufacturer 1 Palm, Inc.
iSerial 5 00TPP123A4KG
What is interesting is the serial number. This is a unique identifier for the device we can use to tell udev what to do with this device in particular. Not all USB devices have a serial number, but they have plenty of information to help you identify them. So we will add a new rule to tell udev what to do with this particular device, assuming you a vim-lover, do this:
and enter the following line:
This tells udev to create a node called m500 in /dev whenever this serial number is encountered. For extra points, I specify the ownership and permissions on the device. The device will appear as “/dev/m500”. You might have to type “udevstart” for the new rule to take effect, though I’m unclear about this. Anyhow, press the sync button and check that /dev/m500 is created.
Because /dev/m500 is created only when I press on the sync button and not before, software such as jpilot has a hard time because it doesn’t want to wait on a non-existing device. To fix this problem, we simply create a symbolic link:
ln /dev/m500 /dev/pilot
And voilà! Launch jpilot and you should be all set.
This whole approach is generally applicable to usb devices. Suppose you have a device such as /dev/sound/dsp1 and you want to know how to select it using udev rules, type the following:
udevinfo -n /dev/sound/dsp1 -q path | xargs udevinfo -a -p
This will give you interesting ways to select your device using an udev rule:
By the way, if you are using gentoo, the directory /sys automatically lists all the devices on your machine. It isn’t friendly, but it is good to know.