Skip to content

bt-uart-test: unwind HCI resources and stop on failed identity reads - #225

Merged
derekross merged 3 commits into
derekross:mainfrom
Gr-linkk:bt-uart-diagnostic-cleanup
Nov 3, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
Gr-linkk:bt-uart-diagnostic-cleanup

Conversation

@Gr-linkk

Copy link
Copy Markdown
Contributor

Title: bt-uart-test: unwind HCI resources and stop on failed identity reads

The raw HCI diagnostic can leak resources during partial setup and report success after failed version/config reads. Use ExitStack to release acquired resources, attempt both power-down writes even if one fails, and report success only after cleanup. Close the tty if its termios setup fails and reject unsupported baud/negative delay before GPIO acquisition.

Preserves upstream's existing --wake BANK:LINE interface, including separate wake banks; this is diagnostic hardening, not Bluetooth driver or device enablement. Configurable loop rates from the original draft are deferred to keep this candidate focused.

Validation: mocked host regression for same/separate banks, acquisition/exchange/cleanup failures, each failed HCI command, invalid arguments, and tty setup failure; Python syntax, bash syntax, git diff --check and privacy inspection. Wired into tests/all; the full repository suite was not run. No phone access or hardware validation.

Independent read-only review found premature PASS reporting on cleanup failure; fixed and covered by injected cleanup failure. Existing firmware-download command lifecycle remains outside this scope.

Release partially acquired GPIO and tty resources, attempt both power-down writes, and report success only after cleanup. Validate inputs before hardware acquisition and cover failure paths with mocked host regressions.
@derekross

Copy link
Copy Markdown
Owner

Thanks, this is a tidy fix, and the mocked test covers the cleanup order on both bank layouts nicely. Small things: the if ver and len(ver) >= 9 and if cfg and … checks after the new guards are now always true and can go; please keep the old messages (the PERIC0 hint when the chip isn't found, which lines are requested, and "BT_REG_ON low, BT_DEV_WAKE low" on the way out), since they make the tool's output readable from a log; and mention in the header that a failed identity read is now a FAIL. #226 adds a line at the same spot in tests/all, so whichever lands second needs a quick rebase.

@derekross

Copy link
Copy Markdown
Owner

Thanks, Gr-linkk, all four points are in: the dead checks are gone, the PERIC0 hint, the line requests and the "low" message are back (in the same order as before), the header says a failed identity read is a FAIL, and tests/all merges cleanly with #226. I ran the new test locally and it passes. I'll squash it with a clean message. Merging.

@derekross
derekross merged commit 9d27cb6 into derekross:main Nov 3, 2026
2 checks passed
derekross added a commit to only21mil/omarchy-mobile that referenced this pull request Nov 3, 2026
latentoperator added a commit to latentoperator/omarchy-mobile that referenced this pull request Nov 13, 2026
Keep the USB-interface-pinned SSH reproduction in mobile tooling as requested in linux-omarchy-mobile derekross#225. The kernel selftest remains host-only; document what the transfer profile does and does not establish.

Assisted-by: LLM
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…erekross#225)

The raw HCI diagnostic could leak its GPIO lines and tty after a partial
setup, and reported PASS after a failed version or config read. It now
releases what it acquired (ExitStack), attempts both power-down writes
even if one fails, closes the tty when termios setup fails, checks the
baud rate and delays before taking any GPIO, and reports success only
after cleanup. A failed identity read is a FAIL. The pin sequence is the
same as before (BT_REG_ON low, BT_DEV_WAKE low); the PERIC0 hint and the
line-request messages are kept. Covered by a mocked host test; tests/all
skips *.py for bash -n.
latentoperator added a commit to latentoperator/omarchy-mobile that referenced this pull request Nov 14, 2026
Keep the USB-interface-pinned SSH reproduction in mobile tooling as requested in linux-omarchy-mobile derekross#225. The kernel selftest remains host-only; document what the transfer profile does and does not establish.

Assisted-by: LLM
latentoperator added a commit to latentoperator/omarchy-mobile that referenced this pull request Nov 14, 2026
Keep the USB-interface-pinned SSH reproduction in mobile tooling as requested in linux-omarchy-mobile derekross#225. The kernel selftest remains host-only; document what the transfer profile does and does not establish.

Assisted-by: LLM
latentoperator added a commit to latentoperator/omarchy-mobile that referenced this pull request Nov 14, 2026
Keep the USB-interface-pinned SSH reproduction in mobile tooling as requested in linux-omarchy-mobile derekross#225. The kernel selftest remains host-only; document what the transfer profile does and does not establish.

Assisted-by: LLM
derekross pushed a commit that referenced this pull request Nov 15, 2026
…ejay UPSTREAM status (#666)

The transfer profile behind linux-omarchy-mobile #225's aggregation-retry fix needs a phone, so it lives here and not in the kernel's selftests. Sixteen fresh `tools/phone-ssh` connections each pull 2 MiB of zeros from the phone, checked by size and SHA-256 under one 20 s deadline, with no retry and no write on the phone. A failure names the transfer and the check and shows ssh's stderr. `tests/ncm-transfer` runs it against a stand-in `ssh`. A pass shows that the link carried the transfers, not that the retry ran, and it covers neither laptop sleep nor a replug. Bluejay's UPSTREAM page is brought up to the November kernel revisions, none of which has booted on the phone, and it records that #346 stays passive.

Assisted-by: OpenAI Codex
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.

2 participants