[H-GEN] toggling touchpad

Peter Robinson pjr at itee.uq.edu.au
Wed Apr 1 00:41:14 EDT 2009


I couldn't get it to work (in ubuntu ibex) until I discovered I needed 
to disable touchpad in Preferences->Mouse
Then it worked :(

Here is my rules file /etc/udev/rules.d/54-touch.rules
-----------------------------------------8<-------------------------------------
# Turn the touchpad off if mouse is added and turn back on if removed
ACTION == "add", SUBSYSTEM=="input", ID_CLASS="mouse", 
RUN+="/usr/bin/synclient touchpadoff=1"
ACTION == "remove", SUBSYSTEM=="input", ID_CLASS="mouse", 
RUN+="/usr/bin/synclient touchpadoff=0"
----------------------------------------8<-------------------------------------

I also did something similar to what you suggested (haven't tested it 
since I disabled touchpad in Preferences)
The following script is added to my Session preferences for startup
-----------------------------------------8<-------------------------------------
#!/bin/sh

/usr/bin/synclient TouchpadOff=`lsusb | grep Primax | wc -l`
-----------------------------------------8<-------------------------------------

You need to replace Primax by whatever your mouse lists - run lsusb with 
and without the mouse plugged in and spot the difference.

Peter


Russell Stuart wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and     ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
>
> On Mon, 2009-02-23 at 15:24 +1000, Russell Stuart wrote:
>   
>> On Mon, 2009-02-23 at 14:31 +1000, Peter Robinson wrote:
>>     
>>> # Turn the touchpad off if mouse is added and turn back on if removed
>>> ACTION == "add", SUBSYSTEM=="input", ID_CLASS="mouse",     
>>> RUN+="/home/pjr/.udevtoggletouch add"
>>> ACTION == "remove", SUBSYSTEM=="input", ID_CLASS="mouse",     
>>> RUN+="/home/pjr/.udevtoggletouch remove"
>>>       
>
> I am in the process of setting up a laptop for my father, and this
> looked like a good idea so I copied it.  Besides, it gave me an excuse
> to investigate this further.
>
> The laptop is running Debian Lenny, which should be pretty similar to
> Ubuntu for this exercise.  First I did it on my own by reading the doco,
> and got it working.  Then I compared what I had to the above.  It was
> different.  Then in replicated what you did above, and of course as luck
> would have it, it also worked.
>
> But ... after reading the doco and comparing yours to mine, a couple of
> thoughts sprang to mind:
>
> 1.  ID_CLASS=="mouse" is not the correct syntax.  Thus udev will just
> ignore the condition.  The correct syntax is ENV{ID_CLASS}=="mouse".
>
> 2.  After reading the description of how udev worked, I decided I had to
> be dammed careful the rules did not patch the touchpad itself.  On my
> system at least the touchpad did have a ENV{ID_CLASS}=="mouse".  So I
> tested a few more things.
>
> I think you are being hit by a combination of the above.  Because
> ID_CLASS=="mouse" isn't being used many different udev events will match
> your rules.  It is quite possible some stray event comes along after you
> plug in the mouse that matches your ACTION=="remove" rule, and
> re-enabled the touchpad!
>
>
> _______________________________________________
> General mailing list
> General at lists.humbug.org.au
> http://lists.humbug.org.au/mailman/listinfo/general
>   





More information about the General mailing list