Skip to content

Commit ca67a90

Browse files
author
Luca Bianconi
committed
Merge branch 'chore/json-schema' of github.com:arduino/arduino-cli into chore/json-schema
2 parents f7e5f86 + d096c6d commit ca67a90

File tree

8 files changed

+46
-15
lines changed

8 files changed

+46
-15
lines changed

.github/workflows/release-go-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ jobs:
253253
- name: Collect proto files
254254
run: task protoc:collect
255255

256-
- name: Add configuration jsonschema
256+
- name: Add configuration JSON schema
257257
run: |
258258
TAG=${{ needs.create-release-artifacts.outputs.version }}
259259
cp ./configuration/configuration.schema.json ${{ env.DIST_DIR}}/${TAG}-configuration.schema.json

DistTasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ tasks:
253253
PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz"
254254

255255
jsonschema:
256-
desc: Copy the jsonschema to dist folder
256+
desc: Copy the JSON schema to dist folder
257257
cmds:
258258
- mkdir --parents {{.DIST_DIR}}
259259
- cp ./configuration/configuration.schema.json {{.DIST_DIR}}/{{.PROJECT_NAME}}_{{.VERSION}}_configuration.schema.json

arduino/discovery/discovery.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type Port struct {
9191
AddressLabel string `json:"label"`
9292
Protocol string `json:"protocol"`
9393
ProtocolLabel string `json:"protocolLabel"`
94+
HardwareID string `json:"hardwareId,omitempty"`
9495
Properties *properties.Map `json:"properties"`
9596
}
9697

@@ -107,6 +108,7 @@ func (p *Port) ToRPC() *rpc.Port {
107108
Label: p.AddressLabel,
108109
Protocol: p.Protocol,
109110
ProtocolLabel: p.ProtocolLabel,
111+
HardwareId: p.HardwareID,
110112
Properties: props.AsMap(),
111113
}
112114
}

configuration/configuration.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"level": {
108108
"description": "messages with this level and above will be logged. Valid levels are: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic`.",
109109
"type": "string",
110-
"enum": ["trace", "debug", "info", "warn", "error", "fatal"]
110+
"enum": ["trace", "debug", "info", "warn", "error", "fatal", "panic"]
111111
}
112112
},
113113
"type": "object"

docs/pluggable-discovery-specification.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ call. The format of the response is the following:
127127
"label": <-- HOW THE PORT IS DISPLAYED ON THE GUI
128128
"protocol": <-- THE PROTOCOL USED BY THE BOARD
129129
"protocolLabel": <-- HOW THE PROTOCOL IS DISPLAYED ON THE GUI
130+
"hardwareId": <-- A STRING THAT UNIQUELY IDENTIFIES A BOARD INSTANCE
130131
"properties": {
131132
<-- A LIST OF PROPERTIES OF THE PORT
132133
}
@@ -147,7 +148,15 @@ Each port has:
147148
`SSH on 192.168.10.100`)
148149
- `protocol` is the protocol identifier (such as `serial` or `dfu` or `ssh`)
149150
- `protocolLabel` is the `protocol` in human readable form (for example `Serial port` or `DFU USB` or `Network (ssh)`)
150-
- `properties` is a list of key/value pairs that represent information relative to the specific port
151+
- `hardwareId` (optional) a string that uniquely identifies a specific board instance (even among other boards of the
152+
same model). Different ports with the same `hardwareId` must belong to the same board instance. The identifier should
153+
be sufficiently long to uniquely identify the board instance and reduce the probability of collisions. Good examples
154+
of `hardwareId` values are: Ethernet MAC Address, USB Serial Number, CPU-ID number, etc.
155+
156+
This value **should not** be used to identify the board **model** (see the
157+
[board identification](#board-identification) section for more information about identification of the board model).
158+
159+
- `properties` is a list of key/value pairs that represent information relative to the specific port.
151160

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

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

188+
The `hardwareId` field is populated with the USB `serialNumber` since this value is useful to identify the board
189+
instance.
190+
178191
The `LIST` command performs a one-shot polling of the ports. The discovery should answer as soon as reasonably possible,
179192
without any additional delay.
180193

@@ -231,6 +244,7 @@ The `add` event looks like the following:
231244
"port": {
232245
"address": "/dev/ttyACM0",
233246
"label": "ttyACM0",
247+
"hardwareId": "EBEABFD6514D32364E202020FF10181E",
234248
"properties": {
235249
"pid": "0x804e",
236250
"vid": "0x2341",

internal/cli/board/list.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func watchList(cmd *cobra.Command, inst *rpc.Instance) {
105105
Address: event.Port.Port.Address,
106106
Protocol: event.Port.Port.Protocol,
107107
ProtocolLabel: event.Port.Port.ProtocolLabel,
108+
HardwareID: event.Port.Port.HardwareId,
108109
Properties: event.Port.Port.Properties,
109110
Boards: event.Port.MatchingBoards,
110111
Error: event.Error,
@@ -181,6 +182,7 @@ type watchEvent struct {
181182
Label string `json:"label,omitempty"`
182183
Protocol string `json:"protocol,omitempty"`
183184
ProtocolLabel string `json:"protocol_label,omitempty"`
185+
HardwareID string `json:"hardwareId,omitempty"`
184186
Properties map[string]string `json:"properties"`
185187
Boards []*rpc.BoardListItem `json:"boards,omitempty"`
186188
Error string `json:"error,omitempty"`

rpc/cc/arduino/cli/commands/v1/port.pb.go

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/cli/commands/v1/port.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ message Port {
3131
string protocol_label = 4;
3232
// A set of properties of the port
3333
map<string, string> properties = 5;
34+
// The hardware ID (serial number) of the board attached to the port
35+
string hardware_id = 6;
3436
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy