Fix Linux UART baud selection on cold boot #11

Merged
piotr merged 1 commits from issue-10-uart2-race into main 2026-10-01 15:35:03 +02:00
Collaborator

Closes #10

Summary

  • select B115200 through Linux CBAUD bits before TCSETS
  • read termios back and fail closed unless the effective baud remains 115200
  • preserve existing raw mode, CS8/CREAD/CLOCAL, VMIN/VTIME, UART paths, and framing

Validation

  • focused baud transformation and readback tests
  • git diff --check
  • added-lines secret/security scan
  • gofmt -l .
  • go vet ./...
  • go test ./...
  • Linux/arm64 release builds for groundstation and groundstation-display

Piotr will perform the Orange Pi cold-boot acceptance after review: stty -F /dev/ttyS2 -a must report 115200 and valid GS traffic must arrive without manual recovery.

Closes #10 ## Summary - select `B115200` through Linux `CBAUD` bits before `TCSETS` - read termios back and fail closed unless the effective baud remains 115200 - preserve existing raw mode, CS8/CREAD/CLOCAL, VMIN/VTIME, UART paths, and framing ## Validation - focused baud transformation and readback tests - `git diff --check` - added-lines secret/security scan - `gofmt -l .` - `go vet ./...` - `go test ./...` - Linux/arm64 release builds for groundstation and groundstation-display Piotr will perform the Orange Pi cold-boot acceptance after review: `stty -F /dev/ttyS2 -a` must report 115200 and valid GS traffic must arrive without manual recovery.
grzesiu self-assigned this 2026-10-01 15:27:35 +02:00
grzesiu added 1 commit 2026-10-01 15:27:35 +02:00
Collaborator

Review: approved in principle — no code blockers

Reviewed PR-only commit d3bc369 against base b169a64.

The fix correctly addresses the confirmed cold-boot defect: Linux TCSETS takes the line speed from Cflag & CBAUD, not from Ispeed/Ospeed alone. The change clears inherited speed bits, selects B115200, and verifies the kernel-accepted CBAUD value by reading termios back.

Validation performed:

gofmt                         PASS
go test ./internal/serialport PASS
go test ./...                 PASS
go vet ./...                  PASS
linux/arm64 supervisor build  PASS
linux/arm64 display build     PASS

The regression test directly starts from inherited B9600, which matches the observed Orange Pi failure.

Hardware acceptance is intentionally left to Piotr — Grzesiu has no physical Orange Pi access. After artifact deployment and cold boot, Piotr should verify:

stty -F /dev/ttyS2 -a       # expected: speed 115200 baud
systemctl status groundstation --no-pager

and then confirm valid GX12 frames/video control without manual stty.

## Review: approved in principle — no code blockers Reviewed PR-only commit `d3bc369` against base `b169a64`. The fix correctly addresses the confirmed cold-boot defect: Linux `TCSETS` takes the line speed from `Cflag & CBAUD`, not from `Ispeed`/`Ospeed` alone. The change clears inherited speed bits, selects `B115200`, and verifies the kernel-accepted `CBAUD` value by reading termios back. Validation performed: ```text gofmt PASS go test ./internal/serialport PASS go test ./... PASS go vet ./... PASS linux/arm64 supervisor build PASS linux/arm64 display build PASS ``` The regression test directly starts from inherited `B9600`, which matches the observed Orange Pi failure. Hardware acceptance is intentionally left to Piotr — Grzesiu has no physical Orange Pi access. After artifact deployment and cold boot, Piotr should verify: ```sh stty -F /dev/ttyS2 -a # expected: speed 115200 baud systemctl status groundstation --no-pager ``` and then confirm valid GX12 frames/video control without manual `stty`.
piotr merged commit d3bc369164 into main 2026-10-01 15:35:03 +02:00
piotr deleted branch issue-10-uart2-race 2026-10-01 15:35:03 +02:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: piotr/groundstation#11