-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
(This should be super quick in Murdock, as |
9168057
to
f74c332
Compare
The test fails for me. First I thought that I had to install
It seems that the port isn't defined. |
Ah ok, maybe I have to try it on top of PR #19011 |
No, same error. |
Hmm, what is the output of |
|
f74c332
to
b341952
Compare
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.
b341952
to
d42faef
Compare
I updated the PR a bit to also allow adding custom commands to detect the TTYs instead of just a ttys.py --filter-genuine || ttys.py --filter-clones And for the Arduino Mega 2560 I now overwrite the shell command to fall back to detecting cheap USB UART bridges when no genuine Arduino Mega 2560 board was found. I think this is the best compromise, as it still reliably detects a genuine Arduino Mega 2560 (which we can tell apart by the UDEV data from other USB UART bridges), but won't break usage for clone boards. |
But of course this only works if the Arduino Mega 2560 Clone was connected last. |
bors merge |
19012: boards/arduino-mega2560: add TTY_BOARD_FILTER r=gschorcht a=maribu ### Contribution description This allows automatically selecting TTY actually belonging to an Arduino Mega2560 if `MOST_RECENT_PORT=1` is set. ### Testing procedure ``` make BOARD=arduino-mega2560 MOST_RECENT_PORT=1 -C examples/default flash term ``` Should automatically select the TTY of the most recently connected Arduino Mega2560, even if a board of a different type is connect more recently. ### Issues/PRs references - [x] depends on (and includes) #19011 Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Co-authored-by: Marian Buschsieweke <maribu@users.noreply.github.com>
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).
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.
e6b440d
to
dadf22f
Compare
Canceled. |
Squashed. bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors retry |
Build succeeded: |
Thx :) |
Oops, I accidentally restarted a full build in the wrong browser window for this PR. |
Contribution description
This allows automatically selecting TTY actually belonging to an
Arduino Mega2560 if
MOST_RECENT_PORT=1
is set.Testing procedure
Should automatically select the TTY of the most recently connected Arduino Mega2560, even if a board of a different type is connect more recently.
Issues/PRs references