I bought a cheap USB keyboard because it has a backlight, but it wouldn’t work under Linux.
Here is the solution, thanks to paulnux and yleetiny from th****e French Ubuntu forums.
The original post contained a slight error, but was easily fixed.
Simply create a file in /usr/bin/ (or even in ~/bin/ I expect) that toggles a keycode -
cd /usr/bin && sudo touch keyb_switch_light && sudo chmod +x keyb_switch_light && sudo vi keyb_switch_light
Insert this lot -
#!/bin/bash
if -f /tmp/keyboard_light ]; then
xset -led 3 && rm /tmp/keyboard_light
else
xset led 3 && touch /tmp/keyboard_light
fi
You can then assign that script to a key
Run it 3 or 4 times to start with, that way it creates the tmp file it requires for toggling, after that it will function as a normal “toggle”.
The full description of the keyboard is -
062a:0201 Creative Labs Defender Office Keyboard (K7310) S Zodiak KM-9010
The original article is here -
Forum Ubuntu-fr.org / Clavier rétro éclairé
Good luck ;).