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

dist/tools/usb-serial: call ttys.py with its path #19823

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

dylad
Copy link
Member

@dylad dylad commented Jul 12, 2023

Contribution description

This PR provides a fix for #19805
When calling SERIAL=xxx make flash the command failed because the script dist/tools/usb-serial/find-ttys.sh tries to call ttys.py but it doesn't find it. So pass the full path to ttys.py to get rid of the problem.

Testing procedure

Connect at least two boards to your computer
run make list-ttys to get the ID of your boards
Try to flash one of them with (replace SERIAL with the one you get with the previous command):
BOARD=xxx SERIAL=xxx make -C tests/leds flash
It fails on master.
It should works with this PR.

Issues/PRs references

Fixes #19805

@dylad dylad requested a review from maribu July 12, 2023 20:24
@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Jul 12, 2023
@maribu
Copy link
Member

maribu commented Jul 12, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jul 12, 2023

🕐 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.

@@ -7,7 +7,7 @@
exit_code=1

for serial in "$@"; do
if ./ttys.py --format path --serial "$serial"; then
if ${RIOTTOOLS}/usb-serial/ttys.py --format path --serial "$serial"; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ${RIOTTOOLS}/usb-serial/ttys.py --format path --serial "$serial"; then
if "${RIOTTOOLS}/usb-serial/ttys.py" --format path --serial "$serial"; then

Maybe we should also fall back RIOTTOOLS to . when not provided, so that ./find-tty.sh still works?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I'll change.

@maribu
Copy link
Member

maribu commented Jul 13, 2023

bors cancel

@maribu
Copy link
Member

maribu commented Jul 13, 2023

How about this instead:

diff --git a/dist/tools/usb-serial/find-tty.sh b/dist/tools/usb-serial/find-tty.sh
index 136513d3ef..4b020c3227 100755
--- a/dist/tools/usb-serial/find-tty.sh
+++ b/dist/tools/usb-serial/find-tty.sh
@@ -6,8 +6,10 @@
 
 exit_code=1
 
+SCRIPTDIR="$(cd "$(dirname "$0")" || exit 1; pwd)"
+
 for serial in "$@"; do
-    if ./ttys.py --format path --serial "$serial"; then
+    if "$SCRIPTDIR"/ttys.py --format path --serial "$serial"; then
         exit_code=0
     fi
 done

It seems to fix #19805 for me and should hopefully also work when called manually, e.g. when RIOTTOOLS is not exported.

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
@dylad dylad force-pushed the dist/tools/usb-serial/fix_find-tty branch from f5a4625 to 1e800f3 Compare July 13, 2023 14:38
@dylad
Copy link
Member Author

dylad commented Jul 13, 2023

I've applied @maribu patch to both list-tty.sh and find-tty.sh scripts. That should do the trick.

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
@dylad dylad force-pushed the dist/tools/usb-serial/fix_find-tty branch from 1e800f3 to 1007f02 Compare July 13, 2023 14:44
@dylad dylad added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 13, 2023
@riot-ci
Copy link

riot-ci commented Jul 13, 2023

Murdock results

✔️ PASSED

1007f02 dist/tools/usb-serial/find-tty.sh: call ttys.py with its path

Success Failures Total Runtime
1 0 1 01m:00s

Artifacts

@maribu
Copy link
Member

maribu commented Jul 13, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jul 13, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit b482a71 into RIOT-OS:master Jul 13, 2023
@dylad
Copy link
Member Author

dylad commented Jul 13, 2023

Thanks @maribu

@maribu
Copy link
Member

maribu commented Jul 14, 2023

Backport provided in #19831

bors bot added a commit that referenced this pull request Jul 14, 2023
19831: dist/tools/usb-serial: call ttys.py with its path [backport 2023.07] r=benpicco a=maribu

# Backport of #19823

### Contribution description
This PR provides a fix for #19805
When calling `SERIAL=xxx make flash` the command failed because the script `dist/tools/usb-serial/find-ttys.sh` tries to call `ttys.py` but it doesn't find it. So pass the full path to `ttys.py` to get rid of the problem.

### Testing procedure
Connect at least two boards to your computer
run `make list-ttys ` to get the ID of your boards
Try to flash one of them with (replace SERIAL with the one you get with the previous command):
`BOARD=xxx SERIAL=xxx make -C tests/leds flash`
It fails on master.
It should works with this PR.

### Issues/PRs references

Fixes #19805


Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.10 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not able to flash binary on samr21-xpro boards choosing serial number
4 participants