Make BLE pairing work on macOS, allow daemon + HID to coexist
macOS Bluetooth quirks made the original BLE setup unusable from a Mac
host. Five focused changes to fix discovery, pairing, the keyboard
identification wizard, and concurrent connections, plus a couple of
cross-platform daemon/script niceties.
Firmware (ble.cpp):
* Advertise the standard HID Service UUID (0x1812) in the primary
packet. Without it, macOS Sequoia's Bluetooth Settings GUI
recognizes the device internally but silently hides it from the
"Nearby Devices" list. Service UUIDs >16-bit overflow the 31-byte
advertising packet, so the custom data-service UUID moved to the
scan response.
* Switch PnP ID from Apple's USB vendor (0x05AC + Magic Keyboard
PID 0x820A) to Espressif's BT SIG vendor (0x02E5). macOS validates
Apple-claimed HIDs against known device IDs and refuses to surface
a Connect button for spoofers.
* Add the LED output report (Num/Caps/Scroll Lock) to the HID
descriptor — macOS treats a keyboard descriptor without LEDs as
"incomplete" and triggers the Keyboard Setup Assistant repeatedly.
* Set HID country code to 33 (US ANSI) instead of 0 (Not Supported)
so macOS can identify the layout without asking the user.
* Bump CONFIG_BT_NIMBLE_MAX_CONNECTIONS to 2 and restart advertising
after each accept. macOS holds one connection for the HID keyboard
link; the daemon now gets its own slot for the data service in
parallel, instead of either side starving the other.
screenshot.sh: auto-pick /dev/cu.usbmodem101 on macOS vs /dev/ttyACM0
on Linux, fall back to PlatformIO's bundled Python if pyserial isn't
on the system Python (PEP 668 blocks `pip install` on Homebrew Python),
and pass the actual framebuffer dimensions to ffmpeg instead of
hardcoding 480x480.
daemon/claude_usage_daemon.py: log API HTTP status + response body on
4xx/5xx so silent token-expiry failures (the daemon was reporting
{"s":0,"w":0} payloads instead of surfacing a 401) are visible in the
daemon log.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
e3709b66e7
commit
f252a871c4
@@ -11,12 +11,14 @@ build_flags =
|
||||
-DBOARD_HAS_PSRAM
|
||||
; AXP2101 PMU
|
||||
-DXPOWERS_CHIP_AXP2101
|
||||
; NimBLE config — peripheral-only, single connection
|
||||
; NimBLE config — peripheral, 2 simultaneous connections so the OS can
|
||||
; hold the HID link (Space key from BOOT button) while the daemon holds
|
||||
; its own connection for the custom data service.
|
||||
-DCONFIG_BT_NIMBLE_ROLE_BROADCASTER=1
|
||||
-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL=1
|
||||
-DCONFIG_BT_NIMBLE_ROLE_CENTRAL=0
|
||||
-DCONFIG_BT_NIMBLE_ROLE_OBSERVER=0
|
||||
-DCONFIG_BT_NIMBLE_MAX_CONNECTIONS=1
|
||||
-DCONFIG_BT_NIMBLE_MAX_CONNECTIONS=2
|
||||
; LVGL config via build flags
|
||||
-DLV_CONF_SKIP
|
||||
-DLV_COLOR_DEPTH=16
|
||||
|
||||
Reference in New Issue
Block a user