You are not logged in.

#1 2010-10-20 13:24:00

lamek
Member
Registered: 2009-11-29
Posts: 33

udev rule for turn off touchpad when mouse is plugged in - not working

hi i'm trying to add rule 01-touchpad.rules for udev. but any tries faile. I search forum but still can not deal with it.
can you help?
here is my udev rule:

SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="Logitech", ATTRS{product}=="USB-PS/2 Optical Mouse", ACTION=="add", RUN+="/usr/bin/touchpadtoggle 1"
SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="Logitech", ATTRS{product}=="USB-PS/2 Optical Mouse", ACTION=="remove", RUN+="/usr/bin/touchpadtoggle 0"

my udevadm monitor --property > ./log
http://wklej.org/id/404328/

/usr/bin/touchpadtoggle:

#!/bin/bash
export DISPLAY=":0"
/usr/bin/synclient touchpadoff=$1

lsusb -v:

Bus 005 Device 002: ID 046d:c051 Logitech, Inc. G3 (MX518) Optical Mouse
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc051 G3 (MX518) Optical Mouse
  bcdDevice           30.00
  iManufacturer           1 Logitech
  iProduct                2 USB-PS/2 Optical Mouse
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      77
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

Last edited by lamek (2010-10-20 13:25:46)

Offline

#2 2010-10-20 13:56:50

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: udev rule for turn off touchpad when mouse is plugged in - not working

Did you try the udev rules from our wiki? :
http://wiki.archlinux.org/index.php/Tou … _detection


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#3 2010-10-20 14:00:37

lamek
Member
Registered: 2009-11-29
Posts: 33

Re: udev rule for turn off touchpad when mouse is plugged in - not working

Ofcourse i tried. That was the first thing i did.

Offline

#4 2010-10-20 14:50:44

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: udev rule for turn off touchpad when mouse is plugged in - not working

i think its related to synclient's execution environment. i had this problem in the past...gave up trying...now i simply dodge the touchpad when i type.

Offline

#5 2010-10-20 16:49:43

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: udev rule for turn off touchpad when mouse is plugged in - not working

Offline

#6 2010-10-20 17:52:03

lamek
Member
Registered: 2009-11-29
Posts: 33

Re: udev rule for turn off touchpad when mouse is plugged in - not working

@ber_t
but -s option doesn't work any more for sysclient.
still dont know how to do it.
export -p gives me this:

declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-OSMEAF6cER,guid=842e02ce960adafc31fa821200000023"
declare -x DISPLAY=":0.0"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTCONTROL="erasedups"
declare -x HISTSIZE="1000"
declare -x HOME="/home/dj"
declare -x INPUTRC="/etc/inputrc"
declare -x JAVA_HOME="/opt/java/jre"
declare -x LANG="pl_PL.utf8"
declare -x LESS="-R"
declare -x LOGNAME="dj"
declare -x MAIL="/var/mail/dj"
declare -x MOZ_PLUGIN_PATH="/usr/lib/mozilla/plugins"
declare -x OLDPWD
declare -x PATH="/bin:/usr/bin:/sbin:/usr/sbin:/opt/java/jre/bin:/usr/lib/perl5/core_perl/bin"
declare -x PKG_CONFIG_PATH="/usr/lib/pkgconfig"
declare -x PROMPT_COMMAND="echo -ne \"\\033]0;\${USER}@\${HOSTNAME%%.*}:\${PWD/\$HOME/~}\\007\""
declare -x PS1="[\\u@\\h \\W]\\\$ "
declare -x PS2="> "
declare -x PS3="> "
declare -x PS4="+ "
declare -x PWD="/home/dj"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x TERM="xterm"
declare -x USER="dj"
declare -x XAUTHORITY="/home/dj/.Xauthority"
declare -x XDG_CACHE_HOME="/home/dj/.cache"
declare -x XDG_CONFIG_DIRS="/etc/xdg"
declare -x XDG_CONFIG_HOME="/home/dj/.config"
declare -x XDG_DATA_DIRS="/usr/share:/usr/local/share"
declare -x XDG_DATA_HOME="/home/dj/.local/share"
declare -x XDG_SESSION_COOKIE="11d4729fa16313106203aca44c2ae93b-1287596101.633625-2121687456"

Edit:
the problem is rule doesnt work even i put /usr/bin/firefox into RUN

Last edited by lamek (2010-10-20 18:41:58)

Offline

#7 2010-10-20 18:41:03

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: udev rule for turn off touchpad when mouse is plugged in - not working

Did you saved this output in a file and sourced it in your touchpadtoggle script?

Could you also redirect the output of synclient to a file, inside your script? This way, you might get a meaningful error message...

Offline

#8 2010-10-20 18:45:13

lamek
Member
Registered: 2009-11-29
Posts: 33

Re: udev rule for turn off touchpad when mouse is plugged in - not working

the problem is rule doesnt work even i put /usr/bin/firefox into RUN
i did exactly this:
export -p > /home/dj/.bk

#!/bin/bash
. /home/dj/.bk
/usr/bin/synclient TouchpadOff=$1

edit:
if i did sth wrong. sorry i'm really newbie in this udev stuffs

Last edited by lamek (2010-10-20 18:47:53)

Offline

#9 2010-10-20 19:22:42

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: udev rule for turn off touchpad when mouse is plugged in - not working

how would this work on a multi user environment? whats the exact variable synclient needs?

Offline

#10 2010-10-20 20:43:05

Bolts
Member
From: Moorhead, MN
Registered: 2009-05-09
Posts: 39
Website

Re: udev rule for turn off touchpad when mouse is plugged in - not working

Try running 'xhost +local:root' in an xterm, then test it.  If it works, add that to your .xinitrc or equivalent.

Last edited by Bolts (2010-10-20 20:51:30)

Offline

#11 2010-10-20 20:59:48

lamek
Member
Registered: 2009-11-29
Posts: 33

Re: udev rule for turn off touchpad when mouse is plugged in - not working

'xhost +local:root' - not working

Offline

Board footer

Powered by FluxBB