Skip to main content
1 of 3
Rob
  • 41
  • 5

udev .rules not running script

I'd like my computer to run certain scripts when a specific keyboard is (1) plugged in, (2) plugged out, (3) detected at startup.

Here's the device:

[rob@X200 vim]$ lsusb | grep keyb
Bus 005 Device 012: ID 04d9:1400 Holtek Semiconductor, Inc. PS/2 keyboard + mouse controller

and here's the .rules file:

[rob@X200 rules.d]$ cat 080-model-m.rules 
ACTION=="add", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="1400", RUN+="/home/rob/home/scripts/caps-equals-super.sh"

ACTION=="remove", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="1400", RUN+="/home/rob/home/scripts/revert-keyboard-to-default.sh"

The scripts have been tested to work, but are not triggered upon device plugin/plugout. I'm not quite sure how I'd go about having the script triggered if the keyboard is detected at startup, but I imagine I have to tell something (systemd, udev?) not to run the script until certain resources are ready.

Thanks for taking your time to help me with my problem.

Rob
  • 41
  • 5