0x1001 · batteryVoltage
以实测毫伏值加充电标志位表示电量——许多 G 系列无线设备唯一的电量来源。
以实测电压加一个充电标志字节的形式上报设备电量。G 系列无线游戏设备(G915、G903
LIGHTSPEED、G502 LIGHTSPEED)只暴露 0x1001,既没有 0x1000 也没有
0x1004,因此若不实现它,清单探测根本找不到这些设备的电量来源。
与同类功能不同,它不上报百分比——OpenLogi 在渲染电量指示时会依据电压估算一个百分比。
它的线上格式没有公开的 Logitech
规格。大端序毫伏 u16 加一个标志字节的布局来自逆向;解码遵循 Solaar 的
decipher_battery_voltage 与 libratbag 对标志位的共识。
规格: 逆向所得 —— x1001 batteryVoltage。用于: G 系列无线设备的电量状态。
Function reference
The BatteryVoltageFeature wrapper (0x1001) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_battery_info | 0 | () | VoltageBatteryInfo |
The method is async and returns Result<…, Hidpp20Error>. The broadcast event
is not implemented.
Types
VoltageBatteryInfo
| Field | Type | Description |
|---|---|---|
voltage_mv | u16 | Measured battery voltage in millivolts — roughly 3500 (empty) to 4200 (full) for the single-cell Li-Po batteries these devices carry. |
status | VoltageChargingStatus | Charging state decoded from the flags byte. |
critical | bool | The firmware's "charge level critical" marker (flags bit 5). |
VoltageChargingStatus
| Variant | Description |
|---|---|
Discharging | Running on battery (bit 7 clear). |
Charging | Charging at the standard rate. |
ChargingFast | Charging at a raised current (bit 3). |
ChargingSlow | Charging at reduced current (bit 4). |
Full | On external power with charge complete (status bits 0b01). |
NotCharging | On external power but not charging — a charge fault (status bits 0b10). |
Decoding is total on purpose: a contradictory or future flag combination falls into the nearest charging bucket rather than failing, so a battery reading never vanishes over an unknown bit.
Wire format
get_battery_info (fn 0)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0–1 | voltage_mv | big-endian u16, millivolts |
| 2 | flags | charging state, decoded below |
Flags byte:
| Bit(s) | Meaning |
|---|---|
| 7 | External power present. Clear → Discharging, and every other bit is meaningless. |
| 0–1 | Charge status: 0b01 (or 0b11) → Full, 0b10 → NotCharging. Takes precedence over the rate bits. |
| 3 | Fast charging → ChargingFast. |
| 4 | Slow charging → ChargingSlow. |
| 5 | critical — surfaced independently of the status. |
Usage (Rust)
use hidpp::{device::Device, feature::battery_voltage::BatteryVoltageFeature};
// device: &mut Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<BatteryVoltageFeature>() {
let info = feat.get_battery_info().await?;
println!("{} mV — {:?} (critical: {})", info.voltage_mv, info.status, info.critical);
}