OpenLogi

0x4521 · disableKeys

Selectively disable a fixed set of lock and system keys — query device capabilities, read the active disabled-key mask, and atomically replace it.

Disables a fixed set of lock and system keys. getCapabilities returns the DisableableKeys bitmask of keys the device allows software to control. getDisabledKeys reads the currently active mask; setDisabledKeys replaces it atomically and echoes the accepted value back; passing an empty mask re-enables every key. The device rejects any key flag it cannot disable.

The five controllable keys are:

  • CAPS_LOCK — Caps Lock.
  • NUM_LOCK — Num Lock.
  • SCROLL_LOCK — Scroll Lock.
  • INSERT — Insert.
  • WINDOWS — Windows / Start key.

For disabling arbitrary keys by HID usage, see 0x4522 disableKeysByUsage.

Spec: Logitech HID++ 2.0 — disableKeys. Used by: Typed wrapper in openlogi-hidpp.

Function reference

The DisableKeysFeature wrapper (0x4521) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_capabilities0()DisableableKeys
get_disabled_keys1()DisableableKeys
set_disabled_keys2(keys: DisableableKeys)DisableableKeys

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

Types

DisableableKeys

The set of keys a DisableKeysFeature device can disable. Used both for the device's capabilities and for the currently disabled keys.

FlagBit/ValueDescription
CAPS_LOCK1 << 0The Caps Lock key.
NUM_LOCK1 << 1The Num Lock key.
SCROLL_LOCK1 << 2The Scroll Lock key.
INSERT1 << 3The Insert key.
WINDOWS1 << 4The Windows / Start key.

Wire format

All three functions carry a short 3-byte request payload and return a 16-byte long-payload response. Only the first response byte is meaningful in every case.

get_capabilities (fn 0)

Request: [0x00, 0x00, 0x00] — no parameters; all bytes are padding.

Response (byte → field):

ByteFieldNotes
0DisableableKeys bitmaskBit 0 = CAPS_LOCK, bit 1 = NUM_LOCK, bit 2 = SCROLL_LOCK, bit 3 = INSERT, bit 4 = WINDOWS
1–15Unused

get_disabled_keys (fn 1)

Request: [0x00, 0x00, 0x00] — no parameters; all bytes are padding.

Response (byte → field):

ByteFieldNotes
0DisableableKeys bitmaskCurrently active disabled-key mask; same bit layout as above
1–15Unused

set_disabled_keys (fn 2)

Request: [keys, 0x00, 0x00]

ByteSourceNotes
0keys.bits()Full replacement mask; pass 0x00 to re-enable all keys
1–20x00Padding

Response (byte → field):

ByteFieldNotes
0DisableableKeys bitmaskDevice echo of the accepted mask (may differ if some bits were rejected)
1–15Unused

Usage (Rust)

use hidpp::{device::Device, feature::disable_keys::{DisableKeysFeature, DisableableKeys}};

// mut device: Device, obtained via Device::new(arc_channel, device_index).await?
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<DisableKeysFeature>() {
    // Query which keys this device can disable
    let caps = feat.get_capabilities().await?;
    println!("Disableable keys: {:?}", caps);

    // Disable Caps Lock and the Windows key
    let mask = DisableableKeys::CAPS_LOCK | DisableableKeys::WINDOWS;
    let accepted = feat.set_disabled_keys(mask).await?;
    println!("Accepted mask: {:?}", accepted);

    // Read back the current state
    let current = feat.get_disabled_keys().await?;
    println!("Currently disabled: {:?}", current);
}

On this page