0x40A2 · fnInversionWithDefaultState
Single-host Fn-lock toggle — read or write the global function-key inversion state alongside the device's factory default.
Controls whether a keyboard's function keys act as standard Fn keys or as their
secondary (media / action) labels, the Fn-lock inversion toggle.
getGlobalFnInversion reads the current state and the device's built-in
default; setGlobalFnInversion writes the new state and echoes back the
resulting GlobalFnInversion.
- state —
On: Fn keys produce their secondary (media / action) function;Off: standard Fn behaviour. - default_state — the factory or device-stored default, returned alongside the live state so callers can offer a "reset to default" action.
0x40A2 is the single-host predecessor of 0x40A3 fnInversionForMultiHostDevices,
which adds a host slot parameter and a capabilities field (MANUAL_FN_LOCK);
both share the same FnInversionState enum.
Spec: Logitech HID++ 2.0 — fnInversionWithDefaultState. Used by: Typed wrapper in
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);
}