Bluetooth menu - #235
Open
sastraxi wants to merge 4 commits into
Open
Conversation
Pair, connect, and forget BLE-MIDI devices from the LCD. Reached from a "Bluetooth..." footer button on the Wi-Fi menu, shown only when the board has an adapter — Pi 3/4 hand the BT UART to DIN MIDI, so those users see no mention of it. modalapi/bluetooth/ mirrors modalapi/wifi/: a dbus-fast client owning an asyncio thread, an org.bluez.Agent1 (NoInputNoOutput — without a registered agent headless pairing cannot complete at all), stateless verbs, and a BluetoothManager driving the shared CommandQueue. Three findings from the hardware investigation shape the design: - BlueZ purges unpaired LE device objects the instant discovery stops, so discovery is held open for as long as the nearby list is on screen and Pair() is issued against a live object while it runs. Discovery is a start/stop pair, not a blocking scan like wifi's. - Trusting a device makes bluez auto-connect on sight, which then makes our own Pair() return InProgress. So: pair first, trust second, and treat InProgress as "wait for the running attempt", not a failure. - Some devices (the EV-1-WL) refuse bonding, so a plain Disconnect drops them back to unpaired. The root list is therefore the union of bluez's paired set and our own known-device store, and a known-but-absent row says "press its button" rather than "Disconnected". The menu also detects a bluetoothd running without -E and offers to install pistomp-bluetooth, rather than pairing into a void that produces no ALSA seq port. CommandQueue moves to common/ so bluetooth doesn't depend on wifi. Menu gains footer buttons and a real width parameter; max_width was dead code (its clamp reassigned the same hardcoded 240). Existing menus keep that width, the Bluetooth menu is wider. HID input (pistomp/hid_controller.py) is deliberately not in this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
sastraxi
commented
Aug 13, 2026
| - `Modhandler.poll_bluetooth()` next to `poll_wifi`, called from the `period % 200` | ||
| branch of `modalapistomp.py` | ||
|
|
||
| ## HID input |
Collaborator
Author
There was a problem hiding this comment.
Note that this has not been implemented. This is an exploration of how e.g. wireless presenters could be used to switch pedalboards / snapshots
sastraxi
commented
Aug 13, 2026
Comment on lines
+377
to
+387
| ### Not needed — do not carry these over | ||
|
|
||
| | `feat/bluetooth` change | Why not | | ||
| |---|---| | ||
| | `bluetooth-main.conf` (374 lines) | `main.conf` is a **dpkg conffile**; shipping a copy means owning it forever and taking a conffile conflict on every bluez upgrade. `-E` in the drop-in gets the same result with no ownership. | | ||
| | `BLUETOOTH_ENABLED` in `pistomp.conf` | The menu owns enable/disable at runtime. The flag is also first-boot-only, so it silently does nothing when edited later — a trap, not a feature. | | ||
| | `firstboot.sh` conditional enable/disable | Falls out with the flag. | | ||
| | `rfkill` package (+ the `00-packages-nr` comment) | The drop-in's `ExecStartPre` unblocks via sysfs, keyed on `type` = `bluetooth` so it doesn't depend on the rfkill index. | | ||
| | separate `bluetooth-rfkill-unblock.conf` | Folded into the single drop-in. | | ||
| | anything touching `hciuart.service` | `pi-bluetooth` is not installed, so the unit does not exist and the call is a no-op swallowed by `|| true`. Pi 5 attaches BT over serdev (`hci_uart` + `btbcm`, `hci0 Bus: UART`). | | ||
| | `debpkgs/mod-ui/debian/changelog` | Unrelated (session recording) — it rode along on the branch. | |
Collaborator
Author
There was a problem hiding this comment.
Comparison with previous BT draft impl
rreichenbach
approved these changes
Aug 18, 2026
rreichenbach
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. Didn't actually try it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a bluetooth sub-menu inside of the Wi-Fi menu (now renamed Wi-Fi & Devices).
Requires the pistomp-bluetooth package (see TreeFallSound/pi-gen-pistomp#40). Alternatively, manually unblock via
rfkilland add the-Ebluetooth daemon option.Author checklist