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

usb-serial/list-ttys.sh: Broken when a debugger offers multiple serial ports #15814

Closed
bergzand opened this issue Jan 20, 2021 · 3 comments · Fixed by #19099
Closed

usb-serial/list-ttys.sh: Broken when a debugger offers multiple serial ports #15814

bergzand opened this issue Jan 20, 2021 · 3 comments · Fixed by #19099
Assignees
Labels
Area: tools Area: Supplementary tools Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@bergzand
Copy link
Member

Description

Some USB devices offer multiple serial interfaces. The list-ttys.sh bash script used to be able to show these all as belonging to the same USB device. This is probably broken since #15351 and now multiple directories found by find are returned as a single string.

Steps to reproduce the issue

run make -C examples/hello-world list-ttys with a hifive1b connected, or another board that has a debugger with multiple serial ports.

Expected results

/sys/bus/usb/devices/1-1.1.2.3: SEGGER HiFive, serial: '000979014634', tty(s): ttyACM5, ttyACM4

Actual results

find: ‘/sys/bus/usb/devices/1-1.1.2.3/1-1.1.2.3:1.2/tty\n/sys/bus/usb/devices/1-1.1.2.3/1-1.1.2.3:1.0/tty’: No such file or directory

Versions

GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)

Possible fix

As the script is already an bash script, a fix would be to store the result from find in an array like this:
https://stackoverflow.com/questions/23356779/how-can-i-store-the-find-command-results-as-an-array-in-bash/54561526#54561526

@bergzand bergzand added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: tools Area: Supplementary tools labels Jan 20, 2021
@bergzand bergzand self-assigned this Jan 20, 2021
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@aabadie
Copy link
Contributor

aabadie commented Jan 4, 2023

Is this fixed by #17737 ?

@maribu
Copy link
Member

maribu commented Jan 5, 2023

The python script indeed works in the given situation and now is used in make list-ttys.

I didn't dare to remove the old bash scripts, though. But every use case the bash scripts can handle, the python script can handle better. So maybe it is time to just drop them?

@aabadie
Copy link
Contributor

aabadie commented Jan 5, 2023

So maybe it is time to just drop them?

I always happy when code can be removed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants