Sample Header Ad - 728x90

udev rule to turn on keyboard backlight

3 votes
2 answers
1759 views
I have a very simple generic gaming keyboard with a backlight. The, typically, universal way to engage the backlight is with xset led 3. I can confirm that this does in-fact work. Because I have two computers that I switch back and forth from with a peripheral switch, however, this becomes problematic because when I switch from one context to the other I'm unplugging and plugging the USB back in. I wrote a file /etc/udev/rules.d/keyboard.rules with the following rule: ATTRS{idVendor}=="258a", ATTRS{idProduct}=="0001", RUN+="/bin/bash -c \"DISPLAY=:1;xset led 3;\"" If I run /bin/bash -c \"DISPLAY=:1;xset led 3;\" by itself it works just fine, however, it doesn't seem to work as just a rule. It only sometimes turns on, and when it does it flashes on and then immediately turns back off. I have checked multiple times over and I know that my idVender and idProduct are correct: Bus 003 Device 079: ID 258a:0001 What else could I be missing?
Asked by Nikole (585 rep)
Nov 16, 2015, 03:16 PM
Last activity: Dec 20, 2022, 04:36 AM