garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

cartopolis-agent · 2026-11-30T16:44:52Z

docs: a Bluetooth keyboard pairs by passkey and types
README.md       | 4 ++--
 docs/roadmap.md | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index de6fdda..45937d8 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ timer off; a task alone on its core runs undisturbed.
 | `tls` | TLS 1.3: certificates checked against Mozilla's roots (`certificates/`), the client as a state machine with no I/O of its own; a small server for tests and demos |
 | `tz` | Time zones: IANA's TZif files (`zoneinfo/`) read, local time and summer time from them, the civil calendar |
 | `media` | The call codecs: a block DCT video codec and IMA ADPCM audio |
-| `bt` | Bluetooth Low Energy, as pure state machines: HCI over H4, L2CAP, ATT, GATT as client and server, pairing by LE Secure Connections (numbers compared on both screens) and the link encrypted, paired devices remembered; a simulated controller and the air between several, for tests and for QEMU |
+| `bt` | Bluetooth Low Energy, as pure state machines: HCI over H4, L2CAP, ATT, GATT as client and server, pairing by LE Secure Connections (numbers compared on both screens, or a passkey shown and typed on a keyboard) and the link encrypted, paired devices remembered, a paired keyboard read over HID over GATT; a simulated controller and the air between several, for tests and for QEMU |
 | `modem` | The cellular modem, for ordinary phone calls when a contact cannot be reached peer to peer: AT commands as a pure state machine (the SIM and its PIN, the network, dialling, answering, who calls); a simulated modem and the network between several, for tests and for QEMU |
 | `wifi` | Wi-Fi: the networks nearby and joining one, as a pure state machine over the AT commands of a radio on a UART (ESP-AT: scan, join with a password, leave, a network lost); a simulated radio and the access points around it, for tests and for QEMU |
 | `disk` | What a whole disk holds around the file system: a GPT partition table, and the FAT32 boot partition UEFI starts from; shared by the kernel's installer and `xtask` |
@@ -73,7 +73,7 @@ cargo xtask contacts-demo              # the address book: write, keep, export,
 cargo xtask files-demo                 # Files: notes found in Notes' folder, one opened and moved, one deleted
 cargo xtask notices-demo               # past notifications: two texts, their list, one opened from it, cleared
 cargo xtask network-demo               # Settings' network page: online, switched off, on again
-cargo xtask bluetooth-demo             # the devices around, one paired, then found again after it moved its address
+cargo xtask bluetooth-demo             # the devices around, one paired, found again after it moved its address; a keyboard paired by a code, typing in Notes
 cargo xtask pinebook-demo              # a Pinebook Pro's input only: the password typed, Settings clicked open, on USB 1.1 (OHCI)
 cargo xtask access-demo                # five scripts, Settings in Dutch, larger text, high contrast, the screen reader
 cargo xtask sound-demo                 # the volume kept at a restart, Settings' slider moved, its tone as loud as it says
diff --git a/docs/roadmap.md b/docs/roadmap.md
index cf664b4..a63023d 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -67,7 +67,8 @@ What is still missing for daily use, and the projects it will take, is in
 | Listening TCP sockets for programs (LISTEN_TCP: each accepted connection arrives as a channel); the self-check is knocked on from the host through QEMU's forwarded port | Done |
 | Display behind a virtio-gpu (2D): the framebuffer a resource the device scans out, every changed rectangle sent across (`FLUSH_SCREEN` from the display server), the screen's size from the device; ramfb kept for a QEMU without the module | Done (3D, virgl, needs a host GPU: later) |
 | Bluetooth Low Energy, own stack (`bt`): HCI over H4, L2CAP, ATT, GATT as client and server, as pure state machines; a simulated controller and air (`bt::sim`) for tests and for QEMU, whose serial port `cargo xtask` holds the other end of; the `bt` service advertises this device and serves its contact card; the Bluetooth app lists devices, reads what they tell, adds a Pinnacle nearby as a contact | Done (BR/EDR and audio over Bluetooth later; a board's controller over its UART) |
-| Pairing a Bluetooth device securely (`bt::smp`): LE Secure Connections, P-256 Diffie-Hellman, a six-digit number compared on both screens where both have one ("just works" with a device that has none, its side asked whether it may), the controller encrypting the link with the key agreed; each device paired with kept in the vault (`data:/bt/bonds`) and its link encrypted again on every connection with no question, identities handed over as they pair (each side's identity resolving key and fixed address), so a phone or watch that moves to a new private address is still the paired one, found and encrypted again with no new pairing (`cargo xtask bluetooth-demo`, s933); paired devices first in the Bluetooth app whether nearby or not, Forget dropping one; a pairing asked by a device nearby while no app is open becomes a notification; the simulated air encrypts as a controller does (AES-CCM) and keeps what a listener hears, so the tests check nothing written after pairing crosses in the clear; the self-check pairs with the air's Pinnacle | Done (no legacy pairing, refused as unsafe; no passkey typed, so keyboards do not pair yet; Pinnacle itself keeps its public address rather than moving to private ones; GATT does not yet refuse unencrypted reads of what should be private; the P-256 multiplication is not constant time; tried only against the simulated air, not a real controller or phone) |
+| Pairing a Bluetooth device securely (`bt::smp`): LE Secure Connections, P-256 Diffie-Hellman, a six-digit number compared on both screens where both have one ("just works" with a device that has none, its side asked whether it may), the controller encrypting the link with the key agreed; each device paired with kept in the vault (`data:/bt/bonds`) and its link encrypted again on every connection with no question, identities handed over as they pair (each side's identity resolving key and fixed address), so a phone or watch that moves to a new private address is still the paired one, found and encrypted again with no new pairing (`cargo xtask bluetooth-demo`, s933); paired devices first in the Bluetooth app whether nearby or not, Forget dropping one; a pairing asked by a device nearby while no app is open becomes a notification; the simulated air encrypts as a controller does (AES-CCM) and keeps what a listener hears, so the tests check nothing written after pairing crosses in the clear; the self-check pairs with the air's Pinnacle | Done (no legacy pairing, refused as unsafe; Pinnacle itself keeps its public address rather than moving to private ones; GATT does not yet refuse unencrypted reads of what should be private; the P-256 multiplication is not constant time; tried only against the simulated air, not a real controller or phone) |
+| Pairing a Bluetooth keyboard by passkey (`bt::smp`, `bt::hogp`): a keyboard pairs by a six-digit code the Bluetooth app shows and the person types on it, then Enter, LE Secure Connections' passkey entry, twenty rounds each proving a bit of it, as safe against a device in the middle as compared numbers (either side showing, or both typing, as the spec's table has it); once paired and its link encrypted, the `bt` service asks it for the boot protocol over HID over GATT and its keys go to the display server, on a channel the display server gave it at start, as a USB keyboard's do (`pinnacle_hid::Keyboard` reads the report for both); it stays connected when the app goes back, and a device never paired cannot type (`cargo xtask bluetooth-demo`, s940) | Done in QEMU (the boot protocol only: no media keys, no lights, no report map read; a paired keyboard types again only once opened in Bluetooth, not by itself when it comes back in range; this device never types a code itself, pairing as a screen with buttons; tried only against the simulated air's keyboard) |
 | Ending programs: SPAWN gives a handle that can end the program (KILL); the status bar's close button ends the app in front | Done |
 | Real hardware, step 1: the screen a bootloader left lit, drawn on (`drivers::scanout`): a `simple-framebuffer` in the device tree, else on an RK3399 the VOP's first window read from its registers (only with its clocks on); the loader's reserved memory (the header's block, `/reserved-memory`) kept from the allocator; `cargo xtask test` boots once as such a loader leaves QEMU, `cargo xtask lit-shot` photographs that screen | Done in QEMU (which boards' loaders leave a lit screen needs a board: a Pinebook Pro's Tow-Boot leaves its panel lit) |
 | A PC's and a laptop's own hardware, on PCI (`hardware.md`): USB through an xHCI controller (`drivers/usb`), each device on a root port addressed and configured, plugged in and pulled out at any time, followed by a kernel task; keyboards by the boot protocol (keys as the virtio keyboard's), mice, tablets and touch screens by their report descriptors; sticks and disks by Bulk-Only Transport and SCSI. Disks behind NVMe (`nvme`) and AHCI (`ahci`, SATA), each a `Controller` under the block layer's cache as virtio-blk is; interrupts by MSI-X or MSI on a PC, INTx on ARM, every driver on a shared line asked. `cargo xtask test` and `pc` give QEMU all of them; the self-check writes a block on each disk and puts it back | Done in QEMU on both architectures (no isochronous transfers or USB 3 streams; one NVMe I/O queue; no SD/eMMC, which waits for the first device) |