I want to turn off the touchpad when a USB mouse is plugged in.
Here are my rules:
SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="Logitech", ATTRS{product}=="USB Receiver", ACTION=="add", RUN+="/usr/bin/synclient touchpadoff=1"
SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="Logitech", ATTRS{product}=="USB Receiver", ACTION=="remove", RUN+="/usr/bin/synclient touchpadoff=0"
But it gave me this message:
Process '/usr/bin/synclient touchpadoff=1' failed with exit code 1.
I don't know what the above message means.
Help me.
It's not work because command "/usr/bin/synclient touchpadoff=1" in udev rules run by another user than auth in Xorg session.
for example if root run "/usr/bin/synclient touchpadoff=1" we got a error:
You should add "udev monitor" script in the startup/autostart applications in your desktop environment (link) or run by current X-authorized user.
I write udev script for my mouse. My mouse has VID 046d and PID c06d - you should replace them with your own. Also you need install
Udev::FFI
module (run "cpanm Udev::FFI" or "cpan Udev::FFI")