Skip to content

Allow specifying FQBN *and* port in board attach #1073

Closed
@matthijskooijman

Description

@matthijskooijman

Bug Report

Current behavior

The board attach command allows specifying a port or FQBN. If you specify a port, the FQBN is autodetected from the board (if possible) and the resulting sketch.json has both the port and fqbn set. If you specify just the FQBN, only that is set in sketch.json.

For boards that can be autodetected, it is sufficient to specify the port. But for boards that cannot be autodetected (i.e. that use a common USB-to-serial chip without their own VIDPID), specifying the serial port is now not possible (since that triggers autodetection, which fails).

As a workaround, you can just edit sketch.json manually, of course.

Maybe it would be useful to add a --fqbn option to board attach, to allow specifying the FQBN in addition to the serial port and override autodetection? The interface might get a little messy, though. Maybe it would be better to then also add --port and stop support the <port>|<FQBN> non-option argument? i.e. change:

Usage:
  arduino-cli board attach <port>|<FQBN> [sketchPath] [flags]

Examples:
  arduino-cli board attach serial:///dev/ttyACM0
  arduino-cli board attach serial:///dev/ttyACM0 HelloWorld
  arduino-cli board attach arduino:samd:mkr1000

to:

Usage:
  arduino-cli board attach [sketchPath] [flags]

Examples:
  arduino-cli board attach --port serial:///dev/ttyACM0
  arduino-cli board attach --port serial:///dev/ttyACM0 HelloWorld
  arduino-cli board attach --fqbn arduino:samd:mkr1000
  arduino-cli board attach --fqbn arduino:samd:mkr1000 --port serial:///dev/ttyACM0

This would break compatibility, though...

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: CLIRelated to the command line interfacetype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions