Skip to content

install: bluetooth: Add dev script - #4017

Open
patrickelectric wants to merge 1 commit into
bluerobotics:masterfrom
patrickelectric:bt
Open

install: bluetooth: Add dev script#4017
patrickelectric wants to merge 1 commit into
bluerobotics:masterfrom
patrickelectric:bt

Conversation

@patrickelectric

Copy link
Copy Markdown
Member

Allow developers to connect via bluetooth to a terminal via serial

This is a helper scripts for developers that are testing and doing crazy stuff, it's not intended to be installed by default.

Allow developers to connect via bluetooth to a terminal via serial

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Adds install/bluetooth/setup-bluetooth-console.sh, a standalone host-side installer that pairs a BlueOS machine over Bluetooth RFCOMM/SPP and hands each connection an autologin console. It is explicitly labeled as a developer-only helper and is not wired into the default install flow.

1. Correctness & Implementation Bugs

  • 1.1 [minor] install/bluetooth/setup-bluetooth-console.sh:17BTD=$(command -v bluetoothd || echo /usr/libexec/bluetooth/bluetoothd) silently falls back to a hardcoded path when bluetoothd is not on PATH. If neither is present, bluetooth.service will fail to start after the drop-in is written (the compat.conf overrides ExecStart with a nonexistent binary), leaving the host without Bluetooth. Validate the fallback with [[ -x "$BTD" ]] and bail out with a clear error before writing the drop-in.
  • 1.2 [minor] install/bluetooth/setup-bluetooth-console.sh:43--autologin pi hardcodes the login user. On BlueOS hosts where the default user is not pi, agetty will loop failing to log in and rfcomm watch will respawn it forever. Either detect the user (e.g. from /etc/passwd/SUDO_USER) or accept it via env var, and document the assumption.
  • 1.3 [minor] install/bluetooth/setup-bluetooth-console.sh:14apt-get install runs without a preceding apt-get update. On a host with a stale package cache this fails with 404s and, under set -e, aborts the whole script. Other scripts under install/ (see install/network/avahi.sh) either update first or gate on already-installed packages.
  • 1.4 [minor] install/bluetooth/setup-bluetooth-console.sh:82sleep 1 after systemctl restart bluetooth is arbitrary. If the intent is to wait until the service is ready, prefer systemctl is-active --wait bluetooth or a short bounded poll.

3. Security

  • 3.5 [minor] install/bluetooth/setup-bluetooth-console.sh:8 — the documented install path (curl -fsSL … | sudo bash) pins to master. For a dev script that grants a passwordless shell (see 3.6) this is worth softening: recommend downloading and reviewing the script first, or pinning to a tag.
  • 3.6 [minor] install/bluetooth/setup-bluetooth-console.sh:32-35,43 — the resulting service is permanently discoverable/pairable, uses just-works pairing (NoInputNoOutput = auto-accepts, no PIN) and drops the pairer straight into an --autologin pi shell. Anyone within Bluetooth range of the vehicle can obtain an unprivileged shell without any authentication. Given this is a dev-only helper this is acceptable, but the file header should call it out in stronger terms than "just works, no PIN" — e.g. an explicit "WARNING: any Bluetooth device in range can pair without a PIN and get a passwordless shell as pi. Do not run on production/deployed vehicles." so future readers don't miss the tradeoff.

6. Code Quality & Style

  • 6.1 [nit] install/bluetooth/setup-bluetooth-console.sh:26-27ADAPTER=hci0 and CHANNEL=1 are hardcoded inside the generated launcher. Making them env-var overridable (ADAPTER="${ADAPTER:-hci0}") is trivial and matches the pattern in install/network/avahi.sh / install/install.sh.
  • 6.2 [nit] install/bluetooth/setup-bluetooth-console.sh:85systemctl enable blueos-bluetooth-console works, but the convention elsewhere is to use the fully qualified unit name (blueos-bluetooth-console.service).

8. Documentation

  • 8.1 [nit] install/bluetooth/setup-bluetooth-console.sh:98 — typo in the client-side usage comment: sudo scrren /dev/rfcomm0 115200 should be sudo screen /dev/rfcomm0 115200.

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

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