This page is amazing. I used this to create a udev rule for my mplayer. So far my custom udev rules are as follows:
#Palm M125
BUS="usb", SYSFS{serial}="PalmSN12345678", NAME="pilot",
SYMLINK="usb/pilot"
#Rave MP3 Player
BUS="usb", KERNEL="sd?1", SYSFS{serial}="0002F5CB09294C87",
NAME="mp3", SYMLINK="usb/mp3"
Writing udev rules: "Example: Writing a rule for my USB-Storage digital camera
Quick Intro: My camera identifies itself as an external SCSI hard disk (it uses the usb-storage driver which is also used by devices such as USB hard disks and flash-card readers). I can then mount the partition on that disk and copy images over. Not all cameras work like this - many require external software (e.g. gphoto2) to be able to access photos.
This one is a bit tricky. Several nodes are created by default when my camera is connected : /dev/sda and /dev/sda1, and possibly even /dev/sg1. This is an example where specifity is important - if your rule is not specific enough, it could match any of the above 3 nodes.
sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. udevinfo did not point out any useful differences between sda, sda1, and sg1. I decided that a reliable way to differentiate between these 3 nodes would be to look at the KERNEL name.
A key such as KERNEL='sd?1' would match KERNEL names such as 'sda1', 'sdb1', 'sdc1', and equally importantly, it will not match KERNEL names such as sda, sdb, or sg1. The purpose of this key is to ignore the /dev/sda and /dev/sg1 nodes. The device is a digital camera - I would not dream of fdisking it or anything like that, so these 2 nodes are pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!"
Tuesday, May 10, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment