0x8090 · modeStatus
读写设备工作模式——通过位掩码控制的状态寄存器在性能模式与续航模式之间切换,并查询硬件与软件切换能力。
在性能模式与续航模式之间切换设备的工作状态。getModeStatus(function 0)读取当前的 ModeStatus(主状态字节与次状态字节);setModeStatus(function 1)通过显式的已更改位掩码将其写回,确保调用方仅修改目标位。便捷封装 set_performance_mode 直接驱动 PERFORMANCE 单一标志,无需手动管理掩码。getDeviceConfig(function 2)报告设备支持哪些切换机制。
ModeStatus——getModeStatus的返回结构体,包含status0: ModeStatus0(主标志位)与status1: u8(次状态字节,v1 中为保留字段,但会透传给调用方)。ModeStatus0::PERFORMANCE—— 置位 = 性能模式;清零 = 续航模式。ModeStatusCapabilities::HARDWARE_SWITCH—— 设备有可更改模式位的物理开关。ModeStatusCapabilities::SOFTWARE_SWITCH—— 软件可更改模式位。ModeStatusChange—— 将期望值(status0、status1)与已更改位掩码(changed_mask0、changed_mask1)配对;仅写入被掩码选中的位。
规格: Logitech HID++ 2.0 —— modeStatus。用于:
openlogi-hidpp中的类型化封装。
Function reference
The ModeStatusFeature wrapper (0x8090) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_mode_status | 0 | () | ModeStatus |
set_mode_status | 1 | (change: ModeStatusChange) | () |
set_performance_mode | 1 | (enabled: bool) | () |
get_device_config | 2 | () | ModeStatusCapabilities |
All methods are async and return Result<…, Hidpp20Error>.
Types
ModeStatus
Current mode-status bytes returned by get_mode_status.
| Field | Type | Description |
|---|---|---|
status0 | ModeStatus0 | Primary status bits. |
status1 | u8 | Secondary status byte, reserved by v1 but preserved for callers. |
ModeStatusChange
A mode-status update request passed to set_mode_status.
| Field | Type | Description |
|---|---|---|
status0 | ModeStatus0 | Desired primary status bits. |
status1 | u8 | Desired secondary status byte. |
changed_mask0 | ModeStatus0 | Primary changed-bit mask. |
changed_mask1 | u8 | Secondary changed-bit mask. |
ModeStatus0
The first mode-status byte.
| Flag | Bit/Value | Description |
|---|---|---|
PERFORMANCE | bit 0 | Performance mode. When unset, the device is in endurance mode. |
ModeStatusCapabilities
Capabilities reported by ModeStatus.
| Flag | Bit/Value | Description |
|---|---|---|
HARDWARE_SWITCH | bit 0 | A hardware switch can change the mode bit. |
SOFTWARE_SWITCH | bit 1 | Software can change the mode bit. |
Wire format
Getter requests carry a 3-byte zero payload; set_mode_status uses a 16-byte long payload. Responses are decoded from the extended 16-byte payload returned by each call.
get_mode_status (fn 0)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | status0 | ModeStatus0 bitflags — bit 0 = PERFORMANCE |
| 1 | status1 | Secondary status byte (reserved in v1) |
| 2–15 | — | Unused |
set_mode_status (fn 1)
Request (16-byte long payload):
| Byte | Field | Notes |
|---|---|---|
| 0 | status0 | ModeStatus0::bits() — desired primary flags |
| 1 | status1 | Desired secondary byte |
| 2 | changed_mask0 | ModeStatus0::bits() — which primary bits to write |
| 3 | changed_mask1 | Which secondary bits to write |
| 4–15 | — | Zero |
Response: no bytes consumed (only error status checked).
set_performance_mode (fn 1)
Convenience wrapper. Sends set_mode_status with status0 = PERFORMANCE (or empty) and changed_mask0 = PERFORMANCE, status1 = 0, changed_mask1 = 0. Wire layout is identical to set_mode_status above.
get_device_config (fn 2)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | capabilities high byte | Big-endian u16 — bits 8–15 (none defined) |
| 1 | capabilities low byte | bit 0 = HARDWARE_SWITCH, bit 1 = SOFTWARE_SWITCH |
| 2–15 | — | Unused |
Usage (Rust)
use hidpp::{device::Device, feature::mode_status::ModeStatusFeature};
// device: &mut Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<ModeStatusFeature>() {
// Read current mode
let status = feat.get_mode_status().await?;
println!("performance mode: {}", status.status0.contains(hidpp::feature::mode_status::ModeStatus0::PERFORMANCE));
// Switch to performance mode
feat.set_performance_mode(true).await?;
// Check which switch mechanisms the device exposes
let caps = feat.get_device_config().await?;
println!("hw switch: {}, sw switch: {}",
caps.contains(hidpp::feature::mode_status::ModeStatusCapabilities::HARDWARE_SWITCH),
caps.contains(hidpp::feature::mode_status::ModeStatusCapabilities::SOFTWARE_SWITCH));
}