Blog Post

1 mouse, 2 mouse, IT WORKS!

Thanks to muzzol for the solution to the plug/unplug detection of an external USB mouse and disabling/enabling the Synaptics Touchpad. And now the answer you have all be waiting for!

Add the following line to your /etc/udev/rules.d/85-hal.rules file:

KERNEL==”mouse*”, RUN+=”/usr/bin/”

Once you have added that, the next step would be to create the /usr/bin/ file. Here is what is in that file:

#echo “$DATE – [$*] – [$ACTION]” >> “$FLOG”
case $ACTION in
#echo “DEBUG: conectat” >> “$FLOG”
synclient TouchpadOff=1
#echo “DEBUG: desconectat” >> “$FLOG”
synclient TouchpadOff=0

Uncomment (remove the #) from the lines in the code if you want the script to log to /tmp/udev_test.log every time you plug/unplug your mouse. DO NOT remove the # from the #!/bin/bash line. And that concludes this tutorial. Thanks again to muzzol who left a comment in my previous post.

UPDATE: I forgot to mention that you need to make one small edit to your /etc/X11/xorg.conf file in order for the synclient command to work. Under InputDevice section, look for the Identifier for “Synaptics Touchpad”. This is where you want to add the following extra option:

Option “SHMConfig” “on”

This entry was posted in Linux and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Thomas Olsen

    Hi Richard

    Just what I needed – except that it doesn’t work for me. When I try to run:

    sudo synclient TouchpadOff=0

    I get an error saying:

    Can't access shared memory area. SHMConfig disabled?

    This is on a ThankPad T42 – so I guess it’s a Synaptic pad?

    Do u have any idea whats wrong?

  • OOOH, I forgot about this! Add the following to /etc/X11/xorg.conf

    Option “SHMConfig” “on

    So it should look like this:

    Section “InputDevice”
    Identifier “Synaptics Touchpad”
    Driver “synaptics”
    Option “SendCoreEvents” “true”
    Option “Device” “/dev/psaux”
    Option “Protocol” “auto-dev”
    Option “HorizScrollDelta” “0”
    Option “SHMConfig” “on”

  • Thomas Olsen

    Better late than never 🙂

    Thanks for the reply. I tried it but for some reason my xorg.conf gets overwritten whenever I reboot or log in and out again. Don’t think I’ve experienced that before.

    Wonder if this is a new Ubuntu thingy?

  • Pingback: heyko’s » links for 2007-02-13()

  • Wow ! it works .. but you have to take care of the quotation marks! I copied it from you blog-post and somehow it was not “the real”quotation marks and udev didn’t understand the config. also logging does not work as long as the /tmp/udev_test.log file is not existing .. you can use things like “logger mouse $ACTION” for easier debugging…

  • Subscribe to

     Subscribe in a reader

    Or, subscribe via email:
    Enter your email address:

  • Archives

%d bloggers like this: