Add Transport-Neutral Serial Session Broker

This commit is contained in:
2026-08-23 00:01:50 +02:00
parent 535c27350d
commit 2524f43fac
11 changed files with 1407 additions and 102 deletions
+46 -9
View File
@@ -209,9 +209,9 @@ Each output should be at a negative RS-232 voltage. Exact values vary with suppl
RTS and CTS remain ordinary GPIO signals during static and basic UART loopback tests. Only the two dedicated flow-control commands hand them to UART peripherals. Every test shuts the MAX3243 down while changing GPIO-matrix routing and restores all outputs to static logic 1 afterward.
## Phase 1 UART-service loopback
## Phase 2 broker loopback
The Phase 1 service can be checked independently of the Phase 0 UART test implementation. Disconnect external peers, power down, remove all previous jumpers, and connect only:
The Phase 2 broker can be checked independently of the Phase 0 UART test implementation. Disconnect external peers, power down, remove all previous jumpers, and connect only:
```text
DE-9 pin 3 TX -> pin 2 RX
@@ -222,19 +222,56 @@ Power up and use the default 115200 8N1 configuration:
```text
serial status
serial start
serial send-hex 0055aaff1b5b33316d
serial read 64
serial counters
serial stop
broker connect writer
broker connect observer
broker clients
```
The read should return the exact bytes:
On a fresh boot the returned IDs are normally 8 and 9, but always use the IDs printed by your device. In the commands below, substitute those values if they differ:
```text
Read 9 bytes: 0055aaff1b5b33316d
broker request-writer 8
broker send-hex 8 0055aaff1b5b33316d
broker read 8 64
broker read 9 64
```
If the first read occurs before UART1 has returned the bytes, it may report zero; run `serial read 64` again. Counters should show nine received, queued, and sent-to-UART bytes with no dropped bytes or UART errors. `serial stop` must return the RS-232 port owner to `idle`, after which Phase 0 commands are available again.
Both clients are observers, including the active writer, so both reads should return the exact nine bytes:
```text
Client 8 read 9 bytes: 0055aaff1b5b33316d
Client 9 read 9 bytes: 0055aaff1b5b33316d
```
If a read occurs before UART1 has returned the bytes, it may report zero; run it again. Next verify writer exclusion and forced reassignment:
```text
broker request-writer 9
broker send-hex 9 dead
broker force-writer 9
broker send-hex 9 112233
broker read 8 64
broker read 9 64
broker events 8
broker events 9
broker counters
```
The competing writer request and pre-reassignment send are expected to fail. After forced reassignment, both clients must receive `112233`. Events should describe the denied request, revocation of client 8, and grant to client 9, with the forced-change events reporting final writer 9.
Clean up in this order:
```text
broker disconnect 9
broker events 8
broker disconnect 8
broker status
serial counters
serial stop
serial status
```
Disconnecting client 9 automatically releases its writer lease. Client 8 receives the corresponding release and disconnect events; draining them before its own disconnect avoids intentionally counting them as discarded events. After the final disconnect, the broker should report zero clients and writer 0. `serial stop` must return the RS-232 port owner to `idle`, after which Phase 0 commands are available again.
Remove the loopback jumper with power off before connecting an external serial peer.