Skip to content

feat(hid): recognise the MX Keys S Calculator key (CID 0x000a) - #1462

Closed
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/mx-keys-calculator-cid
Closed

4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/mx-keys-calculator-cid

Conversation

@4ni1ak

@4ni1ak 4ni1ak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • KEYBOARD_KEY_CIDS (crates/openlogi-device/src/session/keyboard.rs) had no entry for HID++ control 0x000a — Solaar's special_keys.py names it CONTROL.Calculator — so the Calculator key above the numpad on the MX Keys S was never diverted and stayed on its native AL_Calculator HID function, with no way to bind it to a custom action.
  • Adds ButtonId::KeyCalculator alongside its eight existing siblings in this family (KeySearch, KeyDictation, KeyEmoji, KeyScreenCapture, KeyMicMute, KeyPlayPause, KeyMute, KeyVolumeDown, KeyVolumeUp), following the exact same pattern each of those already uses.

Changes

  • crates/openlogi-core/src/binding/button.rs: new ButtonId::KeyCalculator variant, added to KEYBOARD_KEYS, with a label and translation key.
  • crates/openlogi-core/src/binding/defaults.rs: None default, matching every other key in this family (an unbound key is never diverted, so it stays on its native function until the user explicitly binds it).
  • crates/openlogi-device/src/session/keyboard.rs: (0x000a, ButtonId::KeyCalculator) added to KEYBOARD_KEY_CIDS, cross-checked against Solaar's special_keys.py. Added a unit test.
  • crates/openlogi-ui/locales/*.toml: added keyboard.calculator_key to all 23 catalogs at the same position (English text as placeholder for non-English locales, per this repo's i18n policy).

Scope note

Like the rest of this ButtonId family, there is currently no GUI editor surface for any of these nine keys — only config.toml/CLI can set a binding today. That's a pre-existing gap this PR doesn't introduce or attempt to close; it only extends the family this specific key belongs to, consistent with how its siblings already work.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace (40/40 suites green, including the new CID-table test)
  • cargo test -p openlogi-ui locale (catalog parity) and cargo test -p openlogi-desktop i18n (typed-key coverage, which iterates ButtonId::KEYBOARD_KEYS)
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent
  • Not runtime-tested on a real MX Keys S — I don't have the hardware. The CID is a direct, cross-checked application of Solaar's reference table, and the change follows the codebase's own established pattern for this exact key family.

Fixes #1147

KEYBOARD_KEY_CIDS had no entry for CID 0x000a — Solaar's
special_keys.py names it CONTROL.Calculator — so the Calculator key
above the numpad on the MX Keys S was never diverted and stayed on its
native AL_Calculator function, with no way to bind it to an action.

Adds ButtonId::KeyCalculator alongside its eight siblings in this
family (KeySearch, KeyDictation, ...): a label, a translation key (with
the matching locale entry in all 23 catalogs), a None default (an
unbound key is never diverted, same as its siblings), and the CID
table entry that arms it.

Like the rest of this ButtonId family, there is currently no GUI
editor surface for it — only config.toml/CLI can set a binding today.
That's a pre-existing gap shared by all nine keys, not something this
change introduces.

Fixes AprilNEA#1147
@4ni1ak
4ni1ak requested a review from AprilNEA as a code owner September 17, 2026 06:17
@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the new control is consistently represented, remains native until explicitly bound, and introduces no established compatibility regression.

Summary

Adds the MX Keys S Calculator key to the shared binding model and HID++ keyboard capture path.

  • Maps control CID 0x000a to ButtonId::KeyCalculator.
  • Keeps the key unbound and native by default.
  • Adds the label and translation key to every locale catalog.
  • Adds a focused assertion for the CID table entry.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Config binding for KeyCalculator] --> B{Action assigned?}
  B -->|No| C[Keep native AL_Calculator behavior]
  B -->|Yes| D[Select HID++ CID 0x000a]
  D --> E[Divert firmware control]
  E --> F[Map control event to KeyCalculator]
  F --> G[Dispatch configured action]
Loading

Reviews (1) · Last reviewed commit: "feat(hid): recognise the MX Keys S Calcu..."

@4ni1ak

4ni1ak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1247 — an existing external contributor PR doing the same thing (Calculator key CID 0x000a), opened before this one. Per project convention, contributor PRs are adopted (rebased, findings fixed) rather than superseded by a duplicate from us. Will rebase #1247 onto current master separately.

@4ni1ak 4ni1ak closed this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature / Bug]: MX Keys S: Calculator key (CID 0x000A) not captured/remappable on macOS

1 participant