Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
cmaglie opened this issue Dec 15, 2022 · 4 comments · Fixed by #2065
Closed
3 tasks done

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

cmaglie opened this issue Dec 15, 2022 · 4 comments · Fixed by #2065
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@cmaglie
Copy link
Member

cmaglie commented Dec 15, 2022

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
@cmaglie cmaglie added the type: enhancement Proposed improvement label Dec 15, 2022
@umbynos
Copy link
Contributor

umbynos commented Dec 15, 2022

@facchinm can we assume the serialNumber is unique?

@facchinm
Copy link
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
Copy link
Member Author

cmaglie commented Jan 4, 2023

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.

@cmaglie cmaglie 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 Jan 4, 2023
@cmaglie cmaglie transferred this issue from arduino/serial-discovery Jan 4, 2023
@umbynos umbynos added this to the Arduino CLI 1.0 milestone Jan 23, 2023
@umbynos
Copy link
Contributor

umbynos commented Jan 24, 2023

@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
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants