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.3.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.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for jumpstarter_driver_pyserial-0.7.3.tar.gz
Algorithm Hash digest
SHA256 0d1cafe661f9fd1d9237842a6976237746d6f61b5d360eb6237eebc4c5d3cacf
MD5 0f94d8f044598a99e7e0fb238699f43c
BLAKE2b-256 8eb40b36630387c67809554f589f6e79a29984ff6994083a004a2d28781988c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jumpstarter_driver_pyserial-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1cae70e1504196404922b9dc2c7bc3a23b9b9cc59877300b2d133136703adc3b
MD5 f4cb00163f332332a90e6a63d8b6f35e
BLAKE2b-256 affe638bf94936d907684230e642409bc4c014f74e103e5a91b5467edebb4312

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