Gentoo Wiki


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process

Merge-arrows.gifIt has been suggested that this article be Merged into one article with X11 Mouse    (Discuss)


Why would I want this?

Well if you have a laptop and have different settings for you USB-mouse as for you touchpad. It is a nice thing to have symlinks that point to the right mouse for your USB mouse and for you touchpad. For example what you boot your kernel your USB devices are recognised before your PS/2 devices. So if you forget to insert your USB mouse it is recognised after and your settings in your xorg.conf will be completely useless. So you would need a reboot. And well we do not want that. If we wanted to reboot we would use windows.

Get the info

Now run the command

# udevinfo -a -p `udevinfo -q path -n [path]`

where on path you insert your USB-mouse/touchpad.

Now we get a whole list of information. We need to look at it for our information and write down:


In my case my USB-mouse at the moment is on /dev/input/mouse1 so I enter:

# udevinfo -a -p `udevinfo -q path -n /dev/input/mouse1`

And this is the top of my output:

device '/sys/class/input/input2/mouse1' has major:minor 13:33
  looking at class device '/sys/class/input/input2/mouse1':

follow the "device"-link to the physical device:
  looking at the device chain at '/sys/devices/pci0000:00/0000:00:03.0/usb1/1-1/1-1:1.0':
    SYSFS{bAlternateSetting}==" 0"

So I need:

Now let udev handle it!

(ayqazi:) Note that assigning to NAME as done previously is unnecessary and confusing
(JoeR410:) In theory, you shouldn't be able to combine Kernel, Bus, and SYSFS{modalias} for a rule. See this site for some good information on writing udev rules.

So you got through the hardest part? Good for you! Now lets move on. With your favorite text editor edit/create: /etc/udev/rules.d/10-local.rules

Now insert [syntax]

BUS=="[BUS]", SYSFS{modalias}=="[SYSFS{modalias}]", KERNEL=="[KERNEL]", SYMLINK+="[SYMLINK]"

Now we can go substitue:

replace this with the bus you wrote down above
replace with the SYSFS{modalias} what you wrote down above.
replace with the 'KERNEL' you wrote down above only change the digit into an ?
replace with the sublink you want to create


In my case /etc/udev/rules.d/10-local.rules for my usb mouse would look like:

BUS="usb", SYSFS{modalias}=="usb:v046DpC016d0340dc00dsc00dp00ic03isc01ip02", KERNEL=="mouse?", SYMLINK="input/usbmouse"

I created a symlink to my usbmouse inside /dev/input/usbmouse. Wich will be created when I insert my USB mouse and delete when I unplug it.

And now what?

Now you can go to your xorg.conf and substitute the link to your old device with the symlink you have created. That way it does not matter what was recognized first: the USB-mouse or the touchpad.


Why do I need to replace the digit with a ? ? 
Since we do not know where it will be located (else we would not need the symlink) we use this wildcard.
Can I leave the NAME ? 
No! you can't then it will point to the event which is not where you want your symlink to point to.
Can I use something else than SYSFS{modalias} 
I did not test it but I think it is possible. It just has to be an unique thing of the mouse.
I do not have a laptop only a desktop 
well that way you won't need this how to since your desktop will only have one mouse.
Retrieved from ""

Last modified: Mon, 15 Sep 2008 04:12:00 +0000 Hits: 11,850