pyedbglib.serialport

pyedbglib.serialport.serialcdc

This subclass of pyserial’s serial.Serial class is intended to work exactly like the original, with the exception that the constructor has an extra argument ‘open_timeout’ (default = 30). The open() method will do the specified number of retries to wait for a CDC serial port device to be created/accessible.

class pyedbglib.serialport.serialcdc.SerialCDC(*args: Any, **kwargs: Any)

Bases: Serial

Serial class extension supporting open_timeout

Desired definition is def __init__(self, *args, open_timeout=30, **kwargs): but that doesn’t work with python2.

open()

Overriding parent’s open(), with timeout.

pyedbglib.serialport.serialportcheck

Utility for checking whether a (virtual) serial port is accessible or not.

pyedbglib.serialport.serialportcheck.check_access(port)

Check if user has access to kit’s virtual serial port. In many Linux distros access requires membership of the ‘dialout’ group which is not default.

Parameters:

port – port name to check

Returns:

boolean - access is allowed

pyedbglib.serialport.serialportmap

Serial Port Mapper Kits like Curiosity Nano consist of a composite USB device with multiple interfaces, including a virtual serial port. The USB serial number belongs on a device level. This utility offers a mechanism for linking the virtual serial port to its parent USB device.

class pyedbglib.serialport.serialportmap.SerialPortMap

Bases: object

This is a utility to find virtual serial port name based on HID device serial number, or vice versa.

find_hid_tool(port)

Find HID tool based on virtual serial port name

Parameters:

port – port name to find

Returns:

HID tool object or None

find_matching_tools_ports(serial_endswith)

Find tools and ports matching (partial) serial number.

Parameters:

serial_endswith – serial number, or at least end part thereof

Returns:

List of matching {tool, port} dicts

find_serial_number(port)

Find HID tool serial number based on virtual serial port name This is redundant, but added for convenience

Parameters:

port – port name

Returns:

HID tool serial number or None

find_serial_port(serial_number)

Find virtual serial port based on serial number exact match

Parameters:

serial_number – serial number of tool

Returns:

Name of virtual serial port or None.