OpenLogi

0x40A2 · fnInversionWithDefaultState

Single-host Fn-key inversion — read or write the global state and its reported default.

0x40a2 controls one global Fn-inversion state on keyboards that report it. Off makes bare F-row keys send F1–F12. On makes them perform their printed media or shortcut functions. The feature also reports a default state.

Spec: Logitech HID++ 2.0 — fnInversionWithDefaultState. Cross-checked: Logi Options+ 2.8 (static analysis). Used by: Keyboard.

Function reference

FnInversionWithDefaultStateFeature implements feature 0x40a2 from feature version 0.

Methods

FunctionHID++ fnSignatureReturns
get_global_fn_inversion0()GlobalFnInversion
set_global_fn_inversion1(state: FnInversionState)GlobalFnInversion
is_state_broadcast1, broadcast(function_id: u8)bool

The get and set methods are async and return Result<…, Hidpp20Error>. is_state_broadcast is a synchronous recognition helper. It does not send I/O.

Types

GlobalFnInversion

FieldTypeDescription
stateFnInversionStateCurrent inversion state.
default_stateFnInversionStateReported default inversion state.

FnInversionState

The non-exhaustive state enum has these defined values:

VariantValueDescription
Off0Bare F-row keys send F1–F12.
On1Bare F-row keys perform their printed media or shortcut function.

Events

The crate exposes no typed event. is_state_broadcast(1) identifies an unsolicited function-1 report as a state-change signal.

Wire format

All request payloads contain three bytes. No multi-byte field occurs in this feature.

get_global_fn_inversion (fn 0)

Request payload: [0x00, 0x00, 0x00].

ByteFieldNotes
0state0 = Off; 1 = On.
1default_state0 = Off; 1 = On.
2–15/No defined field. OpenLogi ignores these bytes.

OpenLogi accepts a HID++ short or long response. It reads bytes 0–1 and zero-fills a short response internally before decoding them. Other state values return Hidpp20Error::UnsupportedResponse.

set_global_fn_inversion (fn 1)

ByteValueNotes
0u8::from(state)0 = Off; 1 = On.
1–20x00OpenLogi writes fixed zero padding.

The response has the same decoded fields as function 0. OpenLogi reads bytes 0–1 and ignores all other bytes.

State-change broadcast (fn 1)

Logi Options+ 2.8 treats a non-empty unsolicited function-1 report as a setting change. Its payload layout is not established by the available evidence. OpenLogi only checks the function ID and does not decode the broadcast payload.

The inventory listener only considers broadcasts with software ID 0 that target this feature index. It then re-reads the authoritative state.

How OpenLogi uses it

OpenLogi uses 0x40a2 when 0x40a3 is unsupported. A feature-table entry for 0x40a2 enables the Fn-lock capability. The fallback continues to 0x40a0 only when 0x40a2 itself is unsupported.

The device setting maps fn_lock = true to inversion Off. It maps fn_lock = false to inversion On. The request is a complete one-byte state, so OpenLogi does not use read-modify-write. It compares the returned state with the requested Fn-lock state after a write.

Since v0.8.14, PR #1791 records a recognised state-change broadcast and re-reads Fn-lock in the desktop app. The broadcast does not update config.toml. OpenLogi replays a configured fn_lock value after reconnect, rather than restoring a prior value at exit.

Open questions

  • No hardware trace confirms that Fn+Esc emits this function-1 broadcast. The Options+ 2.8 static analysis identifies a non-empty report only. OpenLogi re-reads after every recognised function-1 broadcast.
  • The unsolicited report payload has no verified field layout. OpenLogi does not interpret it, so this uncertainty cannot change the displayed state directly.

Usage (Rust)

use hidpp::{
    device::Device,
    feature::fn_inversion::{FnInversionState, FnInversionWithDefaultStateFeature},
};

async fn inspect(device: &mut Device) -> Result<(), hidpp::protocol::v20::Hidpp20Error> {
    let _ = device.enumerate_features().await?;
    let Some(feature) = device.get_feature::<FnInversionWithDefaultStateFeature>() else {
        return Ok(());
    };

    let info = feature.get_global_fn_inversion().await?;
    println!("state={:?}, default={:?}", info.state, info.default_state);

    let updated = feature
        .set_global_fn_inversion(FnInversionState::Off)
        .await?;
    println!("new state={:?}", updated.state);
    Ok(())
}

On this page