Skip to content

Board attach should support serial symlinks #1072

Closed
@matthijskooijman

Description

@matthijskooijman

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.

Metadata

Metadata

Assignees

Labels

topic: CLIRelated to the command line interfacetopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions