Sam Halliday <[EMAIL PROTECTED]> writes: > i would very much like to have a symlink set up by udev (/dev/input/mousemain or > similar) which points to the /dev/input/mouseX unless it has been removed, in > which case it should be pointed to /dev/input/mouse1. > > unfortunately the /dev/input/mouseX devices all remain when the usb mouse is > unplugged and reconnected.
First you need to get SYSFS information and then plug it in. Let me use my mouse as an example. My usb mouse shows up as /dev/input/mouse2 Doing a "udevinfo -n input/mouse2 -q path", gives me /class/input/mouse2 Now, using the sys path, I can check for the sys variables, doing "udevinfo -p /class/input/mouse2 -a" Looking through the information, I see this: looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1': BUS="usb" ID="1-1" SYSFS{bConfigurationValue}="1" SYSFS{bDeviceClass}="00" SYSFS{bDeviceProtocol}="00" SYSFS{bDeviceSubClass}="00" SYSFS{bMaxPower}=" 98mA" SYSFS{bNumConfigurations}="1" SYSFS{bNumInterfaces}=" 1" SYSFS{bcdDevice}="1320" SYSFS{bmAttributes}="a0" SYSFS{detach_state}="0" SYSFS{devnum}="3" SYSFS{idProduct}="c012" SYSFS{idVendor}="046d" SYSFS{manufacturer}="Logitech" SYSFS{maxchild}="0" SYSFS{product}="USB-PS/2 Optical Mouse" SYSFS{speed}="1.5" SYSFS{version}=" 2.00" Now, pick up to SYSFS variables that would make the udev rule uniq, for instance idProduct and product. So, construct the udev rule: BUS="usb", SYSFS{idProduct}="c012", SYSFS{product}="USB-PS/2 Optical Mouse", NAME="input/%k", SYMLINK="usbmouse" Basically, this means, for USB device with idProduct "this" and product "that", create a node called input/%k (where %k is the kernel name for the device), and a symlink called usbmouse (everything is relative to /dev). Save this in a file like 05-mouse.rules, and store it in /etc/udev/rules.d Now, no matter what the kernel tells udev the mouse is named, udev will create a symlink pointing to it. -- John L. Fjellstad web: http://www.fjellstad.org/ Quis custodiet ipsos custodes -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]