Skip to content

Commit ea2ee00

Browse files
committed
docs(cli): clarify port-less mode for local servers
The 'About --port' section already promised that --port is optional when the server has a connected device, but the operating modes table only listed port-less attach implicitly via the remote-proxy row. - State that port-less attach applies to BOTH local and remote. - Add a 'Local proxy (port-less)' row to the modes table. - Note that omitting --port without a connected device falls back to offline so ELF analysis / compile commands keep working.
1 parent c531e77 commit ea2ee00

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

Docs/CLI.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ Options:
4747

4848
### About `--port`
4949

50-
The serial port belongs to the **WebServer**, not the CLI. When a server is already running and has a device connected, `--port` is not needed — the CLI attaches to the server's existing connection.
50+
The serial port belongs to the **WebServer**, not the CLI. When a server is already running and has a device connected, `--port` is not needed — the CLI attaches to the server's existing connection. This applies to **both local and remote** servers: as long as `/api/status` reports `connected=true`, you can run device commands without `--port`.
5151

5252
`--port` is only required when:
5353
- No server is running locally (triggers auto-launch + direct fallback).
54-
- The remote server has no device connected yet (tells it which port to open).
54+
- The local or remote server is reachable but has no device connected yet (tells it which port to open).
55+
56+
When `--port` is omitted **and** no server has a connected device, the CLI stays offline so ELF analysis / compile commands keep working without a device.
5557

5658
## Operating Modes
5759

5860
| Mode | Trigger | Behavior |
5961
|------|---------|----------|
60-
| Offline | No `--port`, no server | ELF analysis / compile only |
62+
| Offline | No `--port`, no server (or server has no device) | ELF analysis / compile only |
63+
| Local proxy (port-less) | No `--port`, local server already has a device | Attach to server's existing connection |
6164
| Local proxy | `--port` + local server running | Attach to server, forward device ops |
6265
| Local auto-launch | `--port` + no local server | Auto-launch server, then proxy |
6366
| Local direct | `--direct --port` | Open serial directly (bypass server) |

Tools/WebServer/cli/fpb_cli.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,19 +1188,25 @@ def main():
11881188
fpb_cli.py search firmware.elf gpio
11891189
fpb_cli.py compile patch.c --elf firmware.elf --compile-commands build/compile_commands.json
11901190
1191-
# Local device commands — auto-launch/attach to a WebServer:
1191+
# Local device commands — first time, --port triggers auto-launch:
11921192
fpb_cli.py --port /dev/ttyACM0 info
11931193
fpb_cli.py --port /dev/ttyACM0 inject digitalWrite patch.c --elf firmware.elf
11941194
1195+
# Once a local server has the device connected, --port is no longer needed:
1196+
fpb_cli.py info
1197+
fpb_cli.py file-stat /etc/init.d/rcS
1198+
11951199
# Remote control — the device lives on the server, so no --port needed:
11961200
fpb_cli.py --server-url http://192.168.1.20:5500 --token TOKEN info
11971201
# Only pass --port to tell the remote server which port to open if it has none:
11981202
fpb_cli.py --server-url http://192.168.1.20:5500 --token TOKEN --port /dev/ttyACM0 connect
11991203
12001204
Notes:
1201-
The serial port belongs to the WebServer, not the CLI. In proxy mode --port
1202-
is optional and only used to ask the server to open a port when no device is
1203-
connected yet. --token (or FPB_TOKEN env) is required for remote servers.
1205+
The serial port belongs to the WebServer, not the CLI. In proxy mode (local
1206+
or remote) --port is optional whenever the server already has a connected
1207+
device; it is only required to open a port when no device is connected yet,
1208+
or for direct/auto-launch on a fresh local environment.
1209+
--token (or FPB_TOKEN env) is required for remote servers.
12041210
Output is JSON on stdout; pipe to jq for filtering.
12051211
Run 'fpb_cli.py <command> --help' for command-specific options.
12061212
""",

0 commit comments

Comments
 (0)