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
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_capabilities | 0 | () | DisableableKeys |
get_disabled_keys | 1 | () | DisableableKeys |
set_disabled_keys | 2 | (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.
| Flag | Bit/Value | Description |
|---|---|---|
CAPS_LOCK | 1 << 0 | The Caps Lock key. |
NUM_LOCK | 1 << 1 | The Num Lock key. |
SCROLL_LOCK | 1 << 2 | The Scroll Lock key. |
INSERT | 1 << 3 | The Insert key. |
WINDOWS | 1 << 4 | The 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):
| Byte | Field | Notes |
|---|---|---|
| 0 | DisableableKeys bitmask | Bit 0 = CAPS_LOCK, bit 1 = NUM_LOCK, bit 2 = SCROLL_LOCK, bit 3 = INSERT, bit 4 = WINDOWS |
| 1–15 | — | Unused |
get_disabled_keys (fn 1)
Request: [0x00, 0x00, 0x00] — no parameters; all bytes are padding.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | DisableableKeys bitmask | Currently active disabled-key mask; same bit layout as above |
| 1–15 | — | Unused |
set_disabled_keys (fn 2)
Request: [keys, 0x00, 0x00]
| Byte | Source | Notes |
|---|---|---|
| 0 | keys.bits() | Full replacement mask; pass 0x00 to re-enable all keys |
| 1–2 | 0x00 | Padding |
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | DisableableKeys bitmask | Device echo of the accepted mask (may differ if some bits were rejected) |
| 1–15 | — | Unused |
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);
}