Skip to content
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

discoveries not isolated with different protocols #711

Closed
ben-qnimble opened this issue Dec 21, 2021 · 0 comments · Fixed by #713
Closed

discoveries not isolated with different protocols #711

ben-qnimble opened this issue Dec 21, 2021 · 0 comments · Fixed by #713
Assignees
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ben-qnimble
Copy link
Contributor

Describe the bug
If a custom discovery lists a port with the same address as another port, but a different protocol, then Arduino-IDE should treat them as separate ports. This is how the Arduino-cli works and the 1.X IDE.

The 2.0 IDE groups them together and only shows one device, with the protocol determined by which discovery reported the added device first.

To Reproduce
Steps to reproduce the behavior:

  1. Edit the code for serial-discovery to return protocol="newprotocol" instead of serial and compile it with the name newprotocol-discovery.
  2. Then configure a platform to use the newprotocol-discovery as a discovery source.
  3. Then when you plug in a comm port, instead of see it listed twice, once with protocol 'serial' and once with protocl 'newprotocol' you will only see it once. If you unplug and replug the device, it may show up with a different protocol depending on who discovery say the reconnect first.

Expected behavior
In the setup above, any comm port connected to the system should be listed twice, once under 'serial' protocol, and once under 'newprotocol'.

Debug Lines

For my testing, I have an Arduino device. serial-discovery sees it as:

 "ports": [
    {
      "address": "COM16",
      "label": "COM16",
      "protocol": "serial",
      "protocolLabel": "Serial Port (USB)",
      "properties": {
        "pid": "0x0941",
        "serialNumber": "90742540",
        "vid": "0x1781"
      }
    }
]

A second discovery I'm running (quarto-discovery) sees that same port as

 "ports": [
    {
      "address": "COM16",
      "label": "Quarto (COM16)",
      "protocol": "sam-ba",
      "protocolLabel": "sam-ba emulator",
      "properties": {
        "mi": "0x00",
        "pid": "0x0941",
        "serialNumber": "90742540",
        "upload": "1",
        "vid": "0x1781"
      }
    }
]

I then run arduino-ide rc2 in verbose mode and when I plug in my device, I sometimes get:

root INFO Attached boards and available ports changed:
root INFO  - Attached board: Quarto [qnimble:imxrt:quarto] on COM16 Quarto (COM16)
root INFO ------------------------------------------
daemon INFO from discovery builtin:serial-discovery received message type: add, port: COM16
root WARN Port 'COM16' was already available. Known boards before override: [{"fqbn":"qnimble:imxrt:quarto","name":"Quarto","port":{"address":"COM16","protocol":"sam-ba","label":"Quarto (COM16)"}}]

In this case, the serial-discovery return is ignored. Other times, I get

daemon INFO from discovery builtin:serial-discovery received message type: add, port: COM16
daemon INFO from discovery qnimble:quarto-discovery received message type: add, port: COM16
root WARN Port 'COM16' was already available. Known boards before override: []

and in this case quarto-discovery's return is ignored.

I've run the same test with arduino-cli and there I get:

INFO[0186] from discovery builtin:serial-discovery received message type: add, port: COM16
INFO[0186] from discovery qnimble:quarto-discovery received message type: add, port: COM16

where the two discoveries do not conflict and it adds COM16 twice, once with each protocol.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 2.0rc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants