Skip to content

LIST response missing ports field when no ports are discovered #7

Closed
@per1234

Description

@per1234

Describe the problem

According to the Pluggable Discovery Specification, the LIST command:

https://arduino.github.io/arduino-cli/dev/pluggable-discovery-specification/#list-command

returns a list of the available ports at the moment of the call.
[...]
The ports field contains a list of the available ports.

My interpretation of this is that, except in the case of an error state, the command return should always contain a ports field, even if it is empty. This is the behavior of the other discovery tools I checked (mdns-discovery, teensy-discovery).

🐛 dfu-discovery's LIST command return does not contain a ports field when no DFU ports are discovered. This might cause problems for consumers of the tool's output that assume the field will be present.

To reproduce

$ dfu-discovery
HELLO 1 "foo"
{
  "eventType": "hello",
  "message": "OK",
  "protocolVersion": 1
}
START
{
  "eventType": "start",
  "message": "OK",
  "protocolVersion": 1
}
LIST
{
  "event": "list"
}

🐛

Expected behavior

LIST
{
  "event": "list",
  "ports": []
}

dfu-discovery version

be1e441

Operating system

Windows

Operating system version

11

Issue checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions