Automatic enable/disable toucpad via udev

Rules
1. Enable touchpad device while the external mouse deivce removed.
2. Disable touchpad device while the external mouse device added.

/etc/udev/rules/touchpad.rules

ACTION=="add", KERNELS=="input*", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", ENV{ID_PATH}!="platform-i8042-serio-1", RUN+="/sbin/modprobe -r psmouse"
ACTION=="remove", KERNELS=="input*", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", ENV{ID_PATH}!="platform-i8042-serio-1", RUN+="/sbin/modprobe psmouse"

Reload udev rules

sudo udevadm control --reload-rules

Over!

One thought on “Automatic enable/disable toucpad via udev”

Leave a Reply

Your email address will not be published. Required fields are marked *