Skip to main content

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

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

jumpstarter_driver_pyserial-0.7.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jumpstarter_driver_pyserial-0.7.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file jumpstarter_driver_pyserial-0.7.2.tar.gz.

File metadata

File hashes

Hashes for jumpstarter_driver_pyserial-0.7.2.tar.gz
Algorithm Hash digest
SHA256 34686b3f55763175d648ccf41eb477ff21eaba8bc9940abe24dc85ef9bb2d45d
MD5 a8860bcf77abebca1892451808fa273d
BLAKE2b-256 25f87dace866a244856482174697b251bcf924b7a28c7e99f1c7d440f34e2709

See more details on using hashes here.

File details

Details for the file jumpstarter_driver_pyserial-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for jumpstarter_driver_pyserial-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0504ecd81567d29f7637a3fd98b038ca9120355c42343f5c96ad2aa688ff0ee6
MD5 babf5d315a05e26a7cea616f2608772f
BLAKE2b-256 23f6cb0468f2a14cbef090e9188d32c5f2f25d3c9bc1b7a92565abd2cd3d9270

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page