No project description provided
Project description
PySerial driver
jumpstarter-driver-pyserial provides functionality for serial port
communication.
Installation
:substitutions:
$ pip3 install --extra-index-url {{index_url}} jumpstarter-driver-pyserial
Configuration
Example configuration:
export:
serial:
type: jumpstarter_driver_pyserial.driver.PySerial
config:
url: "/dev/ttyUSB0"
baudrate: 115200
cps: 10 # Optional: throttle to 10 characters per second
Config parameters
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
| url | The serial port to connect to, in pyserial format | str | yes | |
| baudrate | The baudrate to use for the serial connection | int | no | 115200 |
| 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 |
| 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 |
CLI Commands
The pyserial driver provides two CLI commands for interacting with serial ports:
start_console
Start an interactive serial console with direct terminal access.
j serial start-console
Exit the console by pressing CTRL+B three times.
pipe
Pipe serial port data to stdout or a file. Automatically detects if stdin is piped and enables bidirectional mode.
When stdin is used, commands are sent until EOF, then continues monitoring serial output until Ctrl+C.
# Log serial output to stdout
j serial pipe
# Log serial output to a file
j serial pipe -o serial.log
# Send command to serial, then continue monitoring output
echo "hello" | j serial pipe
# Send commands from file, then continue monitoring output
cat commands.txt | j serial pipe -o serial.log
# Force bidirectional mode (interactive)
j serial pipe -i
# Append to log file instead of overwriting
j serial pipe -o serial.log -a
# Disable stdin input even when piped
cat data.txt | j serial pipe --no-input
Options
-o, --output FILE: Write serial output to a file instead of stdout-i, --input: Force enable stdin to serial port (auto-detected if piped)--no-input: Disable stdin to serial port, even if stdin is piped-a, --append: Append to output file instead of overwriting
Exit with Ctrl+C.
API Reference
.. autoclass:: jumpstarter_driver_pyserial.client.PySerialClient()
:members: pexpect, open, stream, open_stream, close
Examples
Using expect with a context manager
with pyserialclient.pexpect() as session:
session.sendline("Hello, world!")
session.expect("Hello, world!")
Using expect without a context manager
session = pyserialclient.open()
session.sendline("Hello, world!")
session.expect("Hello, world!")
pyserialclient.close()
Using a simple BlockingStream with a context manager
with pyserialclient.stream() as stream:
stream.send(b"Hello, world!")
data = stream.receive()
Using a simple BlockingStream without a context manager
stream = pyserialclient.open_stream()
stream.send(b"Hello, world!")
data = stream.receive()
from jumpstarter_driver_pyserial.driver import PySerial
from jumpstarter.common.utils import serve
instance = serve(PySerial(url="loop://"))
pyserialclient = instance.__enter__()
instance.__exit__(None, None, None)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jumpstarter_driver_pyserial-0.7.4.tar.gz.
File metadata
- Download URL: jumpstarter_driver_pyserial-0.7.4.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c156e424fc90cfbab05ee28c2acf4402f1cf202f3d10a4b9eb07f876be993fd
|
|
| MD5 |
550e379735347007de9e960b0de26034
|
|
| BLAKE2b-256 |
14483b2026e0883599c658f7a8c70f334d30416dd24f6bbb110bf628be61e6c1
|
File details
Details for the file jumpstarter_driver_pyserial-0.7.4-py3-none-any.whl.
File metadata
- Download URL: jumpstarter_driver_pyserial-0.7.4-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ee3d9294a29c7a74d8c0e09852856e6f41c90fe75fe2a2f1460276cd8ad5c2
|
|
| MD5 |
f24da3484d2f30f4e1255c7d2a6a818d
|
|
| BLAKE2b-256 |
13325732350e765af8ca8f5229332c1c63c87451f9e5991be7db05b4554c9486
|