Move RS-232 status under debug. Fix #2 from list.
This commit is contained in:
@@ -137,7 +137,7 @@ This is a semantic map, not a complete file inventory. Start here, then read the
|
|||||||
|
|
||||||
- Files: `src/board_pins.h`, `src/rs232_hw_test.{h,c}`, `src/local_ui_hw_test.{h,c}`, `src/status_led.{h,c}`
|
- Files: `src/board_pins.h`, `src/rs232_hw_test.{h,c}`, `src/local_ui_hw_test.{h,c}`, `src/status_led.{h,c}`
|
||||||
- Documentation: `docs/wiring.md`, `docs/electrical_tests.md`
|
- Documentation: `docs/wiring.md`, `docs/electrical_tests.md`
|
||||||
- Called by: startup and `debug`/`status` commands
|
- Called by: startup and `debug` commands
|
||||||
- Dependencies: physical RS-232 owner, serial/display services, ESP-IDF GPIO/UART/I2C/LED drivers
|
- Dependencies: physical RS-232 owner, serial/display services, ESP-IDF GPIO/UART/I2C/LED drivers
|
||||||
- Ownership: RS-232 diagnostics refuse to run while the service owns the port; display diagnostics reuse `local_display`.
|
- Ownership: RS-232 diagnostics refuse to run while the service owns the port; display diagnostics reuse `local_display`.
|
||||||
- Constraint: wiring and voltage assumptions are safety-relevant; verify target hardware before running diagnostics. RGB LED initialization is currently boot-fatal, and its colors report diagnostic state rather than aggregate firmware health.
|
- Constraint: wiring and voltage assumptions are safety-relevant; verify target hardware before running diagnostics. RGB LED initialization is currently boot-fatal, and its colors report diagnostic state rather than aggregate firmware health.
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ These observations should be checked when touching the relevant area; they are n
|
|||||||
|
|
||||||
## Active Task
|
## Active Task
|
||||||
|
|
||||||
- **Objective:** Prevent USB CDC host line coding from implicitly reconfiguring UART1 when USB becomes writer.
|
- **Objective:** Keep UART1 configuration independent of USB CDC host line coding and move the Phase 0 RS-232 signal status command under `debug`.
|
||||||
- **Relevant files:** `src/usb_cdc_transport.{c,h}`, `src/usb_console.c`, USB serial documentation.
|
- **Relevant files:** `src/usb_cdc_transport.{c,h}`, `src/usb_console.c`, `src/rs232_hw_test.c`, `src/console_completion.c`, related documentation.
|
||||||
- **Findings:** The transport converted cached CDC line coding into `serial_config_t` and called `serial_service_apply_config()` after writer acquisition. That deliberately stopped/restarted UART1 and changed its RAM configuration.
|
- **Findings:** The USB transport converted cached CDC line coding into `serial_config_t` and called `serial_service_apply_config()` after writer acquisition. Separately, root `status` was a Phase 0 diagnostic that needed to claim the RS-232 port and therefore failed while the production serial service owned it.
|
||||||
- **Decision:** Treat CDC line coding as diagnostic metadata only. UART1 configuration remains exclusively controlled by explicit `serial` commands and their NVS persistence.
|
- **Decision:** Treat CDC line coding as diagnostic metadata only. UART1 configuration remains exclusively controlled by explicit `serial` commands and their NVS persistence. Keep all Phase 0 RS-232 diagnostics, including signal status, under `debug`.
|
||||||
- **Changes completed:** Removed the pending line-coding apply path and its counters; retained the latest host setting for `usb status`; updated the contract documentation.
|
- **Changes completed:** Removed the pending line-coding apply path and its counters; retained the latest host setting for `usb status`. Replaced root `status` with `debug status`, updated completion and documentation.
|
||||||
- **Remaining work:** Target-hardware verification: acquire/release USB writer ownership after changing a host terminal's line coding and confirm UART1 remains at the configured framing.
|
- **Remaining work:** Target-hardware verification: acquire/release USB writer ownership after changing a host terminal's line coding and confirm UART1 remains at the configured framing. Verify `debug status` works after `serial stop` and root `status` is unknown.
|
||||||
- **Risks / things to remember:** Host terminal line-coding selectors no longer configure the physical RS-232 port; use `serial set`/`serial save` instead. `pio run` passed after the change.
|
- **Risks / things to remember:** Host terminal line-coding selectors no longer configure the physical RS-232 port; use `serial set`/`serial save` instead. `debug status` remains ownership-protected and requires UART1 to be stopped. `pio run` passed after both changes.
|
||||||
|
|
||||||
### Handoff template
|
### Handoff template
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ UART0 and authenticated `admin` SSH sessions use the same registered command imp
|
|||||||
|---|---|
|
|---|---|
|
||||||
| `memory` | Show free memory, minimum free memory, and largest blocks for internal RAM, DMA-capable RAM, and PSRAM. |
|
| `memory` | Show free memory, minimum free memory, and largest blocks for internal RAM, DMA-capable RAM, and PSRAM. |
|
||||||
| `reboot` | Drain console output briefly and restart the ESP32. |
|
| `reboot` | Drain console output briefly and restart the ESP32. |
|
||||||
| `status` | Show quick MAX3243 signal state. |
|
|
||||||
|
|
||||||
## Role-based users
|
## Role-based users
|
||||||
|
|
||||||
@@ -150,6 +149,7 @@ UART0 and admin SSH use shared whole-line Tab completion. A unique/common prefix
|
|||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
|
| `debug status` | Show MAX3243 driver, receiver, VLD, and shutdown states. It requires UART1 to be stopped. |
|
||||||
| `debug transceiver <enable|disable>` | Enable or shut down the MAX3243. |
|
| `debug transceiver <enable|disable>` | Enable or shut down the MAX3243. |
|
||||||
| `debug drivers <tx 0|1> <dtr 0|1> <rts 0|1>` | Drive static TX, DTR, and RTS logic levels for measurement. |
|
| `debug drivers <tx 0|1> <dtr 0|1> <rts 0|1>` | Drive static TX, DTR, and RTS logic levels for measurement. |
|
||||||
| `debug loopback-a` / `debug loopback-b` | Test MAX3243 driver/receiver loopback configurations. |
|
| `debug loopback-a` / `debug loopback-b` | Test MAX3243 driver/receiver loopback configurations. |
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ Each output should be negative. Exact voltages depend on supply, load, meter, an
|
|||||||
|
|
||||||
## Recommended order
|
## Recommended order
|
||||||
|
|
||||||
1. With no DE-9 jumpers, run `status`.
|
1. With no DE-9 jumpers and after `serial stop`, run `debug status`.
|
||||||
2. Measure output polarity with `debug drivers 0 0 0` and `debug drivers 1 1 1`.
|
2. Measure output polarity with `debug drivers 0 0 0` and `debug drivers 1 1 1`.
|
||||||
3. Power down, install configuration A, power up, and run `debug loopback-a`.
|
3. Power down, install configuration A, power up, and run `debug loopback-a`.
|
||||||
4. Run `debug valid-test` with configuration A still installed.
|
4. Run `debug valid-test` with configuration A still installed.
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ Implemented and hardware-validated:
|
|||||||
- Hardware CTS transmit gating and RTS receive-backpressure tests.
|
- Hardware CTS transmit gating and RTS receive-backpressure tests.
|
||||||
- Exclusive RS-232 port ownership and fault-safe cleanup.
|
- Exclusive RS-232 port ownership and fault-safe cleanup.
|
||||||
- RGB status indication for diagnostic state.
|
- RGB status indication for diagnostic state.
|
||||||
- Potentially disruptive tests isolated under the `debug` CLI submenu; top-level `status` retained.
|
- Phase 0 hardware diagnostics, including signal status, are isolated under the `debug` CLI submenu.
|
||||||
|
|
||||||
Detailed procedures are in [Electrical tests](electrical_tests.md) and [Hardware wiring](wiring.md).
|
Detailed procedures are in [Electrical tests](electrical_tests.md) and [Hardware wiring](wiring.md).
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Upgrade a device that already has working HTTPS/SSH credentials and no `user_db`
|
|||||||
2. Confirm exactly one `admin`-named account exists with role `user`, `bootstrapped=no`, no displayed password/salt/verifier, and no public keys.
|
2. Confirm exactly one `admin`-named account exists with role `user`, `bootstrapped=no`, no displayed password/salt/verifier, and no public keys.
|
||||||
3. Confirm the pre-upgrade credential still authenticates to HTTPS and SSH and that serial terminal behavior is unchanged.
|
3. Confirm the pre-upgrade credential still authenticates to HTTPS and SSH and that serial terminal behavior is unchanged.
|
||||||
4. Reboot and confirm `user status` reports the same account ID and authentication generation.
|
4. Reboot and confirm `user status` reports the same account ID and authentication generation.
|
||||||
5. Confirm routine boot logs, `status`, `web status`, and `ssh status` contain no user password, verifier, salt, or raw public-key blob.
|
5. Confirm routine boot logs, `web status`, and `ssh status` contain no user password, verifier, salt, or raw public-key blob.
|
||||||
|
|
||||||
A transient failure reading the legacy web credential must not create or commit an empty user database. If a valid `user_db` blob already exists, it must still load without the legacy credential being readable.
|
A transient failure reading the legacy web credential must not create or commit an empty user database. If a valid `user_db` blob already exists, it must still load without the legacy credential being readable.
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ Use one disposable `admin` and one disposable `user`. Keep UART0 attached throug
|
|||||||
### 1. Route separation and normal shells
|
### 1. Route separation and normal shells
|
||||||
|
|
||||||
1. Connect as the normal user and confirm the existing broker-backed UART1 serial stream, broker client, and writer/observer behavior are unchanged.
|
1. Connect as the normal user and confirm the existing broker-backed UART1 serial stream, broker client, and writer/observer behavior are unchanged.
|
||||||
2. Connect as the administrator and confirm the `admin@serial-tool>` prompt appears. Run `help`, `status`, `memory`, `serial status`, `wifi status`, `web status`, `broker status`, and `broker clients`. Compare representative output with UART0 and confirm both routes execute the same registered command implementations.
|
2. Connect as the administrator and confirm the `admin@serial-tool>` prompt appears. Run `help`, `memory`, `serial status`, `wifi status`, `web status`, `broker status`, and `broker clients`. Compare representative output with UART0 and confirm both routes execute the same registered command implementations.
|
||||||
3. From UART0 run `ssh sessions` and `broker clients`. The user session must show `route=broker`; the admin session must show `route=admin-console`, `broker=0`, `broker-role=n/a`, and no writer lease. The admin session must not start UART1 or alter broker client/writer counts merely by connecting.
|
3. From UART0 run `ssh sessions` and `broker clients`. The user session must show `route=broker`; the admin session must show `route=admin-console`, `broker=0`, `broker-role=n/a`, and no writer lease. The admin session must not start UART1 or alter broker client/writer counts merely by connecting.
|
||||||
|
|
||||||
### 2. Bounded command processing
|
### 2. Bounded command processing
|
||||||
|
|||||||
@@ -11,13 +11,14 @@
|
|||||||
#include "linenoise/linenoise.h"
|
#include "linenoise/linenoise.h"
|
||||||
|
|
||||||
static const char *const s_root_candidates[] = {
|
static const char *const s_root_candidates[] = {
|
||||||
"help", "status", "debug", "display", "serial", "broker", "usb", "user",
|
"help", "debug", "display", "serial", "broker", "usb", "user",
|
||||||
"wifi", "web", "ssh", "ping", "nslookup", "traceroute", "reboot", "memory",
|
"wifi", "web", "ssh", "ping", "nslookup", "traceroute", "reboot", "memory",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Keep full-line candidate strings grouped by their registered root command. */
|
/* Keep full-line candidate strings grouped by their registered root command. */
|
||||||
static const char *const s_completion_candidates[] = {
|
static const char *const s_completion_candidates[] = {
|
||||||
/* Hardware debug commands and safe fixed arguments. */
|
/* Hardware debug commands and safe fixed arguments. */
|
||||||
|
"debug status",
|
||||||
"debug transceiver",
|
"debug transceiver",
|
||||||
"debug transceiver enable",
|
"debug transceiver enable",
|
||||||
"debug transceiver disable",
|
"debug transceiver disable",
|
||||||
|
|||||||
+4
-7
@@ -1579,6 +1579,7 @@ DEFINE_OWNED_COMMAND(rts_flow_test)
|
|||||||
static void print_debug_usage(void)
|
static void print_debug_usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage:\n");
|
printf("Usage:\n");
|
||||||
|
printf(" debug status\n");
|
||||||
printf(" debug transceiver <enable|disable>\n");
|
printf(" debug transceiver <enable|disable>\n");
|
||||||
printf(" debug drivers <TX 0|1> <DTR 0|1> <RTS 0|1>\n");
|
printf(" debug drivers <TX 0|1> <DTR 0|1> <RTS 0|1>\n");
|
||||||
printf(" debug loopback-a|loopback-b|valid-test\n");
|
printf(" debug loopback-a|loopback-b|valid-test\n");
|
||||||
@@ -1595,6 +1596,9 @@ static int command_debug(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Existing handlers expect their own command name in argv[0]. */
|
/* Existing handlers expect their own command name in argv[0]. */
|
||||||
|
if (strcmp(argv[1], "status") == 0) {
|
||||||
|
return command_status(argc - 1, argv + 1);
|
||||||
|
}
|
||||||
if (strcmp(argv[1], "transceiver") == 0) {
|
if (strcmp(argv[1], "transceiver") == 0) {
|
||||||
return command_transceiver(argc - 1, argv + 1);
|
return command_transceiver(argc - 1, argv + 1);
|
||||||
}
|
}
|
||||||
@@ -1647,13 +1651,6 @@ esp_err_t rs232_hw_test_register_console_commands(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const esp_console_cmd_t commands[] = {
|
const esp_console_cmd_t commands[] = {
|
||||||
{
|
|
||||||
.command = "status",
|
|
||||||
.help = "Show MAX3243 driver, receiver, VLD, and shutdown states",
|
|
||||||
.hint = NULL,
|
|
||||||
.func = &command_status,
|
|
||||||
.argtable = NULL,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.command = "debug",
|
.command = "debug",
|
||||||
.help = "Low-level RS-232 and local-UI hardware diagnostics; run 'debug' for subcommands",
|
.help = "Low-level RS-232 and local-UI hardware diagnostics; run 'debug' for subcommands",
|
||||||
|
|||||||
Reference in New Issue
Block a user