You are not logged in.

#26 2010-03-18 15:14:53

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Udev rule to disable touchpad when usbmouse is used [solved]

A big thanks. smile

Everything works now.

Best regards

Offline

#27 2010-03-18 16:31:47

Coacher
Guest

Re: Udev rule to disable touchpad when usbmouse is used [solved]

Niiiice. I'll repost some kind of final version of that script here. Just in case

#!/bin/bash
# Script to toggle on/off touchpad on all local running X-servers at the same time
# Not tested for network usage

echo "Checking for running X servers..."
if [ `pidof X | tr " " "\n" | wc -l` != "0" ]
then 
    echo "Have running X servers."
    save=$DISPLAY
    totalX=`pidof X | tr " " "\n" | wc -l`
    Xwithnum=`pidof X | xargs ps p | grep X | awk '{print $6}' | grep [0-9] | wc -l`
    dispNums=`pidof X | xargs ps p | grep X | awk '{print $7}' | grep [0-9]`
    diff=`expr $totalX - $Xwithnum`
    if [ "$diff" = "1" ]
    then
        echo "Toggling on :0"
        #export DISPLAY=":0"
        #/usr/bin/synclient touchpadoff=$1
    fi
    Xwithnum=`expr $Xwithnum + 1`
    while [ $Xwithnum -gt 1 ]
    do
        disp=`echo $dispNums | cut -d':' -f$Xwithnum`
        echo "Toggling on :$disp"
        #export DISPLAY=":$disp"
        #/usr/bin/synclient touchpadoff=$1
        Xwithnum=`expr $Xwithnum - 1`
    done
    export DISPLAY="$save"
else
    echo "No running X servers. Repeating"
    /bin/sh /usr/bin/touchpadtoggle $1 &
    exit
fi

#28 2010-03-19 00:07:51

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Udev rule to disable touchpad when usbmouse is used [solved]

Hmm did I understand you correctly that with this version of touchpadtoggle I don't need the addition in .xinitrc anymore?

Because without it it isn't working. sad

EDIT:

The script at all seems not to work on my system.

Last edited by orschiro (2010-03-19 00:19:04)

Offline

#29 2010-03-19 04:35:06

Coacher
Guest

Re: Udev rule to disable touchpad when usbmouse is used [solved]

no. you stiil need xinitrc addition in any case.
use that version that works with your config.

#30 2010-06-05 14:36:48

Kinux
Member
Registered: 2010-06-05
Posts: 42

Re: Udev rule to disable touchpad when usbmouse is used [solved]

Hi there,

Checking this thread for the same problem, I fixed mine with these rules :

ACTION=="add", SUBSYSTEM=="input", ENV{ID_MODEL}=="Optical_USB_Mouse", ENV{DISPLAY}=":0", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", ENV{ID_MODEL}=="Optical_USB_Mouse", ENV{DISPLAY}=":0", RUN+="/usr/bin/synclient TouchpadOff=0"

It seems to me that the code on the wiki page has an error. With Udev rules one can read an environment parameter with "==" and set one with "=".
In wiki code we see ENV{ID_CLASS}="mouse" and this means setting this parameter to "mouse" not checking for it's value. Anyway, I used the command :

udevadm monitor --property > ./log.txt

and plugged my mouse. I noticed this :

KERNEL[1275735778.322259] add      /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/input/input15/event8 (input)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/input/input15/event8
SUBSYSTEM=input
DEVNAME=input/event8
SEQNUM=1597
MAJOR=13
MINOR=72

UDEV  [1275735778.325319] add      /devices/pci0000:00/0000:00:1d.0/usb1/1-1 (usb)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb1/1-1
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/009
DEVTYPE=usb_device
PRODUCT=46d/c016/340
TYPE=0/0/0
BUSNUM=001
DEVNUM=009
SEQNUM=1592
ID_VENDOR=Logitech
ID_VENDOR_ENC=Logitech
ID_VENDOR_ID=046d
ID_MODEL=Optical_USB_Mouse
ID_MODEL_ENC=Optical\x20USB\x20Mouse
ID_MODEL_ID=c016
ID_REVISION=0340
ID_SERIAL=Logitech_Optical_USB_Mouse
ID_BUS=usb
ID_USB_INTERFACES=:030102:
MAJOR=189
MINOR=8
DEVLINKS=/dev/char/189:8

As I did not found any ID_CLASS in the results, I used the ID_MODEL.

Reading this thread also I learned we need to export the DISPLAY parameter for the synclient to work.
I tried to set it in the Udev rule too and it worked! Thanks for your great information.

Now if I could find a way to disable tapping without xorg.conf or hal .fdi files before logging in, that would be good.

Offline

#31 2010-06-05 14:43:13

Coacher
Guest

Re: Udev rule to disable touchpad when usbmouse is used [solved]

add this to rc.local?

#32 2010-06-22 18:32:34

wolfvorkian
Member
Registered: 2008-05-09
Posts: 9

Re: Udev rule to disable touchpad when usbmouse is used [solved]

perbh wrote:

I _know_ its not what you are looking for - but here's another way ...
"rmmod psmouse" in /etc/rc.local (seeing that I almost always use a usb-mouse)
If I dont have a mouse, "modprobe psmouse" on the command line (I always boot up to the cli - then startx) - thus I always have some kind of pointing device available by the time X comes up

I must admit I don't like playing around with 'rules' - rmmod/modprobe works fine for me.

It was what I was looking for however. Thank you. I went the 'rules' approach a few months ago when I first bought this laptop and found out it was useless if the touchpad was active. Google, the  ArchWiki, and several hours of frustration somehow shut it off but apparently a recent update undid my work.

Hopefully your KISS method will be included in the ArchWiki.

Offline

Board footer

Powered by FluxBB