Skip to content

Add the UI-free core — device discovery, keycode catalog, layout geometry - #84

Merged
HaoboGu merged 2 commits into
fix/link-lifecycle-and-testsfrom
feat/device-picker-and-rynk-ui
Aug 3, 2026
Merged

Add the UI-free core — device discovery, keycode catalog, layout geometry#84
HaoboGu merged 2 commits into
fix/link-lifecycle-and-testsfrom
feat/device-picker-and-rynk-ui

Conversation

@HaoboGu

@HaoboGu HaoboGu commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

HaoboGu added 2 commits August 3, 2026 01:08
`DeviceDescriptor` restated five of `DeviceInfo`'s six fields, and every
transport filled one on connect: serial re-ran `available_ports()` to look up
the VID/PID it had just opened, and BLE read three Device Information Service
characteristics over the air. Nothing ever read the result — the store asks the
device itself once the handshake completes, and gets the firmware version with
it.

So the connect commands now answer with the session id alone, and
`ConnectResponse` goes with the struct.

`TransportInfo` gains a stable id per transport (port path / BLE id / socket
address) so a rescan can tell which entry is the live one, and `discover()` no
longer closes every session just to enumerate — that teardown belongs to
startup, where a reloaded frontend's stale session is what needs dropping.
`closeAllSessions` is exported for the caller that will do it.
None of this draws anything — it is what a keymap UI has to have underneath.

- `deviceStore` holds discovery: scan, connect, switch, disconnect, and the
  startup pass that drops sessions a reloaded frontend left holding the port.

- `keycatalog` answers "what can this key be bound to" from the firmware's own
  table, which `keycodeTables()` reads out of the wasm client. Families are
  matched by name rather than listed, so a keycode added upstream lands in its
  group by itself and anything unclaimed still reaches the user through `Other`.
  Against the current firmware that surfaced 48 codes the hand-written lists had
  missed, `Undo`/`Cut`/`Copy`/`Paste` among them.

- `layout` turns a decoded variant into an extent: a key counts by its turned
  outline, so a 1u key at 45° is √2 wide and sizing from `rect.w` would clip it.
  A firmware that ships no `[layout].map` gets the bare matrix from its
  capabilities, built as a real `Variant` so nothing downstream branches on it.

- `keycode` names actions the way a keymap reads them, `matrix` decodes the
  pressed bitmap, and the store gains `refreshMatrix` so a live view can poll
  the one thing topics never push.
@HaoboGu
HaoboGu force-pushed the feat/device-picker-and-rynk-ui branch from 565fe1c to 7c094cc Compare August 2, 2026 17:15
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@HaoboGu
HaoboGu merged commit 1aa5dc6 into main Aug 3, 2026
23 of 24 checks passed
@HaoboGu
HaoboGu deleted the feat/device-picker-and-rynk-ui branch August 3, 2026 16:20
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.

1 participant