OpenLogi
功能(Features)

0x0000 · root

HID++ 2.0 的入口——将功能 ID 映射为会话索引,并通过 ping 验证链路是否正常。

每个 HID++ 2.0 设备的入口。root 将 16 位的功能 ID 映射为设备在当前会话中为该功能使用的功能索引(feature index),并报告 HID++ 协议版本。

客户端先调用 getFeature(featureId),随后用返回的索引来寻址其他每个功能。root 自身始终位于索引 0

规格: Logitech HID++ 2.0 —— x0000 root用于: 所有设备访问。

Function reference

The RootFeature wrapper (0x0000, always bound to feature index 0) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_feature0(id: u16)Option<FeatureInformation>
ping1(data: u8)u8

All methods are async and return Result<…, Hidpp20Error>. get_feature resolves to None when the device does not support the requested feature ID; ping echoes data back when the link is alive.

Types

FeatureInformation

Information about a feature, returned by get_feature.

FieldTypeDescription
indexu8The feature's index in the device's feature table, used to address its functions.
typFeatureTypeThe feature's type flags.
versionu8Latest supported version of the feature (0 on root v0 devices).

FeatureType

Feature classification flags decoded from the type byte.

FieldTypeDescription
obsoleteboolFeature replaced by a newer one, kept so older software still finds it (bit 7).
hiddenboolSW-hidden feature; configuration software should ignore it (bit 6).
engineeringboolHidden feature disabled for user software; internal testing / manufacturing (bit 5).
manufacturing_deactivatableboolManufacturing feature that can be permanently deactivated (bit 4; added in v2).
compliance_deactivatableboolCompliance feature that can be permanently deactivated (bit 3; added in v2).

Wire format

Both functions use a 3-byte short-report request payload. Responses are read from the extended payload (up to 16 bytes) returned by the device.

get_feature (fn 0)

Request: [ id_hi, id_lo, 0x00 ]

  • Byte 0: high byte of the 16-bit feature ID ((id >> 8) as u8)
  • Byte 1: low byte of the 16-bit feature ID (id as u8)
  • Byte 2: reserved, always 0x00

Response (byte → field):

ByteFieldNotes
0indexFeature index in the device table. 0 means the feature is unsupported (returns None).
1type byte → FeatureTypeBit 7 = obsolete, bit 6 = hidden, bit 5 = engineering, bit 4 = manufacturing_deactivatable, bit 3 = compliance_deactivatable.
2versionLatest supported feature version; 0 on root v0 devices.

ping (fn 1)

Request: [ 0x00, 0x00, data ]

  • Bytes 0–1: reserved, always 0x00
  • Byte 2: arbitrary ping byte chosen by the caller

Response (byte → field):

ByteFieldNotes
2echoed dataThe device echoes the ping byte at the same offset. Bytes 0–1 also carry the HID++ protocol version but are not exposed by this wrapper.

Usage (Rust)

use hidpp::{device::Device, feature::root::RootFeature};

// mut device: Device, obtained via Device::new(channel, index).await?
// RootFeature is registered automatically; no enumerate_features() needed.
let feat = device.root(); // returns Arc<RootFeature>

// Look up a feature by its 16-bit ID (e.g. 0x1000 = battery unified).
if let Some(info) = feat.get_feature(0x1000).await? {
    println!("feature 0x1000 → index {}, version {}", info.index, info.version);
}

// Verify the link is alive; the device echoes the byte back.
let echo = feat.ping(0x42).await?;
assert_eq!(echo, 0x42);

本页目录