Skip to content

list_serial_ports

list_serial_ports(ports_exclude=[])

Returns a list of serial ports available on the system.

Raises:

Type Description
OSError

If the platform is not supported.

Returns:

Type Description
list[str]

list[str]: A list of serial ports available on the system.

Source code in src/naneos/serial_utils/list_serial_ports.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def list_serial_ports(ports_exclude: list = []) -> list[str]:
    """Returns a list of serial ports available on the system.

    Raises:
        OSError: If the platform is not supported.

    Returns:
        list[str]: A list of serial ports available on the system.
    """
    # ports: list[str] = _get_all_open_ports()
    ports: list[str] = _get_all_dosemet_ports(ports_exclude)
    ports = _check_port_function(ports)

    return ports