0x1982 · backlight
Full keyboard backlight control — read or write persistent config (mode, brightness, effects, fade-out timers) and subscribe to hardware change events.
Keyboard backlight control, implemented at version 3. get_backlight_config (function 0) reads the full persistent configuration: enabled state, active BacklightMode, supported and enabled BacklightOptions, supported effects, manual brightness level (0–7), and three fade-out durations in 5-second units (hands-out, hands-in, externally-powered). set_backlight_config (function 1) writes those values back to non-volatile memory. get_backlight_info (function 2) returns live status plus out-of-box (factory-default) durations. set_backlight_effect (function 3) applies an effect temporarily, stored in RAM only, not persisted.
BacklightMode—None(no mode selected, wire value 0),Automatic(level follows the ambient-light sensor),TemporaryManual(adjusted by the physical backlight keys; cannot be set by software),PermanentManual(set by software).BacklightEffect—Static,None,Breathing,Contrast,Reaction,Random,Waves; theBacklightEffectListbitfield reports which effects the device supports.BacklightOptions— writable flags (WOW,CROWN,PWR_SAVE) plus read-only capability bits that report which modes and options the device supports.BacklightStatus(fromget_backlight_info) —DisabledBySoftware,DisabledByCriticalBattery,AlsAutomatic,AlsSaturated,TemporaryManual,PermanentManual.BacklightEvent::InfoChanged— pushed whenever the user adjusts the backlight; carriesBacklightInfoUpdate(nb_levels, current_level, status, effect).
Spec: Logitech HID++ 2.0 — backlight. Used by: Typed wrapper in
openlogi-hidpp.
Function reference
The BacklightFeature wrapper (0x1982) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_backlight_config | 0 | () | BacklightConfig |
set_backlight_config | 1 | (config: SetBacklightConfig) | () |
get_backlight_info | 2 | () | BacklightInfo |
set_backlight_effect | 3 | (effect: BacklightEffect) | () |
listen | event | () | Receiver<BacklightEvent> |
All async methods return Result<…, Hidpp20Error>. listen is synchronous and returns a channel receiver.
Types
BacklightConfig
Configuration returned by get_backlight_config.
| Field | Type | Description |
|---|---|---|
enabled | bool | Whether the backlight system is enabled. |
options | BacklightOptions | Enabled options and supported capabilities. |
mode | BacklightMode | Currently selected backlight mode. |
effect_list | BacklightEffectList | Effects the device supports. |
current_level | u8 | Current manual brightness level (0 = off, up to 7). |
duration_hands_out | u16 | Fade-out duration after the last keystroke with no proximity, in 5-second units (1..=0x05a0). |
duration_hands_in | u16 | Fade-out duration while hands remain in the detection zone, in 5-second units. |
duration_powered | u16 | Fade-out duration while externally powered, in 5-second units. |
SetBacklightConfig
Configuration written by set_backlight_config.
| Field | Type | Description |
|---|---|---|
enabled | bool | Whether to enable the backlight system. |
options | BacklightOptions | Options to enable. Only WOW, CROWN, and PWR_SAVE are writable; the device discards unsupported options. |
mode | BacklightMode | Mode to select. TemporaryManual cannot be set by software. |
effect | Option<BacklightEffect> | Effect to apply, or None to leave the current effect unchanged. |
current_level | u8 | Manual brightness level (0 = off, up to 7). |
duration_hands_out | u16 | Fade-out duration after the last keystroke with no proximity, in 5-second units. |
duration_hands_in | u16 | Fade-out duration while hands remain in the detection zone, in 5-second units. |
duration_powered | u16 | Fade-out duration while externally powered, in 5-second units. |
BacklightInfo
Live status and factory defaults returned by get_backlight_info.
| Field | Type | Description |
|---|---|---|
nb_levels | u8 | Number of user-selectable intensity levels (0..nb_levels). |
current_level | u8 | Current intensity level. |
status | BacklightStatus | Current backlight status. |
effect | BacklightEffect | Currently applied effect. |
oob_duration_hands_out | u16 | Out-of-box fade-out duration with hands out, in 5-second units. |
oob_duration_hands_in | u16 | Out-of-box fade-out duration with hands in, in 5-second units. |
oob_duration_powered | u16 | Out-of-box fade-out duration while externally powered, in 5-second units. |
BacklightMode
The backlight level-adjustment mode.
| Variant | Value | Description |
|---|---|---|
None | 0 | No mode selected. |
Automatic | 1 | Automatic mode: level follows the ambient-light sensor. |
TemporaryManual | 2 | Temporary manual mode: level adjusted via the backlight keys. Cannot be set by software. |
PermanentManual | 3 | Permanent manual mode: level adjusted by software. |
BacklightEffect
A predefined backlight effect.
| Variant | Value | Description |
|---|---|---|
Static | 0 | The "static" effect (default). |
None | 1 | The "none" effect. |
Breathing | 2 | The "breathing light" effect. |
Contrast | 3 | The "contrast" effect. |
Reaction | 4 | The "reaction" effect. |
Random | 5 | The "random" effect. |
Waves | 6 | The "waves" effect. |
BacklightStatus
The current backlight operational status.
| Variant | Value | Description |
|---|---|---|
DisabledBySoftware | 0 | Disabled by software. |
DisabledByCriticalBattery | 1 | Disabled because the battery is critically low. |
AlsAutomatic | 2 | Automatic (ALS) mode. |
AlsSaturated | 3 | Automatic mode, saturated — the backlight is off. |
TemporaryManual | 4 | Temporary manual mode (set by hardware). |
PermanentManual | 5 | Permanent manual mode (set by software). |
BacklightOptions
Backlight options and device capability bits from get_backlight_config. Low bits are active options; high bits are read-only capability flags. The 2-bit mode field is exposed separately as BacklightMode.
| Flag | Bit/Value | Description |
|---|---|---|
WOW | 1 << 0 | The "wow" power-on effect is enabled. |
CROWN | 1 << 1 | The "crown" touch effect is enabled. |
PWR_SAVE | 1 << 2 | Power-save (disable backlight at critical battery) is enabled. |
WOW_SUPPORTED | 1 << 8 | The device supports the "wow" effect. |
CROWN_SUPPORTED | 1 << 9 | The device supports the "crown" effect. |
PWR_SAVE_SUPPORTED | 1 << 10 | The device supports power-save. |
AUTO_MODE_SUPPORTED | 1 << 11 | The device supports automatic (ALS) mode. |
TEMP_MANUAL_SUPPORTED | 1 << 12 | The device supports temporary-manual mode. |
PERM_MANUAL_SUPPORTED | 1 << 13 | The device supports permanent-manual mode. |
BacklightEffectList
Bitmask of predefined effects the device supports, from get_backlight_config.
| Flag | Bit/Value | Description |
|---|---|---|
STATIC | 1 << 0 | The "static" effect. |
NONE | 1 << 1 | The "none" effect. |
BREATHING | 1 << 2 | The "breathing light" effect. |
CONTRAST | 1 << 3 | The "contrast" effect. |
REACTION | 1 << 4 | The "reaction" effect. |
RANDOM | 1 << 5 | The "random" effect. |
WAVES | 1 << 6 | The "waves" effect. |
Events
The feature implements EmittingFeature<BacklightEvent>; call listen() to receive a Receiver<BacklightEvent>.
| Variant | Payload | Description |
|---|---|---|
InfoChanged | BacklightInfoUpdate | Emitted whenever the user adjusts the backlight. |
BacklightInfoUpdate
Payload carried by BacklightEvent::InfoChanged.
| Field | Type | Description |
|---|---|---|
nb_levels | u8 | Number of user-selectable intensity levels. |
current_level | u8 | Current intensity level. |
status | BacklightStatus | Current backlight status. |
effect | BacklightEffect | Currently applied effect. |
Wire format
Getter requests carry a 3-byte zero payload; the setter uses a 16-byte long payload. All multi-byte fields are little-endian. All methods return Result<_, Hidpp20Error>.
get_backlight_config (fn 0)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (extend_payload(), 16 bytes):
| Byte | Field | Notes |
|---|---|---|
| 0 | enabled | Bit 0 set = enabled |
| 1–2 | options | mode | LE u16; bits 3–4 = BacklightMode (extracted as (raw & 0x0018) >> 3); remaining bits = BacklightOptions |
| 3–4 | effect_list | LE u16 BacklightEffectList |
| 5 | current_level | Manual brightness 0–7 |
| 6–7 | duration_hands_out | LE u16, 5-second units |
| 8–9 | duration_hands_in | LE u16, 5-second units |
| 10–11 | duration_powered | LE u16, 5-second units |
| 12–15 | — | Unused |
set_backlight_config (fn 1)
Request (call_long, 16-byte payload):
| Byte | Field | Notes |
|---|---|---|
| 0 | enabled | 0 = disable, 1 = enable |
| 1 | options_byte | (writable_flags & 0x07) | (mode << 3); writable flags = WOW | CROWN | PWR_SAVE (bits 0–2) |
| 2 | effect | BacklightEffect value, or 0xff when effect is None (leave unchanged) |
| 3 | current_level | Manual brightness 0–7 |
| 4–5 | duration_hands_out | LE u16, 5-second units |
| 6–7 | duration_hands_in | LE u16, 5-second units |
| 8–9 | duration_powered | LE u16, 5-second units |
| 10–15 | — | Zeroed |
Response: no meaningful return bytes (acknowledgement only).
get_backlight_info (fn 2)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (extend_payload(), 16 bytes):
| Byte | Field | Notes |
|---|---|---|
| 0 | nb_levels | Total selectable levels |
| 1 | current_level | Active level |
| 2 | status | BacklightStatus enum value |
| 3 | effect | BacklightEffect enum value |
| 4–5 | oob_duration_hands_out | LE u16, 5-second units |
| 6–7 | oob_duration_hands_in | LE u16, 5-second units |
| 8–9 | oob_duration_powered | LE u16, 5-second units |
| 10–15 | — | Unused |
set_backlight_effect (fn 3)
Request: [effect, 0x00, 0x00] — byte 0 = BacklightEffect value.
Response: no meaningful return bytes.
Event: backlightInfoEvent (fn 0, sub-id 0)
Emitted by the device whenever the user adjusts the backlight. The 16-byte event payload is parsed as BacklightInfoUpdate:
| Byte | Field | Notes |
|---|---|---|
| 0 | nb_levels | Total selectable levels |
| 1 | current_level | Active level after the change |
| 2 | status | BacklightStatus enum value |
| 3 | effect | BacklightEffect enum value |
| 4–15 | — | Unused |
Usage (Rust)
use hidpp::{
device::Device,
feature::backlight::{BacklightEffect, BacklightFeature, BacklightMode, SetBacklightConfig},
};
// mut device: Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<BacklightFeature>() {
// Read the current persistent configuration.
let config = feat.get_backlight_config().await?;
println!("enabled={}, level={}", config.enabled, config.current_level);
// Write a new configuration: enable at level 4, permanent-manual mode.
feat.set_backlight_config(SetBacklightConfig {
enabled: true,
options: config.options,
mode: BacklightMode::PermanentManual,
effect: Some(BacklightEffect::Breathing),
current_level: 4,
duration_hands_out: config.duration_hands_out,
duration_hands_in: config.duration_hands_in,
duration_powered: config.duration_powered,
})
.await?;
// Apply an effect temporarily (RAM only, not persisted).
feat.set_backlight_effect(BacklightEffect::Static).await?;
// Listen for hardware-generated backlight changes.
let rx = feat.listen();
if let Ok(event) = rx.recv().await {
println!("backlight event: {:?}", event);
}
}