diff --git a/zephcore/CMakeLists.txt b/zephcore/CMakeLists.txt index 571eade..7d6e181 100644 --- a/zephcore/CMakeLists.txt +++ b/zephcore/CMakeLists.txt @@ -503,6 +503,16 @@ if(CONFIG_ZEPHCORE_ROLE_REPEATER) helpers/TransportKeyStore.cpp helpers/CommonCLI.cpp ) + # Headless repeater (e.g. native-Linux SBC): no display/buttons/buzzer, so the + # real ui_* implementation (helpers/ui-button or helpers/ui-joystick) isn't + # compiled. main_repeater.cpp calls ui_* unconditionally — pull in the weak + # no-op stubs to satisfy the link. Mirrors the companion TCP branch above. + if(NOT CONFIG_ZEPHCORE_UI_DESIGN_BUTTON AND NOT CONFIG_ZEPHCORE_UI_DESIGN_JOYSTICK) + target_sources(app PRIVATE helpers/ui/ui_headless_stubs.c) + target_include_directories(app PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/helpers/ui + ) + endif() # Shared USBD CDC ACM init + 1200-baud DFU + DTR event/callback module. # ESP32 boards use usb_serial (no UDC/CDC ACM), so skip when not present. if(NOT CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT AND (CONFIG_USB_CDC_ACM OR CONFIG_USBD_CDC_ACM_CLASS)) diff --git a/zephcore/LINUX_NATIVE.md b/zephcore/LINUX_NATIVE.md index 8bce9c2..fa5e1e9 100644 --- a/zephcore/LINUX_NATIVE.md +++ b/zephcore/LINUX_NATIVE.md @@ -252,19 +252,70 @@ Only one client connects at a time. ### Repeater CLI -The repeater role's USB CDC CLI maps onto Zephyr's `CONFIG_UART_NATIVE_PTY`. At boot: +The repeater role exposes the same configuration CLI as an MCU repeater's USB-CDC +serial console — see [Repeater_CLI_commands.md](Repeater_CLI_commands.md) for the +full command list (`get`/`set`, `password`, `reboot`, `clock`, …). On native Linux +that console maps onto Zephyr's native-PTY UART (`CONFIG_SERIAL` + +`CONFIG_UART_NATIVE_PTY`). At boot the binary prints the pseudo-terminal it created: ``` -UART_0 connected to pseudotty: /dev/pts/3 +uart connected to pseudotty: /dev/pts/3 ``` -`screen /dev/pts/3` to attach locally. For remote access, bridge the PTY to TCP with `socat`: +That `/dev/pts/N` path **is** the serial console — point any serial terminal at it. + +> **The PTY number changes on every run.** Grab it from the boot output each time +> (or from the journal when running as a service — see below). It is not stable +> across restarts. + +#### Attach locally (same machine as the binary) ```bash +screen /dev/pts/3 # detach: Ctrl-a then d ; quit: Ctrl-a then k +# or +picocom /dev/pts/3 +# or +minicom -D /dev/pts/3 +``` + +You get the repeater prompt directly. Logs go to the binary's stderr, **not** the +PTY, so the CLI stays clean (no log spam interleaved with your typing). + +#### Attach remotely (configure an SBC over the network) + +Bridge the PTY to a TCP port with `socat`, then connect from your workstation: + +```bash +# on the SBC: socat /dev/pts/3 TCP-LISTEN:6000,reuseaddr,fork & +# from anywhere on the network: nc 6000 ``` +#### When running as a systemd service + +The binary runs in the background, so there's no terminal to attach to and the +PTY path is only in the journal: + +```bash +journalctl -u zephcore | grep pseudotty # find the current /dev/pts/N +``` + +Because the path changes every boot and you can't `screen` a backgrounded +process, the practical options are: + +- **Expose the CLI on a fixed TCP port** by adding the `socat` bridge as an + `ExecStartPost=` in the unit (see [Run at boot](#run-at-boot-systemd-service)), + so the console is always reachable at `:6000` regardless of the PTY + number. Then `nc 6000` to configure. +- **Or run the repeater in the foreground** (`sudo systemctl stop zephcore` then + launch the binary by hand) just while you need to change settings, and restart + the service afterward. + +After changing settings, persist + apply them the same way as on an MCU repeater +(most `set` commands take effect immediately; some require `reboot`). Settings +survive restarts via the per-node flash file — see [Persistent storage](#persistent-storage). + ### Run at boot (systemd service) To start ZephCore automatically at boot and restart it if it ever exits, install diff --git a/zephcore/boards/linux_native/linux_common.conf b/zephcore/boards/linux_native/linux_common.conf index a9752b7..7e1473a 100644 --- a/zephcore/boards/linux_native/linux_common.conf +++ b/zephcore/boards/linux_native/linux_common.conf @@ -54,6 +54,13 @@ CONFIG_SETTINGS_FILE_PATH="/lfs/settings" # native_sim's default uart0 is zephyr,native-pty-uart — at boot Zephyr # prints "UART_0 connected to pseudotty: /dev/pts/N". screen /dev/pts/N # to attach. Remote: socat /dev/pts/N TCP-LISTEN:6000,fork +# +# CONFIG_SERIAL is the master switch for the serial-driver subsystem; without +# it CONFIG_UART_NATIVE_PTY is silently dropped (it depends on SERIAL, doesn't +# select it) and no uart0 device object is generated. The repeater CLI binds +# the chosen console device (DEVICE_DT_GET(DT_CHOSEN(zephyr_console))), so the +# repeater build fails to link without this. +CONFIG_SERIAL=y CONFIG_UART_NATIVE_PTY=y CONFIG_UART_INTERRUPT_DRIVEN=y