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
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 may 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()

