2010年1月7日 星期四

Device Number Swap During Each Reboot on Arch Linux

to specify loading order of modules in /etc/rc.conf is not working

solution: write custom udev rules

1. get a list of all the attributes of a device

udevadm info -a -p $(udevadm info -q path -n /dev/video0)

first block of the result

looking at device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/video4linux/video0':
KERNEL=="video0"
SUBSYSTEM=="video4linux"
DRIVER==""
ATTR{name}=="Logitech QuickCam Zoom"
ATTR{index}=="0"
ATTR{button}=="0"

2. create rules in /etc/udev/rules.d

vi /etc/udev/rules.d/10-local.rules
--

KERNEL=="video*" ATTR{name}=="Logitech QuickCam Zoom", SYMLINK+="webcam"
KERNEL=="video*" ATTR{name}=="saa7133*", SYMLINK+="tvcard"

10 is the number in sequence
* is wildcard character

3. the symbolic links, /dev/webcam and /dev/tvcard will be created and linked to the corrrect devices when loaded udev rules so you can use soft links instead

沒有留言: