Skip to content

Commit b05be84

Browse files
authored
Merge pull request #781 from jumpstarter-dev/serial-log
pyserial driver: add pipe command on cli
2 parents 882775c + f18e909 commit b05be84

File tree

3 files changed

+562
-1
lines changed

3 files changed

+562
-1
lines changed

packages/jumpstarter-driver-pyserial/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,58 @@ export:
3333
| check_present | Check if the serial port exists during exporter initialization, disable if you are connecting to a dynamically created port (i.e. USB from your DUT) | bool | no | True |
3434
| cps | Characters per second throttling limit. When set, data transmission will be throttled to simulate slow typing. Useful for devices that can't handle fast input | float | no | None |
3535
36+
## CLI Commands
37+
38+
The pyserial driver provides two CLI commands for interacting with serial ports:
39+
40+
### start_console
41+
42+
Start an interactive serial console with direct terminal access.
43+
44+
```bash
45+
j serial start-console
46+
```
47+
48+
Exit the console by pressing CTRL+B three times.
49+
50+
### pipe
51+
52+
Pipe serial port data to stdout or a file. Automatically detects if stdin is piped and enables bidirectional mode.
53+
54+
When stdin is used, commands are sent until EOF, then continues monitoring serial output until Ctrl+C.
55+
56+
```bash
57+
# Log serial output to stdout
58+
j serial pipe
59+
60+
# Log serial output to a file
61+
j serial pipe -o serial.log
62+
63+
# Send command to serial, then continue monitoring output
64+
echo "hello" | j serial pipe
65+
66+
# Send commands from file, then continue monitoring output
67+
cat commands.txt | j serial pipe -o serial.log
68+
69+
# Force bidirectional mode (interactive)
70+
j serial pipe -i
71+
72+
# Append to log file instead of overwriting
73+
j serial pipe -o serial.log -a
74+
75+
# Disable stdin input even when piped
76+
cat data.txt | j serial pipe --no-input
77+
```
78+
79+
#### Options
80+
81+
- `-o, --output FILE`: Write serial output to a file instead of stdout
82+
- `-i, --input`: Force enable stdin to serial port (auto-detected if piped)
83+
- `--no-input`: Disable stdin to serial port, even if stdin is piped
84+
- `-a, --append`: Append to output file instead of overwriting
85+
86+
Exit with Ctrl+C.
87+
3688
## API Reference
3789

3890
```{eval-rst}

0 commit comments

Comments
 (0)