Skip to content

Instantly share code, notes, and snippets.

@crabdancing
Created November 27, 2019 01:20
Show Gist options
  • Save crabdancing/63cd9736f4f608047bc7aac58581438c to your computer and use it in GitHub Desktop.
Save crabdancing/63cd9736f4f608047bc7aac58581438c to your computer and use it in GitHub Desktop.
Some example code for controlling keyboard backlight on Dell laptops via sysfs and pathlib
#!/usr/bin/env python3
from pathlib import Path
import time
sysfs_path = Path('/sys/devices/platform/dell-laptop/leds/dell::kbd_backlight/brightness')
for i in range(4):
print(i)
time.sleep(1)
# write 0 to turn off backlight
# write 3 to turn it up to max
sysfs_path.write_text(str(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment