Description
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:
arduino-cli/commands/board/attach.go
Lines 120 to 126 in 1855b53
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.