0x8040 · brightnessControl
Device backlight brightness control — read the supported range and step count, get or set the brightness level, and independently toggle illumination on or off.
Controls the display or backlight brightness of a device. getInfo (function 0)
returns a BrightnessInfo describing the min/max brightness, the number of
discrete steps, and a BrightnessCapabilities bitmask. getBrightness /
setBrightness (functions 1–2) read and write the current brightness level as a
u16. When the ILLUMINATION capability is set, getIllumination /
setIllumination (functions 3–4) independently query and toggle the backlight
on or off without changing the stored brightness value.
HARDWARE_BRIGHTNESS— hardware can change brightness without a host command.EVENTS— the device emits brightness or illumination change events.ILLUMINATION— illumination can be queried and controlled separately from brightness.HARDWARE_ON_OFF— hardware can toggle illumination on and off directly.TRANSIENT— brightness is not persisted by the device across power cycles.
Spec: Logitech HID++ 2.0 — brightnessControl. Used by: Typed wrapper in
openlogi-hidpp.
Function reference
The BrightnessControlFeature wrapper (0x8040) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_info | 0 | () | BrightnessInfo |
get_brightness | 1 | () | u16 |
set_brightness | 2 | (brightness: u16) | () |
get_illumination | 3 | () | bool |
set_illumination | 4 | (enabled: bool) | () |
All methods are async and return Result<…, Hidpp20Error>.
Types
BrightnessInfo
Brightness range and capability information.
| Field | Type | Description |
|---|---|---|
min_brightness | u16 | Minimum accepted brightness. |
max_brightness | u16 | Maximum accepted brightness. |
steps | u16 | Number of brightness steps advertised by the device. |
capabilities | BrightnessCapabilities | Feature capabilities. |
BrightnessCapabilities
Capabilities reported by BrightnessControl.
| Flag | Bit/Value | Description |
|---|---|---|
HARDWARE_BRIGHTNESS | 1 << 0 | Hardware can change brightness directly. |
EVENTS | 1 << 1 | The device emits brightness or illumination change events. |
ILLUMINATION | 1 << 2 | Illumination can be queried and controlled separately from brightness. |
HARDWARE_ON_OFF | 1 << 3 | Hardware can toggle illumination on and off directly. |
TRANSIENT | 1 << 4 | Brightness is transient and not persisted by the device. |
Wire format
Short requests carry a 3-byte payload; getInfo / getBrightness / getIllumination responses are read from the 16-byte extended payload returned by extend_payload().
get_info (fn 0)
Request: [0x00, 0x00, 0x00]
Response (extended 16-byte payload — byte → field):
| Byte(s) | Field | Notes |
|---|---|---|
| 0–1 | max_brightness | Big-endian u16. |
| 2 | steps (low byte) | Combined with byte 6 — see note below. |
| 3 | capabilities | BrightnessCapabilities bitmask (see flag table above). |
| 4–5 | min_brightness | Big-endian u16. |
| 6 | steps (high byte) | steps = u16::from_be_bytes([payload[6], payload[2]]). |
The
stepsfield is split across two non-adjacent bytes: high byte at index 6, low byte at index 2.
get_brightness (fn 1)
Request: [0x00, 0x00, 0x00]
Response (extended 16-byte payload — byte → field):
| Byte(s) | Field | Notes |
|---|---|---|
| 0–1 | brightness | Big-endian u16 current brightness value. |
set_brightness (fn 2)
Request: [hi, lo, 0x00] where hi and lo are the big-endian bytes of the u16 brightness value.
| Byte | Content |
|---|---|
| 0 | (brightness >> 8) as u8 |
| 1 | brightness as u8 |
| 2 | 0x00 (padding) |
No response payload is used.
get_illumination (fn 3)
Request: [0x00, 0x00, 0x00]
Response (extended 16-byte payload — byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | illumination enabled | Bit 0: payload[0] & 1 != 0. true = illumination on. |
set_illumination (fn 4)
Request: [enabled, 0x00, 0x00]
| Byte | Content |
|---|---|
| 0 | 0x01 if illumination should be enabled, 0x00 to disable |
| 1–2 | 0x00 (padding) |
No response payload is used.
Usage (Rust)
use hidpp::{device::Device, feature::brightness_control::BrightnessControlFeature};
// mut device: Device, already created via Device::new(channel, index)?
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<BrightnessControlFeature>() {
let info = feat.get_info().await?;
println!("Brightness range: {}–{} ({} steps)", info.min_brightness, info.max_brightness, info.steps);
let current = feat.get_brightness().await?;
println!("Current brightness: {current}");
// Set brightness to 75 % of the reported maximum
let target = (info.max_brightness as u32 * 75 / 100) as u16;
feat.set_brightness(target).await?;
if info.capabilities.contains(hidpp::feature::brightness_control::BrightnessCapabilities::ILLUMINATION) {
let on = feat.get_illumination().await?;
println!("Illumination currently: {on}");
feat.set_illumination(true).await?;
}
}