You are not logged in.

#1 2019-01-12 15:19:24

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Why is my udev rule not working? Space inside ""?

Hey everyone,

I am trying to make a udev rule to disable touchpad/trackpoint when a mouse is attached to my laptop.
The commands to disable the touchpad/trackpoint actually work. But the script/udev rules doesn't.
I believe I am doing sth wrong with the "" and '' symbols?

SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="add", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/username/.Xauthority", RUN+="xinput disable 'SynPS/2 Synaptics TouchPad'"
SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="remove", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/username/.Xauthority", RUN+="xinput enable 'SynPS/2 Synaptics TouchPad'"
SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="add", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/username/.Xauthority", RUN+="xinput disable 'TPPS/2 Elan TrackPoint'"
SUBSYSTEM=="input", KERNEL=="mouse[0-9]*", ACTION=="remove", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/username/.Xauthority", RUN+="xinput enable 'TPPS/2 Elan TrackPoint'"

Thanks in advance!


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#2 2019-01-12 15:26:42

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Why is my udev rule not working? Space inside ""?

ENV{XAUTHORITY}="/home/username/.Xauthority"

Is your user name really "username" ?

Offline

#3 2019-01-12 15:59:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,427

Re: Why is my udev rule not working? Space inside ""?

You are unlikely to have $PATH set in your udev execution environment, so use a fully qualified path to the xinput binary.

Offline

#4 2019-01-13 09:08:07

Utini
Member
Registered: 2015-09-28
Posts: 481
Website

Re: Why is my udev rule not working? Space inside ""?

Thanks guys but that didn't help either:
It's working now, but only when the mouse is plugged in after the system has been booted.

Now I need a way to also run the script when the mouse was plugged in before booting.
Also is there an easy way to detect generally any mouse? Currently the script works with the exact name of my current mouse but will probably not work anymore with any other mouse?

Last edited by Utini (2019-01-13 09:12:49)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#5 2019-01-15 17:10:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,427

Re: Why is my udev rule not working? Space inside ""?

Well it did help, the problem now is that an udev rule will run when udev get's aware of the device, which during boot up will be long before your xorg is even running and xinput acts on xorg devices.  Short of running a dedicated daemon to keep track of this, I'd just run a check on what to do during xorg startup in your .xinitrc or similar, after which the udev rule should work. Not entirely sure what you mean with exact name of your mouse, as your mouse is never named, but your touchpad is.

Offline

Board footer

Powered by FluxBB