You are not logged in.

#1 2010-09-14 00:07:38

pirateofms
Member
Registered: 2010-05-10
Posts: 23

[SOLVED]Synaptics and UDEV

I'm trying to get my Synaptics touchpad to turn off automatically when a mouse is plugged in.  (Yeah, I searched, and I've read a ton of threads on it.)  The problem is Synaptics doesn't seem to recognize the -s flag anymore.  Without it, I get errors about not being able to connect to the X server (yes, I've exported DISPLAY and a bunch of other stuff as in this thread.)  I've tried using ENV{DISPLAY}=":0.0" in the UDEV rule itself, with the same results.  It seems like everyone got it working by adding the -s flag, which seems to be removed in synclient 1.2.2.  If I do, synclient throws the usage page, and doesn't do anything.  Is there any way to get this working without it, or am I just stuck?

Last edited by pirateofms (2010-09-14 13:02:53)

Offline

#2 2010-09-14 02:19:13

codycarey
Member
Registered: 2009-08-21
Posts: 154

Re: [SOLVED]Synaptics and UDEV

From what it looks like all of the shared memory code (the -s param) was removed.

Use the following to find the id of your synaptics device:

xinput --list

Take that id number and use it with xinput to try disabling the touchpad.

xinput --set-prop --type=int --format=8 <id> "Device Enabled" 0

Offline

#3 2010-09-14 03:01:26

pirateofms
Member
Registered: 2010-05-10
Posts: 23

Re: [SOLVED]Synaptics and UDEV

It's complaining about not having an X server.  Here's what I've got right now

# /etc/udev/rules.d/01-touchpad.rules

ACTION=="add", SUBSYSTEM=="input", ENV{DISPLAY}=":0.0", ENV{ID_CLASS}="mouse", RUN+="/home/chop/bin/touchpad 1"
ACTION=="remove", SUBSYSTEM=="input", ENV{DISPLAY}=":0.0", ENV{ID_CLASS}="mouse", RUN+="/home/chop/bin/touchpad 0"

and in my script:

#!/bin/bash
#/home/chop/bin/touchpad

. environment

xinput --set-prop --type=int --format=8 6 "Device Enabled" $1 > /home/chop/bin/touchpad.log 2>&1

I got environment from a working terminal using export -p > environment

And in my touchpad.log:

No protocol specified
Unable to connect to X server

Seems like there would be a better way to handle UDEV not having an X server for a lot of things.  I seem to remember something like this with cron, too. 

Any ideas of where to go from here?

Offline

#4 2010-09-14 08:24:59

codycarey
Member
Registered: 2009-08-21
Posts: 154

Re: [SOLVED]Synaptics and UDEV

It appears that udev requires two environment variables to be set in order to be successful, DISPLAY and XAUTHORITY. It looks like what is happening is that synclient is executing just fine, but X isn't allowing it to make changes because it doesn't believe it has the authority to do so. So modify your udev rules file to match the following:

SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="add", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/cody/.Xauthority", RUN+="/usr/bin/synclient TouchpadOff=1"
SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="remove", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/cody/.Xauthority", RUN+="/usr/bin/synclient TouchpadOff=0"

Obviously replace 'cody' with whatever your username is. The second thing is to disable 'syndaemon' if you are running it. A lot of people use it for disabling the touchpad while they type, but it fights 'synclient' tooth and nail and tends to win 90% of the time.

Offline

#5 2010-09-14 11:04:43

pirateofms
Member
Registered: 2010-05-10
Posts: 23

Re: [SOLVED]Synaptics and UDEV

It works!! Bravo.  It looks like importing Xauthority in the script isn't worth much (it's in the environment file).  I wonder why it makes a difference?

Offline

#6 2010-09-14 12:24:24

stefanwilkens
Member
From: Enschede, the Netherlands
Registered: 2008-12-10
Posts: 624

Re: [SOLVED]Synaptics and UDEV

if you have time, I hope you can update the section on this in the synaptics article smile

http://wiki.archlinux.org/index.php/Synaptics


Arch i686 on Phenom X4 | GTX760

Offline

#7 2010-09-14 12:58:20

pirateofms
Member
Registered: 2010-05-10
Posts: 23

Re: [SOLVED]Synaptics and UDEV

done.

Offline

Board footer

Powered by FluxBB