Skip to content

Allow identification of a specific instance of a board from a Pluggable Discovery #2024

@cmaglie

Description

@cmaglie
Member

Describe the request

We can use the USB serial number to know that a board has changed COM port, for example after an upload, or when it swaps to bootloader mode after a double-tap on the reset button.

Currently the discovery returns this information:

{
  "eventType": "list",
  "ports": [
    {
      "address": "/dev/ttyACM0",
      "label": "/dev/ttyACM0",
      "properties": {
        "pid": "0x804e",
        "vid": "0x2341",
        "serialNumber": "EBEABFD6514D32364E202020FF10181E"
      },
      "protocol": "serial",
      "protocolLabel": "Serial Port (USB)"
    }
  ]
}

we may extend the result by adding an extra field hardwareId that is populated when we have an hardware identification number available, for example for USB serial ports we can use the USB Serial Number:

{
  "eventType": "list",
  "ports": [
    {
      "address": "/dev/ttyACM0",
      "label": "/dev/ttyACM0",
      "hardwareId": "EBEABFD6514D32364E202020FF10181E",
      "properties": {
        "pid": "0x804e",
        "vid": "0x2341",
        "serialNumber": "EBEABFD6514D32364E202020FF10181E"
      },
      "protocol": "serial",
      "protocolLabel": "Serial Port (USB)"
    }
  ]
}

This change may require an update to the Pluggable Discovery specification.

Describe the current behavior

When a board changes the port after a reset, there is no reliable way to determine if the new port belongs to the same board.
With this proposal implemented the IDE may exploit the hardwareId field to reselect the correct port automatically.

Arduino CLI version

6bf2c23

Operating system

N/A

Operating system version

N/A

Additional context

cc @pnndra @kittaakos @per1234 @umbynos

Issue checklist

  • I searched for previous reports in the issue tracker
    I verified the problem still occurs when using the nightly build
    My report contains all necessary details

Activity

umbynos

umbynos commented on Dec 15, 2022

@umbynos
Contributor

@facchinm can we assume the serialNumber is unique?

facchinm

facchinm commented on Dec 16, 2022

@facchinm
Member

Most of the times yes; if using a PluggableUSB module (like Keyboard, Mouse or MIDIUSB) the serial number reported will change a bit (but I think it's a corner case compared with the vast majority of the use cases)

cmaglie

cmaglie commented on Jan 4, 2023

@cmaglie
MemberAuthor

Thinking on this a bit more, this is not related specifically to serial but its a broader change to the Pluggable Discovery specification, I'm moving the issue to the arduino-cli repo.

changed the title [-]Allow identification of a specific instance of a board when the COM port changes[/-] [+]Allow identification of a specific instance of a board from a Pluggable Discovery[/+] on Jan 4, 2023
added this to the Arduino CLI 1.0 milestone on Jan 23, 2023
umbynos

umbynos commented on Jan 24, 2023

@umbynos
Contributor

@cmaglie is the serial number exposed even in case of the network discovery?

no, but we can use the mac address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @cmaglie@per1234@facchinm@umbynos

    Issue actions

      Allow identification of a specific instance of a board from a Pluggable Discovery · Issue #2024 · arduino/arduino-cli