0x8070 · colorLedEffects
逐区域 RGB 效果引擎——枚举 LED 区域及其支持的效果、以可选持久化方式应用效果,并与主机进行时序同步。
Logitech 键盘与鼠标所使用的逐区域 RGB 效果引擎。设备暴露一个或多个 LED 区域(主区、Logo 区、左/右侧等);每个区域均可独立配置效果,例如固定颜色、呼吸、色浪、星光或涟漪。get_info 返回区域数量与能力位掩码;get_zone_info 与 get_zone_effect_info 枚举每个区域的物理位置及其所支持的效果。效果通过 set_zone_effect 应用,该函数接受 10 字节的效果专属参数(如 FixedColor 使用前三字节作为 R、G、B)以及 Persistence 值,用于选择仅写入 RAM(易失性)或写入 EEPROM。get_sw_control / set_sw_control 将 LED 控制权交给软件或归还固件;启用同步事件后,设备每个周期发出一次 SyncEffect 事件,调用方可借此通过 synchronize_effect 修正时序偏差。
EffectId—Disabled、FixedColor、PulsingBreathingLegacy、Cycling、ColorWave、Starlight、LightOnPress、PulsingBreathingWaveform、Ripple等。LocationEffect—Primary、Logo、LeftSide、RightSide、Combined,或按编号的主区域(Primary1–Primary6)。Persistence—Volatile(仅 RAM,断电丢失)、VolatileAndNonVolatile(RAM + EEPROM)、NonVolatileOnly(仅 EEPROM)。ExtCapabilities— 由get_info读取的功能标志:GET_ZONE_EFFECT、NO_GET_EFFECT_SETTINGS、SET_LED_BIN_INFO、MONOCHROME_ONLY、NO_SYNCHRONIZE_EFFECT。
规格: Logitech HID++ 2.0 —— colorLedEffects。用于:
openlogi-hidpp中的类型化封装。
Function reference
The ColorLedEffectsFeature wrapper (0x8070) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_info | 0 | () | ColorLedInfo |
get_zone_info | 1 | (zone_index: u8) | ZoneInfo |
get_zone_effect_info | 2 | (zone_index: u8, zone_effect_index: u8) | ZoneEffectInfo |
set_zone_effect | 3 | (zone_index: u8, zone_effect_index: u8, params: [u8; 10], persistence: Persistence) | () |
get_nv_config | 4 | (capability: NvCapabilities) | NvConfig |
set_nv_config | 5 | (capability: NvCapabilities, state: NvCapabilityState, param1: u8, param2: u8) | () |
get_led_bin_info | 6 | (zone_index: u8, led_bin_index: LedBinIndex) | LedBinInfo |
get_sw_control | 7 | () | SwControlState |
set_sw_control | 8 | (control: SwControl, sync_events: bool) | () |
get_effect_settings | 9 | (zone_index: u8, source: PersistenceSource) | EffectSettings |
clear_effect_settings | 10 | (zone_index: u8) | () |
set_cycling_direction | 11 | (direction: CyclingDirection) | () |
get_current_color | 12 | (zone_index: u8) | Rgb |
synchronize_effect | 13 | (zone_index: u8, drift_value: i16) | () |
get_zone_effect | 14 | (zone_index: u8, source: PersistenceSource) | ZoneEffect |
set_led_bin_info | 15 | (info: &LedBinInfo) | LedBinInfo |
listen | — | () | async_channel::Receiver<ColorLedEffectsEvent> |
All async fn methods return Result<_, Hidpp20Error>. listen is synchronous and returns a channel receiver for unsolicited events.
Types
ColorLedInfo
General feature information returned by get_info.
| Field | Type | Description |
|---|---|---|
zone_count | u8 | Number of LED zones. |
nv_capabilities | NvCapabilities | Supported non-volatile capabilities. |
ext_capabilities | ExtCapabilities | Extended capabilities. |
ZoneInfo
Information about one zone, returned by get_zone_info.
| Field | Type | Description |
|---|---|---|
zone_index | u8 | Index of the zone. |
location | LocationEffect | Physical location the zone covers. |
effects_number | u8 | Number of effects the zone supports. |
persistency | PersistencyCapabilities | Persistency capabilities of the zone. |
ZoneEffectInfo
Information about one effect of a zone, returned by get_zone_effect_info.
| Field | Type | Description |
|---|---|---|
zone_index | u8 | Index of the zone. |
zone_effect_index | u8 | Index of the effect within the zone. |
effect_id | EffectId | The effect type. |
effect_capabilities | u16 | Effect capability bitmask (meaning depends on effect_id). |
effect_period | u16 | Effect period in milliseconds, or 0 when not available. |
ZoneEffect
The configured effect of a zone, returned by get_zone_effect.
| Field | Type | Description |
|---|---|---|
zone_index | u8 | Index of the zone. |
zone_effect_index | u8 | Index of the configured effect within the zone. |
params | [u8; 10] | The effect parameters (meaning depends on the effect's EffectId). |
EffectSettings
Effect settings of a zone, returned by get_effect_settings.
| Field | Type | Description |
|---|---|---|
zone_index | u8 | Index of the zone. |
color | Rgb | Effect color. |
period | u16 | Effect period in milliseconds. |
brightness | u8 | Effect brightness. |
param | u8 | Effect-specific parameter. |
SwControlState
Software-control state, returned by get_sw_control.
| Field | Type | Description |
|---|---|---|
control | SwControl | Whether firmware or software owns the LEDs. |
sync_events | bool | Whether the device emits sync-effect events. |
NvConfig
A non-volatile configuration entry, returned by get_nv_config.
| Field | Type | Description |
|---|---|---|
capability | NvCapabilities | The single capability bit this entry addresses. |
state | NvCapabilityState | The capability's state. |
param1 | u8 | First capability-specific parameter. |
param2 | u8 | Second capability-specific parameter. |
LedBinInfo
Manufacturing LED bin information, returned by get_led_bin_info / set_led_bin_info.
| Field | Type | Description |
|---|---|---|
zone_index | u8 | Index of the zone. |
led_bin_index | LedBinIndex | Which bin parameter this is. |
red | u16 | Red bin value. |
green | u16 | Green bin value. |
blue | u16 | Blue bin value. |
white | u16 | White bin value. |
Rgb
An 8-bit-per-channel RGB color.
| Field | Type | Description |
|---|---|---|
red | u8 | Red channel. |
green | u8 | Green channel. |
blue | u8 | Blue channel. |
EffectId
Identifies the type of a zone effect.
| Variant | Value | Description |
|---|---|---|
Disabled | 0 | No effect / LEDs off. |
FixedColor | 1 | A fixed single color. |
PulsingBreathingLegacy | 2 | Legacy pulsing/breathing effect. |
Cycling | 3 | Color cycling through the color wheel. |
ColorWave | 4 | A traveling color wave. |
Starlight | 5 | Twinkling "starlight" effect. |
LightOnPress | 6 | Light up keys on press. |
AudioVisualizer | 7 | Audio visualizer (reserved). |
BootUp | 8 | Boot-up effect. |
DemoMode | 9 | Demo mode. |
PulsingBreathingWaveform | 10 | Pulsing/breathing with a selectable waveform. |
Ripple | 11 | Ripple effect. |
LocationEffect
The physical location a zone covers.
| Variant | Value | Description |
|---|---|---|
Primary | 1 | The primary zone. |
Logo | 2 | The logo. |
LeftSide | 3 | The left side. |
RightSide | 4 | The right side. |
Combined | 5 | A combined zone. |
Primary1 | 6 | Primary zone 1. |
Primary2 | 7 | Primary zone 2. |
Primary3 | 8 | Primary zone 3. |
Primary4 | 9 | Primary zone 4. |
Primary5 | 10 | Primary zone 5. |
Primary6 | 11 | Primary zone 6. |
Persistence
Storage persistence for set_zone_effect.
| Variant | Value | Description |
|---|---|---|
Volatile | 0 | Volatile: applied to RAM only, lost on power cycle. |
VolatileAndNonVolatile | 1 | Applied to RAM and stored in EEPROM. |
NonVolatileOnly | 2 | Stored in EEPROM only. |
PersistenceSource
Which storage a read function should read from.
| Variant | Value | Description |
|---|---|---|
Ram | 0 | The actively playing configuration in RAM. |
Eeprom | 1 | The saved configuration in EEPROM. |
SwControl
Whether the firmware or software owns the LEDs.
| Variant | Value | Description |
|---|---|---|
Firmware | 0 | The firmware owns all LEDs. |
Software | 1 | Software owns all LEDs. |
CyclingDirection
Direction of color cycling.
| Variant | Value | Description |
|---|---|---|
Clockwise | 0 | Clockwise through the color wheel. |
Anticlockwise | 1 | Anticlockwise through the color wheel. |
LedBinIndex
Selects which LED bin parameter a get_led_bin_info / set_led_bin_info call addresses.
| Variant | Value | Description |
|---|---|---|
BinValueBrightness | 0 | Bin value: brightness. |
BinValueColor | 1 | Bin value: color. |
CalibrationFactors | 2 | Calibration factors. |
Brightness | 3 | Brightness. |
ColorimetricX | 4 | Colorimetric X. |
ColorimetricY | 5 | Colorimetric Y. |
NvCapabilityState
State of a non-volatile configuration capability.
| Variant | Value | Description |
|---|---|---|
NoChange | 0 | The stored value has never been explicitly set (read-only sentinel, enabled assumed). |
Enabled | 1 | The capability is enabled. |
Disabled | 2 | The capability is disabled. |
NvCapabilities
Supported non-volatile configuration capabilities, from get_info.
| Flag | Bit/Value | Description |
|---|---|---|
BOOT_UP_EFFECT | 1 << 0 | A boot-up effect can be configured. |
DEMO | 1 << 1 | Demo mode is supported. |
USER_DEMO_MODE | 1 << 2 | User demo mode is supported. |
ExtCapabilities
Extended capabilities from get_info. Several flags are "NOT supported" flags whose set state removes a function.
| Flag | Bit/Value | Description |
|---|---|---|
GET_ZONE_EFFECT | 1 << 0 | getZoneEffect is supported. |
NO_GET_EFFECT_SETTINGS | 1 << 1 | getEffectSettings is not supported. |
SET_LED_BIN_INFO | 1 << 2 | setLedBinInfo is supported. |
MONOCHROME_ONLY | 1 << 3 | Only monochrome effects are supported. |
NO_SYNCHRONIZE_EFFECT | 1 << 4 | synchronizeEffect and the sync-effect event are not supported. |
PersistencyCapabilities
Persistency capabilities of a zone, from get_zone_info. A value of zero means persistency is not supported.
| Flag | Bit/Value | Description |
|---|---|---|
ALWAYS_ON | 1 << 0 | The zone can persist an "always on" state. |
ALWAYS_OFF | 1 << 1 | The zone can persist an "always off" state. |
ON_THEN_OFF | 1 << 2 | The zone can persist an "on then off" state. |
Events
ColorLedEffectsFeature implements EmittingFeature<ColorLedEffectsEvent>. Call listen() to receive an async_channel::Receiver<ColorLedEffectsEvent>.
ColorLedEffectsEvent
| Variant | Fields | Description |
|---|---|---|
SyncEffect | zone_index: u8, effect_counter: u16 | A period effect reached a synchronization point. Emitted once per period while sync events are enabled. zone_index of 0xff means all zones; effect_counter is the current timing position within the period in milliseconds. |
Wire format
Most getters use a 3-byte short request and read a 16-byte long response payload. The four write-heavy functions (set_zone_effect, set_nv_config, synchronize_effect, set_led_bin_info) send a 16-byte long request. All multi-byte fields are big-endian.
get_info (fn 0)
Request: [0x00, 0x00, 0x00]
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_count | Number of LED zones |
| 1–2 | nv_capabilities | NvCapabilities bitmask (BE u16) |
| 3–4 | ext_capabilities | ExtCapabilities bitmask (BE u16) |
get_zone_info (fn 1)
Request: [zone_index, 0x00, 0x00]
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | Echo |
| 1–2 | location | LocationEffect as BE u16 |
| 3 | effects_number | Number of effects this zone supports |
| 4 | persistency | PersistencyCapabilities bitmask |
get_zone_effect_info (fn 2)
Request: [zone_index, zone_effect_index, 0x00]
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | Echo |
| 1 | zone_effect_index | Echo |
| 2–3 | effect_id | EffectId as BE u16 |
| 4–5 | effect_capabilities | Effect capability bitmask (BE u16) |
| 6–7 | effect_period | Period in ms, 0 if unavailable (BE u16) |
set_zone_effect (fn 3)
16-byte long request:
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | |
| 1 | zone_effect_index | |
| 2–11 | params | 10 effect-specific bytes (e.g. R, G, B for FixedColor) |
| 12 | persistence | Persistence as u8 |
| 13–15 | — | Padding (0x00) |
No response body (acknowledges with an empty reply).
get_nv_config (fn 4)
Request: [cap_hi, cap_lo, 0x00] — cap_hi:cap_lo is the single-bit NvCapabilities value as BE u16.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0–1 | capability | NvCapabilities bitmask echoed (BE u16) |
| 2 | state | NvCapabilityState as u8 |
| 3 | param1 | Capability-specific parameter |
| 4 | param2 | Capability-specific parameter |
set_nv_config (fn 5)
16-byte long request:
| Byte | Field | Notes |
|---|---|---|
| 0–1 | capability | Single-bit NvCapabilities as BE u16 |
| 2 | state | NvCapabilityState as u8 |
| 3 | param1 | |
| 4 | param2 | |
| 5–15 | — | Padding (0x00) |
No response body.
get_led_bin_info (fn 6)
Request: [zone_index, led_bin_index, 0x00] — led_bin_index is LedBinIndex as u8.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | Echo |
| 1 | led_bin_index | LedBinIndex as u8 |
| 2–3 | red | BE u16 |
| 4–5 | green | BE u16 |
| 6–7 | blue | BE u16 |
| 8–9 | white | BE u16 |
get_sw_control (fn 7)
Request: [0x00, 0x00, 0x00]
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | control | SwControl as u8 (0=Firmware, 1=Software) |
| 1 | sync_events | 0x00=false, any other=true |
set_sw_control (fn 8)
Request: [control, sync_events_u8, 0x00] — control is SwControl as u8; sync_events_u8 is 0 or 1.
No response body.
get_effect_settings (fn 9)
Request: [zone_index, source, 0x00] — source is PersistenceSource as u8.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | Echo |
| 1 | color.red | |
| 2 | color.green | |
| 3 | color.blue | |
| 4–5 | period | Effect period in ms (BE u16) |
| 6 | brightness | |
| 7 | param | Effect-specific parameter |
clear_effect_settings (fn 10)
Request: [zone_index, 0x00, 0x00]
No response body.
set_cycling_direction (fn 11)
Request: [direction, 0x00, 0x00] — direction is CyclingDirection as u8 (0=Clockwise, 1=Anticlockwise).
No response body.
get_current_color (fn 12)
Request: [zone_index, 0x00, 0x00]
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | — | Not used for color |
| 1 | red | |
| 2 | green | |
| 3 | blue |
synchronize_effect (fn 13)
16-byte long request:
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | 0xff = all zones |
| 1 | — | Padding (0x00) |
| 2 | drift_value high byte | drift_value: i16 as BE |
| 3 | drift_value low byte | |
| 4–15 | — | Padding (0x00) |
No response body. Valid only while sync events are enabled.
get_zone_effect (fn 14)
Request: [zone_index, source, 0x00] — source is PersistenceSource as u8.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | Echo |
| 1 | zone_effect_index | |
| 2–11 | params | 10 effect-specific bytes |
set_led_bin_info (fn 15)
16-byte long request:
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | |
| 1 | led_bin_index | LedBinIndex as u8 |
| 2–3 | red | BE u16 |
| 4–5 | green | BE u16 |
| 6–7 | blue | BE u16 |
| 8–9 | white | BE u16 |
| 10–15 | — | Padding (0x00) |
Response has the same byte layout as get_led_bin_info (device echoes the written values).
SyncEffect event (event fn 0)
Unsolicited message emitted once per effect period while sync events are enabled.
| Byte | Field | Notes |
|---|---|---|
| 0 | zone_index | 0xff = all zones |
| 1–2 | effect_counter | Timing position within the period, in ms (BE u16) |
Usage (Rust)
use hidpp::{
device::Device,
feature::color_led_effects::{
ColorLedEffectsFeature, Persistence, SwControl,
},
};
// mut device: Device, already created via Device::new(channel, index).await?
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<ColorLedEffectsFeature>() {
// Read overall feature info (zone count, capability flags).
let info = feat.get_info().await?;
println!("zones: {}, ext_caps: {:?}", info.zone_count, info.ext_capabilities);
// Take software control so we can drive the LEDs directly.
feat.set_sw_control(SwControl::Software, true).await?;
// Apply a fixed red color to zone 0, stored in RAM only.
let mut params = [0u8; 10];
params[0] = 0xff; // R
params[1] = 0x00; // G
params[2] = 0x00; // B
feat.set_zone_effect(0, 0, params, Persistence::Volatile).await?;
// Listen for sync-effect events to correct timing drift.
let rx = feat.listen();
if let Ok(event) = rx.recv().await {
println!("sync event: {:?}", event);
}
// Return LED control to the firmware.
feat.set_sw_control(SwControl::Firmware, false).await?;
}