Raw Markdown Content for peripherals.md¶
Hardware & Peripheral Fixes¶
Microkingdom Keyboard Backlight (Scroll Lock Fix)¶
Symptom¶
The keyboard backlight works in Windows but refuses to turn on in Fedora (Linux). Additionally, hitting keys like Caps Lock or Num Lock resets the keyboard state and turns the backlight off.
Root Cause¶
Most budget "gaming" keyboards (like Microkingdom) hijack the Scroll Lock LED circuit for the backlight. Modern Linux kernels and Wayland compositors disable the Scroll Lock LED by default to save power. Furthermore, the keyboard driver refreshes the LED state on every modifier keypress, effectively "killing" manual overrides.
The Solution: Watchdog Daemon¶
We use a background "watchdog" script and a systemd service to force the LED state to 1 (ON) every 0.5 seconds.
1. The Watchdog Script¶
Create the script at /usr/local/bin/backlight-keeper.sh:
#!/bin/bash
# Monitors Scroll Lock LED and forces it ON
while true; do
# Iterate through all input devices that have a scrolllock LED
for led in /sys/class/leds/input*::scrolllock/brightness; do
if [ -f "$led" ] && [ "$(cat "$led")" -eq 0 ]; then
# Force the brightness to 1 (ON)
echo 1 | sudo tee "$led" > /dev/null
fi
done
# React faster than the keyboard driver's refresh rate
sleep 0.5
done
2. Systemd Service Configuration¶
Create the service at /etc/systemd/system/keyboard-led.service:
[Unit]
Description=Microkingdom Backlight Watchdog
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/local/bin/backlight-keeper.sh
Restart=always
[Install]
WantedBy=multi-user.target
3. Security (SELinux Whitelisting)¶
Fedora's SELinux blocks this service by default because it accesses hardware sysfs files. To whitelist:
# Label the script correctly for the system
sudo restorecon -v /usr/local/bin/backlight-keeper.sh
# Generate and install a custom security policy based on audit logs
sudo ausearch -c 'backlight-keepe' --raw | audit2allow -M my-keyboard-fix
sudo semodule -X 300 -i my-keyboard-fix.pp
Verification Commands¶
# Enable and start the service
sudo systemctl enable --now keyboard-led.service
# Check the real-time status
sudo systemctl status keyboard-led.service