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

Board attach should support serial symlinks #1072

Closed
matthijskooijman opened this issue Nov 14, 2020 · 1 comment · Fixed by #1930
Closed

Board attach should support serial symlinks #1072

matthijskooijman opened this issue Nov 14, 2020 · 1 comment · Fixed by #1930
Assignees
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@matthijskooijman
Copy link
Collaborator

Bug Report

Current behavior

On Linux, /dev/serial/... has useful symlinks to serial ports, that allow more persistent references to specific boards, or boards plugged into specific USB ports. However, specifying such a symlink to board attach fails:

$ arduino-cli  board attach /dev/ttyACM0
[arduino-git:avr:uno]
Board found: Arduino Uno...
Selected fqbn: arduino-git:avr:uno

$ arduino-cli  board attach /dev/serial/by-id/usb-Arduino_Srl_Arduino_Uno_95530343434351A0B2B1-if00 
Attach board error: no supported board found at serial:///dev/serial/by-id/usb-Arduino_Srl_Arduino_Uno_95530343434351A0B2B1-if00

Expected behavior

The second command should find the Arduino, just like the first one.

Environment

  • CLI version (output of arduino-cli version): current git master 1855b53
  • OS and platform: Linux amd64

Additional context

The relevant code is here:

for _, device := range monitor.Serial() {
if device.Port == location {
// Found the device !
found = true
serialDevice = *device
}
}

This matches the given port URI/name to the list of ports verbatim, failing if the port is not among the autodetected list of ports.

A simple fix could be to canonicalize the path and resolving the symlinks.

I also tried upload --port ... which does seem to accept the symlink (probably because it just opens the port and/or forwards it to the upload tool directly and does not need to get the vidpid for the port). I haven't checked if there's other commands that do suffer from the same problem.

@per1234 per1234 reopened this Mar 30, 2021
@rsora rsora added topic: CLI Related to the command line interface and removed topic: CLI labels Sep 16, 2021
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 31, 2022
@ubidefeo ubidefeo added this to the Arduino CLI 1.0 milestone Oct 12, 2022
@per1234 per1234 linked a pull request Oct 26, 2022 that will close this issue
5 tasks
@cmaglie
Copy link
Member

cmaglie commented Nov 21, 2022

The board attach command should now accept any argument given without further checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants