Skip to content

BLE HID pairing #980

@mondalaci

Description

@mondalaci

BLE HID pairing already works to some extent. The pairing code appears on the OLED display, it's accepted/refused, and the relevant security keys are created on the settings partition.

However, the paired device should also be added to host connections, which is not trivial because it changes the user configuration, which should be updated by Agent.

  1. The firmware calculates new addresses by reading the pairing keys on the settings partition (which I believe are of the bt/keys/e89c2557115f0 format, but double-check it), and checking whether they're present in host connections.
  2. If there are new addresses, expose a new newBleAddressesPresent bit via getDeviceState's response.
  3. When Agent detects this bit, it'll call the newly added getNewBleAddresses getDeviceProperty command. The first response byte is the number of new BLE addresses, followed by the 6-byte addresses. Assuming a maximum 64-byte packet with a return status byte and a count byte, only 62 bytes are available for addresses, allowing up to 10 addresses, so maximize the number of addresses in 10. This process will naturally repeat for the rest of the addresses on the rare occasion of more unpaired addresses.
  4. Agent will display a yellow notification bar at the top containing "A new Bluetooth device has been paired to this UHK. Let's [add it to connections] so that you can switch to it." or its plural form "New Bluetooth devices have been paired to this UHK. Let's [add them to connections] so that you can switch to them."
  5. When clicking on the above [add[s] it/them to connections] link, Agent jumps to the connections screen, adds the new addresses to connection targets, and saves the configuration. The firmware should expose the updated values, making the notification bar disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions