Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards/arduino-mega2560: add TTY_BOARD_FILTER #19012

Merged
merged 3 commits into from
Dec 11, 2022

Commits on Dec 9, 2022

  1. dist/tools/usb-serial/ttys.py: return error on empty list

    If no TTY serial (matching the given filters, if any) was found, use
    the exit code `1`. The idea is that simple shell scripts falling back
    to alternative variants of a board can be used via
    
    ```.sh
    ttys.py --most-recent --model Fooboard --vendor Footronic || \
        ttys.py --most-recent --model Barboard --vendor Bartronic
    ```
    
    Just adding a regex that would accept both vendors and models would
    have different semantics: If both a Fooboard and a Barboard are
    attached, it would pick the most recently connected of both. The shell
    expression above would always prefer a Fooboard over a Borboard.
    
    The use case cheap Arduino clones that replace the ATmega16U2 used
    as USB UART bridge with cheap single purpose chips. The original
    ATmega16U2 has the advantage that it provides identification data
    unique the specific Arduino board, while the clones cannot be told
    apart from standalone USB UART bridges or Arduino clones of other
    models. Hence, we want to pick the genuine Arduino board if connected,
    and only fall back to matching cheap USB UART bridges if no genuine
    Arduino board is connected.
    maribu committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    86b7159 View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2022

  1. build system: improve MOST_RECENT_PORT=1 handling

    Allow overriding the shell command used to auto-detect the TTY of a
    board with `MOST_RECENT_PORT=1` via the `TTY_SELECT_CMD` variable.
    The use case is to also detect Arduino Mega 2560 clones with cheap
    USB UART bridges (for which the filter command may yield false
    positives) while preferring genuine Arduino Mega 2560 boards (if
    found) over the clones (as the filter for genuine boards does not yield
    false positives).
    maribu committed Dec 11, 2022
    Configuration menu
    Copy the full SHA
    208bf7e View commit details
    Browse the repository at this point in the history
  2. boards/arduino-mega2560: add TTY_BOARD_FILTER

    This allows automatically selecting TTY actually belonging to an
    Arduino Mega2560 if `MOST_RECENT_PORT=1` is set.
    
    Note: Unless `ARDUINO_MEGA2560_COMPAT_WITH_CLONES` is set to `0`,
    this will fall back to detecting any cheap USB UART bridge typically
    found in Arduino Mega 2560 clones if no genuine Arduino Mega is found.
    maribu committed Dec 11, 2022
    Configuration menu
    Copy the full SHA
    dadf22f View commit details
    Browse the repository at this point in the history