Add Network Tools And Nested Command Completion
This commit is contained in:
@@ -66,7 +66,9 @@ pio run --target upload
|
||||
pio device monitor -b 115200
|
||||
```
|
||||
|
||||
The firmware starts an interactive console on UART0 with the prompt `serial-tool>`. Type `help` to display command descriptions. This USB-to-UART device normally appears as `/dev/ttyUSB*`; it is separate from the native USB CDC serial transport described below.
|
||||
The firmware starts an interactive console on UART0 with the prompt `serial-tool>`. Type `help` to display concise root-command descriptions. This USB-to-UART device normally appears as `/dev/ttyUSB*`; it is separate from the native USB CDC serial transport described below.
|
||||
|
||||
The console provides line editing, history for the current session, terminal-aware cursor movement, and Tab completion. ESP-IDF supplies completion for root commands; the project extends it to nested `debug`, `serial`, `broker`, `usb`, and `wifi` subcommands plus safe fixed values such as AP policy and serial framing. Password values are intentionally never completion candidates.
|
||||
|
||||
### Phase 1 serial service
|
||||
|
||||
@@ -137,6 +139,8 @@ The ESP32-S3's native USB OTG peripheral presents one CDC-ACM serial interface t
|
||||
The UART0 development console provides these diagnostics and controls:
|
||||
|
||||
```text
|
||||
usb
|
||||
usb help
|
||||
usb status
|
||||
usb counters
|
||||
usb clear-counters
|
||||
@@ -144,6 +148,8 @@ usb request-writer
|
||||
usb release-writer
|
||||
```
|
||||
|
||||
Both `usb` and `usb help` print the same multi-line command summary and return successfully; runtime state is shown explicitly with `usb status`.
|
||||
|
||||
Opening the CDC port with DTR asserted automatically starts UART1, connects a broker client named `usb-cdc`, and requests the writer lease. If another client already owns the lease, USB remains connected as a read-only observer; `usb status` reports its current role. Closing the port or unplugging native USB disconnects that broker client and discards transport-local pending data. The serial service itself remains running until it is stopped explicitly with `serial stop`.
|
||||
|
||||
The data path is binary-transparent. UTF-8 bytes, NUL bytes, terminal escape sequences, and color sequences are passed unchanged; interpretation remains the terminal application's responsibility. USB output is bounded and nonblocking, so a host that stops reading can lose only its own observer data rather than stall UART1 or another client.
|
||||
@@ -219,8 +225,13 @@ wifi ap channel <1..11>
|
||||
wifi ap secret|show-secret
|
||||
wifi save|load|defaults|reset
|
||||
wifi counters|clear-counters
|
||||
wifi ping <host> [count]
|
||||
wifi nslookup <host>
|
||||
wifi traceroute <host> [max-hops]
|
||||
```
|
||||
|
||||
The network diagnostics are also registered as root aliases, so `ping`, `nslookup`, and `traceroute` are equivalent to their `wifi`-prefixed forms. `ping` accepts 1–20 probes and supports IPv4 or IPv6. `nslookup` prints unique numeric IPv4/IPv6 results. `traceroute` is currently IPv4-only, sends one ICMP Echo probe per hop, accepts 1–30 hops, and uses a one-second timeout per hop; routers that suppress ICMP replies appear as `*`.
|
||||
|
||||
Ordinary status and profile output never displays passwords. `wifi profile secret` and `wifi ap secret` read through a dedicated no-echo UART0 prompt, keeping credentials out of the command line and its history. SSIDs containing spaces can be quoted. Profile and AP edits apply to the working RAM configuration and restart Wi-Fi asynchronously if it is running; use `wifi save` explicitly to persist them. `wifi start` and `wifi stop` also change the working `enabled-at-boot` setting, which becomes persistent only after `wifi save`.
|
||||
|
||||
A typical station setup is:
|
||||
@@ -241,7 +252,7 @@ Wi-Fi credentials currently reside as plaintext in the application-owned `wifi_a
|
||||
#### Wi-Fi validation
|
||||
|
||||
1. Boot with no station profiles. `wifi status` should report `ap-only`, and the generated SSID should be visible from another device.
|
||||
2. Use `wifi ap show-secret`, join the AP, confirm a `192.168.4.x` lease, and ping `192.168.4.1`. No web page is expected yet.
|
||||
2. Use `wifi ap show-secret`, join the AP, confirm a `192.168.4.x` lease, and run `wifi ping 192.168.4.1`. No web page is expected yet.
|
||||
3. Configure and enable a WPA2/WPA3 station profile using the example above. `wifi status` should progress through `connecting`, `waiting-ip`, and `online` and display the acquired address, channel, RSSI, and negotiated authentication.
|
||||
4. Reboot and verify profile and AP credential persistence.
|
||||
5. Configure two profiles with different priorities, make the first unavailable, and verify failover to the second after its timeout.
|
||||
@@ -252,22 +263,22 @@ Wi-Fi credentials currently reside as plaintext in the application-owned `wifi_a
|
||||
|
||||
### Phase 0 diagnostics
|
||||
|
||||
The retained hardware-characterization commands are:
|
||||
The top-level `status` command retains quick MAX3243 signal-state inspection. Potentially disruptive hardware-characterization operations are grouped below `debug` so the primary help page stays concise:
|
||||
|
||||
```text
|
||||
status
|
||||
transceiver <enable|disable>
|
||||
drivers <tx 0|1> <dtr 0|1> <rts 0|1>
|
||||
loopback-a
|
||||
loopback-b
|
||||
valid-test
|
||||
uart-loopback <baud> [8N1|8E1|8O1|8N2|7E1|7O1] [bytes]
|
||||
uart-suite
|
||||
cts-flow-test
|
||||
rts-flow-test
|
||||
debug transceiver <enable|disable>
|
||||
debug drivers <tx 0|1> <dtr 0|1> <rts 0|1>
|
||||
debug loopback-a
|
||||
debug loopback-b
|
||||
debug valid-test
|
||||
debug uart-loopback <baud> [8N1|8E1|8O1|8N2|7E1|7O1] [bytes]
|
||||
debug uart-suite
|
||||
debug cts-flow-test
|
||||
debug rts-flow-test
|
||||
```
|
||||
|
||||
`uart-loopback` defaults to `8N1` and 256 bytes. Its accepted payload range is 1–512 bytes. `uart-suite` covers 300 through 250000 baud and all supported frame formats. `cts-flow-test` verifies transmit gating and exact resumption, while `rts-flow-test` uses UART2 as an internal traffic generator to verify automatic receive backpressure. Follow the command-specific loopback wiring in [`wiring.md`](wiring.md) before invoking any test.
|
||||
Run `debug` without a subcommand for its usage summary. `debug uart-loopback` defaults to `8N1` and 256 bytes. Its accepted payload range is 1–512 bytes. `debug uart-suite` covers 300 through 250000 baud and all supported frame formats. `debug cts-flow-test` verifies transmit gating and exact resumption, while `debug rts-flow-test` uses UART2 as an internal traffic generator to verify automatic receive backpressure. Follow the command-specific loopback wiring in [`wiring.md`](wiring.md) before invoking any test.
|
||||
|
||||
A mutex-protected port lease prevents diagnostics, UART1 service startup, and future clients from reconfiguring the same GPIOs concurrently. If a UART driver cannot be removed during cleanup, the firmware keeps the MAX3243 shut down and marks the port faulted until reboot rather than exposing an ambiguous hardware state.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user