Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added 'hardwareId' support to pluggable discovery #2065

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

Merged
merged 3 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added 'hardwareId' support to pluggable discovery
  • Loading branch information
cmaglie committed Feb 9, 2023
commit c14e2484f2cca50bd67eee2bc1fc92cfde3060eb
2 changes: 2 additions & 0 deletions 2 arduino/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type Port struct {
AddressLabel string `json:"label"`
Protocol string `json:"protocol"`
ProtocolLabel string `json:"protocolLabel"`
HardwareID string `json:"hardwareId,omitempty"`
Properties *properties.Map `json:"properties"`
}

Expand All @@ -107,6 +108,7 @@ func (p *Port) ToRPC() *rpc.Port {
Label: p.AddressLabel,
Protocol: p.Protocol,
ProtocolLabel: p.ProtocolLabel,
HardwareId: p.HardwareID,
Properties: props.AsMap(),
}
}
Expand Down
15 changes: 14 additions & 1 deletion 15 docs/pluggable-discovery-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ call. The format of the response is the following:
"label": <-- HOW THE PORT IS DISPLAYED ON THE GUI
"protocol": <-- THE PROTOCOL USED BY THE BOARD
"protocolLabel": <-- HOW THE PROTOCOL IS DISPLAYED ON THE GUI
"hardwareId": <-- A STRING THAT UNIQUELY IDENTIFIES A BOARD SAMPLE
cmaglie marked this conversation as resolved.
Show resolved Hide resolved
"properties": {
<-- A LIST OF PROPERTIES OF THE PORT
}
Expand All @@ -147,7 +148,15 @@ Each port has:
`SSH on 192.168.10.100`)
- `protocol` is the protocol identifier (such as `serial` or `dfu` or `ssh`)
- `protocolLabel` is the `protocol` in human readable form (for example `Serial port` or `DFU USB` or `Network (ssh)`)
- `properties` is a list of key/value pairs that represent information relative to the specific port
- `hardwareId` (optional) a string that uniquely identify a specific board sample (even among other boards of the same
cmaglie marked this conversation as resolved.
Show resolved Hide resolved
model). Different ports with the same `hardwareId` must belong to the same board sample. The identifier should be
sufficiently long to uniquely identify the board sample and reduce the probability of collisions. Good examples of
`hardwareId` values are: Ethernet MAC Address, USB Serial Number, CPU-ID number, etc.

This value **should not** be used to identify the board **model** (see the
[board identification](#board-identification) section for more information about identification of the board model).

- `properties` is a list of key/value pairs that represent information relative to the specific port.
cmaglie marked this conversation as resolved.
Show resolved Hide resolved

To make the above more clear let's show an example output from the `serial-discovery` builtin in the Arduino CLI:

Expand All @@ -160,6 +169,7 @@ To make the above more clear let's show an example output from the `serial-disco
"label": "ttyACM0",
"protocol": "serial",
"protocolLabel": "Serial Port (USB)",
"hardwareId": "EBEABFD6514D32364E202020FF10181E",
"properties": {
"pid": "0x804e",
"vid": "0x2341",
Expand All @@ -175,6 +185,8 @@ In this case the serial port metadata comes from a USB serial converter. Inside
properties of the port, and some of them may be useful for product identification (in this case only USB VID/PID is
useful to identify the board model).

The `hardwareId` field is populated with the USB `serialNumber` since this value is useful to identify the board sample.
cmaglie marked this conversation as resolved.
Show resolved Hide resolved

The `LIST` command performs a one-shot polling of the ports. The discovery should answer as soon as reasonably possible,
without any additional delay.

Expand Down Expand Up @@ -231,6 +243,7 @@ The `add` event looks like the following:
"port": {
"address": "/dev/ttyACM0",
"label": "ttyACM0",
"hardwareId": "EBEABFD6514D32364E202020FF10181E",
"properties": {
"pid": "0x804e",
"vid": "0x2341",
Expand Down
33 changes: 22 additions & 11 deletions 33 rpc/cc/arduino/cli/commands/v1/port.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 2 rpc/cc/arduino/cli/commands/v1/port.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ message Port {
string protocol_label = 4;
// A set of properties of the port
map<string, string> properties = 5;
// The hardware ID (serial number) of the board attached to the port
string hardware_id = 6;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.