Skip to content

ares_lora.find_ports

find_ports(targets: tuple[str, ...] | None = None) -> dict[str, list[str]]

Finds valid ports that match the description given by the valid targets tuple.

Parameters:

Name Type Description Default
targets tuple[str, ...] | None

The valid targets for ports. This is a tuple of strings described as such: f"{manufacturer} {product}".

None

Returns:

Type Description
dict[str, list[str]]

A dictionary where the key is a valid target and the value is a list of ports associated with that target.

Source code in serial-driver/src/ares_lora/utils.py
def find_ports(targets: tuple[str, ...] | None = None) -> dict[str, list[str]]:
    """Finds valid ports that match the description given by the valid targets tuple.

    Args:
        targets: The valid targets for ports. This is a tuple of strings described as such: `f"{manufacturer} {product}"`.

    Returns:
        A dictionary where the key is a valid target and the value is a list of ports associated with that target.
    """
    if targets is None:
        targets: tuple[str, ...] = TARGETS
    return _find_ports(targets)