esptest.devices.serial_tools module
- esptest.devices.serial_tools.get_all_serial_ports(user='default', include_links=False)[source]
list_ports could spend a very long time if there are many ports
- esptest.devices.serial_tools.compute_serial_port(port, strict=False)[source]
Get the real serial port device from device, port name or usb location
- esptest.devices.serial_tools.is_serial_port_in_use(port)[source]
Return whether the serial device is likely open in another process.
Resolves
portwithcompute_serial_port(), then prefersfuser(1)(fuser -son the device path: exit 0 means some process is using the file). Iffuseris unavailable, fails, or returns an unexpected exit code, falls back tolsof(8)(exit 0 means holders were found).If neither tool is available or both fail, raise OSError (occupancy unknown; callers may still open the port).