arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.38k stars 385 forks source link

Rework board attach command #1925

Closed umbynos closed 1 year ago

umbynos commented 2 years ago

The board attach command has a broken implementation:

Inconsistent port argument format

Currently, the command will only accept a port when passed in as a full path (e.g.: serial:///dev/cu.usbmodem14301). This is inconsistent with all the other commands that accept a port argument, which allow the more user friendly address (e.g.: /dev/cu.usbmodem14301) to be used.

The command must accept the same address format as the other commands.

In order to allow a protocol of the port to be specified in addition to the address in cases where this is necessary, the command should also support a --protocol flag just as in the other commands that accept a port argument. This information will be stored in the cpu.protocol field of sketch.json.

Support for the previous port format should be retained.

Outdated board identification feature

Currently, when a port is passed to the command, it attempts to automatically identify the board on that port and save its FQBN and name in the cpu.fqbn and cpu.name fields of sketch.json.

$ arduino-cli board attach serial:///dev/cu.usbmodem614601
Board found: Arduino MKR1000...
Selected fqbn: arduino:samd:mkr1000

$ cat sketch.json
{
  "cpu": {
  "fqbn": "arduino:samd:mkr1000",
  "name": "Arduino MKR1000",
  "port": "serial:///dev/cu.usbmodem614601"
  }
}

This feature uses the obsolete github.com/arduino/board-discovery module.

Although the feature could be modernized, its value is questionable. The available resources would be better allocated to more important work than to updating and maintaining the feature. For this reason, the auto-detection of board data from port feature should simply be removed.

per1234 commented 2 years ago

The deficiency of being unable to specify both port and FQBN via the command is tracked at https://github.com/arduino/arduino-cli/issues/1073

ubidefeo commented 2 years ago

@per1234 this issue was only tracked internally. Yesterday, during grooming/planning, we made it public in order to add it to the 1.0 milestone. This is why this one popped up seemingly out of the blue. Your mention of #1073 publicly links the two 🙏🏼

silvanocerza commented 2 years ago

Am doing this.

umbynos commented 2 years ago

:metal: