Import
Methods
Method Reference
Net.get(name, type=NetType.UART)
Get a UART net by name.
Returns:
UARTNet instance
get_path()
Get the device path for the UART net.
str - Device path like /dev/ttyUSB0
Raises: FileNotFoundError if the UART device is not connected
connect(**overrides)
Connect to the UART serial port with pyserial.
Returns:
serial.Serial - Connected pyserial object
connect() raises ValueError for a parity value that is not in the table
above.connect() opens the port exclusively. While a lager uart session holds the
net, connect() raises serial.SerialException. While your script holds the
port, lager uart on the same net fails with
UART device /dev/ttyUSB0 is already in use (locked by another session or the lager uart CLI).
Close the port with ser.close() to release it.get_baudrate()
Get the configured baudrate for this net.
int - Configured baudrate (default: 115200)
get_config()
Get the raw net configuration dictionary.
dict - Configuration dictionary
Properties
Examples
Basic UART Communication
Using Device Path Directly
Interactive Console
Command/Response Pattern
Production Test with UART
Multi-Net UART Test
UART vs Serial Module
The Lager Python SDK provides two ways to work with serial communication:
Use UART Net when:
- Device paths can change between reboots
- You need to identify devices by USB serial number
- You’re using Lager’s net configuration system
- Running automated production tests
- You know the exact device path
- You need maximum flexibility
- You’re doing quick debugging
Hardware Integration
Notes
- UART nets resolve device paths using USB serial numbers for consistent identification
- The
connect()method returns a standard pyserialSerialobject - Default baudrate is 115200 if not specified in configuration
- Device paths are cached after first resolution
- Use
get_path()if you need the raw device path for other tools - Serial parameters from net configuration can be overridden in
connect()

