OpenLogi
功能(Features)

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

FunctionHID++ fnSignatureReturns
get_battery_info0()VoltageBatteryInfo

The method is async and returns Result<…, Hidpp20Error>. The broadcast event is not implemented.

Types

VoltageBatteryInfo

FieldTypeDescription
voltage_mvu16Measured battery voltage in millivolts — roughly 3500 (empty) to 4200 (full) for the single-cell Li-Po batteries these devices carry.
statusVoltageChargingStatusCharging state decoded from the flags byte.
criticalboolThe firmware's "charge level critical" marker (flags bit 5).

VoltageChargingStatus

VariantDescription
DischargingRunning on battery (bit 7 clear).
ChargingCharging at the standard rate.
ChargingFastCharging at a raised current (bit 3).
ChargingSlowCharging at reduced current (bit 4).
FullOn external power with charge complete (status bits 0b01).
NotChargingOn 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):

ByteFieldNotes
0–1voltage_mvbig-endian u16, millivolts
2flagscharging state, decoded below

Flags byte:

Bit(s)Meaning
7External power present. Clear → Discharging, and every other bit is meaningless.
0–1Charge status: 0b01 (or 0b11) → Full, 0b10NotCharging. Takes precedence over the rate bits.
3Fast charging → ChargingFast.
4Slow charging → ChargingSlow.
5critical — 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);
}

另见: 0x1004 unifiedBattery0x1000 batteryStatus

本页目录