Skip to content

mrp2003/lampctl

Repository files navigation

lampctl

A fast TUI + CLI to control keyboard lighting over the open HID LampArray standard.

CI lampctl on crates.io lamparray on crates.io License: MIT OR Apache-2.0

lampctl demo

Lights up keyboards that ship no working Linux driver — by speaking the vendor-neutral HID LampArray protocol (Microsoft "Dynamic Lighting", HID usage page 0x59) directly over hidraw.

lampctl was born from a real dead end: an ASUS TUF Gaming A16 (FA608UP) whose keyboard backlight is dark on Linux because no driver implements it. It turns out the keyboard is a perfectly standard LampArray device — so instead of waiting for a vendor quirk, lampctl just talks the standard. The same code works on any LampArray device, not just one laptop.

Features

  • 🎨 Live preview — your keyboard updates in real time as you scrub hue/brightness
  • 🌈 Modes — static colour, rainbow cycle, breathing
  • ⌨️ TUI and CLI — a polished ratatui interface, plus lampctl set 00e5ff for scripts
  • 📦 Reusable library — the lamparray crate is a tiny, dependency-light HID LampArray implementation you can use on its own
  • 🪶 No vendor SDK, no daemon required — raw hidraw, one static binary

Install

cargo install lampctl

lampctl needs read/write access to the device's hidraw node. The repo's setup script writes a udev rule matched to your device and adds you to the input group:

git clone https://github.com/mrp2003/lampctl && cd lampctl
./install.sh        # detects your device; uses sudo for the udev rule

install.sh also (re)builds and installs the binary, so you can skip cargo install if you go this route. Log out and back in (so the input group takes effect), then run lampctl.

Set up device access by hand

Copy dist/99-lampctl.rules into /etc/udev/rules.d/ (adjust the VID:PID to match lampctl list), then:

sudo udevadm control --reload-rules && sudo udevadm trigger
sudo usermod -aG input "$USER"   # log out and back in afterwards

Usage

lampctl              # launch the TUI
lampctl --demo       # launch the TUI with no device (preview mode)
lampctl set 00e5ff   # solid cyan
lampctl off          # lights out
lampctl list         # show detected LampArray devices (with VID:PID)

How it works

A LampArray device exposes a handful of standard HID feature reports. lampctl:

  1. Discovers devices by scanning hidraw report descriptors for usage page 0x59.
  2. Sends LampArrayControl (AutonomousMode = 0) to take control from the firmware.
  3. Sends LampRangeUpdate to colour every lamp.

That's the whole trick — no reverse-engineering, no proprietary commands.

Project layout

Crate What it is
lamparray Library: discover + drive HID LampArray devices
lampctl Binary: the ratatui TUI + CLI

License

Dual-licensed under either MIT or Apache-2.0, at your option.

About

A fast TUI + CLI to control keyboard lighting over the open HID LampArray standard (Microsoft Dynamic Lighting). Lights up devices with no working Linux driver.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors