0x40A2 · fnInversionWithDefaultState
单主机 Fn 锁开关——读取或写入全局功能键翻转状态,同时返回设备的出厂默认值。
控制键盘功能键默认是执行标准 Fn 功能还是其次要(媒体 / 动作)功能——即 Fn-lock 反转开关。getGlobalFnInversion 读取当前状态及设备内置默认值;setGlobalFnInversion 写入新状态并回传结果 GlobalFnInversion。
- state ——
On:功能键产生次要(媒体 / 动作)功能;Off:标准 Fn 行为。 - default_state —— 出厂或设备存储的默认值,与当前状态一同返回,方便调用方提供"恢复默认"操作。
0x40A2 是 0x40A3 fnInversionForMultiHostDevices 的单主机前身,后者新增了 host 槽位参数与 capabilities 字段(MANUAL_FN_LOCK);两者共享同一 FnInversionState 枚举。
规格: Logitech HID++ 2.0 —— fnInversionWithDefaultState。用于:
openlogi-hidpp中的类型化包装器。
Function reference
The FnInversionWithDefaultStateFeature wrapper (0x40a2) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_global_fn_inversion | 0 | () | GlobalFnInversion |
set_global_fn_inversion | 1 | (state: FnInversionState) | GlobalFnInversion |
All methods are async and return Result<…, Hidpp20Error>.
Types
GlobalFnInversion
Global function-key inversion state, common to all keys.
| Field | Type | Description |
|---|---|---|
state | FnInversionState | Current inversion state. |
default_state | FnInversionState | Default inversion state. |
FnInversionState
Function-key inversion state.
| Variant | Value | Description |
|---|---|---|
Off | 0 | Function-key inversion is disabled. |
On | 1 | Function-key inversion is enabled. |
Wire format
Both methods carry a 3-byte request payload and read state from the 16-byte extended response payload.
get_global_fn_inversion (fn 0)
Request: [0x00, 0x00, 0x00] (no parameters; all bytes are padding)
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | state | 0 = Off, 1 = On |
| 1 | default_state | 0 = Off, 1 = On |
| 2–15 | — | unused |
set_global_fn_inversion (fn 1)
Request: [state, 0x00, 0x00]
| Byte | Value | Notes |
|---|---|---|
| 0 | u8::from(state) | 0 = Off, 1 = On |
| 1–2 | 0x00 | padding |
Response (byte → field): identical layout to get_global_fn_inversion — byte 0 = state, byte 1 = default_state.
Usage (Rust)
use hidpp::{
device::Device,
feature::fn_inversion::{FnInversionState, FnInversionWithDefaultStateFeature},
};
// mut device: Device, already created via Device::new(channel, index).await?
// enumerate_features requires &mut self.
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<FnInversionWithDefaultStateFeature>() {
// Read current Fn-lock state and its factory default.
let info = feat.get_global_fn_inversion().await?;
println!("state={:?} default={:?}", info.state, info.default_state);
// Enable Fn-lock inversion and confirm the resulting state.
let updated = feat.set_global_fn_inversion(FnInversionState::On).await?;
println!("new state={:?}", updated.state);
}