Skip to main content

Control RGB lighting on HID LampArray and LED Page devices on Linux

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

hid-rgb-ctl

Linux command-line tool for controlling RGB lighting via standard HID protocols.

[!NOTE] This project was built with vibe coding. Contributions via vibe coding are welcome — don't worry too much about code style, just make it work.

Supported Protocols

  • HID LampArray (Usage Page 0x59) — Modern Dynamic Lighting standard from the USB HID Usage Tables v1.4 (Section 26). Supports device interrogation, per-lamp attributes, autonomous/manual mode, and color updates.

  • HID LED Page RGB (Usage Page 0x08, Usage 0x52) — Legacy RGB LED control per HID Usage Tables Section 11.7. Simpler protocol with direct R/B/G channel writes.

Features

  • Auto-discovers devices by parsing HID report descriptors — no hardcoded vendor/product IDs
  • Supports preset colors, decimal RGB, hex color codes, and intensity control
  • Toggle autonomous/manual mode on LampArray devices
  • Zero external dependencies — Python 3.9+ standard library only

Install

pipx install git+https://github.com/xz-dev/hid-rgb-ctl.git
# or from local clone
pipx install .

Usage

# List detected devices
hid-rgb-ctl list

# Show device attributes and lamp info
hid-rgb-ctl get

# Set color by preset name
hid-rgb-ctl set red

# Set color by RGB values (0-255)
hid-rgb-ctl set 255 165 0

# Set color by hex code
hid-rgb-ctl set ff6400

# Set color with custom intensity
hid-rgb-ctl set cyan -i 128

# Turn off
hid-rgb-ctl set off

# Specify device path (when multiple devices present)
hid-rgb-ctl -p /dev/hidraw1 set blue

# Toggle autonomous mode (LampArray only)
hid-rgb-ctl auto off    # host takes control
hid-rgb-ctl auto on     # device resumes built-in effects

Permissions

HID device access requires read/write permission on /dev/hidrawN.

Add a udev rule for your device, for example:

# /etc/udev/rules.d/99-hid-rgb.rules
# ASUS Vivobook keyboard (0B05:5570)
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="5570", TAG+="uaccess"

Then reload:

sudo udevadm control --reload-rules && sudo udevadm trigger

Verified Devices

Device Bus VID:PID Protocol Lamps Status
ASUS Vivobook S 16 (M5606WA) keyboard I2C 0B05:5570 LampArray 1 (single-zone) Verified

Contributions welcome — please open an issue or PR with your device info.

Protocol Notes

LampArray (Usage Page 0x59)

The typical operation flow (Section 26.6):

  1. Read LampArrayAttributesReport — get lamp count, device kind
  2. Read LampAttributesResponseReport for each lamp — get position, RGB level counts, programmability
  3. Disable AutonomousMode — take control from device firmware
  4. Send LampRangeUpdateReport or LampMultiUpdateReport with color data
  5. Re-enable AutonomousMode when done (optional)

LampCount (Usage 0x03) tells you how many independently controllable zones the device has. A single-zone keyboard has LampCount=1; a per-key RGB keyboard may have 100+.

LED Page RGB (Usage Page 0x08, Section 11.7)

Simpler protocol — the RGB LED collection (Usage 0x52) directly contains:

  • Red LED Channel (Usage 0x53)
  • Blue LED Channel (Usage 0x54) — note: Blue before Green in the spec
  • Green LED Channel (Usage 0x55)
  • LED Intensity (Usage 0x56, optional)

No autonomous mode or lamp enumeration.

References

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hid_rgb_ctl-0.1.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hid_rgb_ctl-0.1.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file hid_rgb_ctl-0.1.2.tar.gz.

File metadata

  • Download URL: hid_rgb_ctl-0.1.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hid_rgb_ctl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d05709f9a2a22970e8f075d8fedea9b5ae3a175b73e0e9d4ff3c465ad8cd80ea
MD5 d8a92db1beababc81666bee94912e071
BLAKE2b-256 0f2ade13628f6c1bd18f16038fd4b147e1220110566f15ed1d7835436d202ae0

See more details on using hashes here.

File details

Details for the file hid_rgb_ctl-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hid_rgb_ctl-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hid_rgb_ctl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 53d73fbe76efd25be2de9f668c5a03e8a451e64a8ab669257a980bb9bb35c189
MD5 cfb60d795135bf6cf4f0377ec5beeb1f
BLAKE2b-256 e1803fa885c251bc08bd73c46e483f8edf7c86eb33d883a6a0895289f5d4b026

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page