1 mouse, 2 mouse, IT WORKS!

20 01 2007

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/udevmice.sh”

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

#!/bin/bash
#DATE=`date`
#FLOG=”/tmp/udev_test.log”
#echo “$DATE – [$*] – [$ACTION]” >> “$FLOG”
case $ACTION in
add)
#echo “DEBUG: conectat” >> “$FLOG”
synclient TouchpadOff=1
;;
remove)
#echo “DEBUG: desconectat” >> “$FLOG”
synclient TouchpadOff=0
;;
esac

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”


Actions

Informations

5 responses to “1 mouse, 2 mouse, IT WORKS!”

20 01 2007
 Thomas Olsen (12:38:56) :
 Using Konqueror 3.5 on Kubuntu Linux

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?

20 01 2007
 nixternal (13:45:18) :
 Using Mozilla Firefox 2.0.0.1 on Ubuntu Linux

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”
EndSection

26 01 2007
 Thomas Olsen (13:24:12) :
 Using Konqueror 3.5 on Kubuntu Linux

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?

13 02 2007
 heyko’s » links for 2007-02-13 (15:24:02) :
 Using WordPress 2.1

[...] nixternal ยป 1 mouse, 2 mouse, IT WORKS! Automatisches aktivieren und deaktivieren des Touchpads je nach dem ob eine Maus angeschlossen ist. (tags: linux ubuntu) [...]

5 11 2007
 Alex (09:59:04) :
 Using Mozilla Firefox 2.0.0.8 on Ubuntu Linux

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…

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">