OpenLogi
功能(Features)

0x40A2 · fnInversionWithDefaultState

单主机 Fn 锁开关——读取或写入全局功能键翻转状态,同时返回设备的出厂默认值。

控制键盘功能键默认是执行标准 Fn 功能还是其次要(媒体 / 动作)功能——即 Fn-lock 反转开关。getGlobalFnInversion 读取当前状态及设备内置默认值;setGlobalFnInversion 写入新状态并回传结果 GlobalFnInversion

  • state —— On:功能键产生次要(媒体 / 动作)功能;Off:标准 Fn 行为。
  • default_state —— 出厂或设备存储的默认值,与当前状态一同返回,方便调用方提供"恢复默认"操作。

0x40A20x40A3 fnInversionForMultiHostDevices 的单主机前身,后者新增了 host 槽位参数与 capabilities 字段(MANUAL_FN_LOCK);两者共享同一 FnInversionState 枚举。

规格: Logitech HID++ 2.0 —— fnInversionWithDefaultState用于: openlogi-hidpp 中的类型化包装器。

Function reference

The FnInversionWithDefaultStateFeature wrapper (0x40a2) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_global_fn_inversion0()GlobalFnInversion
set_global_fn_inversion1(state: FnInversionState)GlobalFnInversion

All methods are async and return Result<…, Hidpp20Error>.

Types

GlobalFnInversion

Global function-key inversion state, common to all keys.

FieldTypeDescription
stateFnInversionStateCurrent inversion state.
default_stateFnInversionStateDefault inversion state.

FnInversionState

Function-key inversion state.

VariantValueDescription
Off0Function-key inversion is disabled.
On1Function-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):

ByteFieldNotes
0state0 = Off, 1 = On
1default_state0 = Off, 1 = On
2–15unused

set_global_fn_inversion (fn 1)

Request: [state, 0x00, 0x00]

ByteValueNotes
0u8::from(state)0 = Off, 1 = On
1–20x00padding

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);
}

本页目录