You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case the serial port metadata comes from an USB serial converter. The USB VID/PID and USB SERIAL NUMBER properties are also reported inside `properties`. Inside the `identificationPrefs` instead we have only the properties useful for product identification (in this case only USB VID/PID is useful to identify the board model).
144
+
In this case the serial port metadata comes from an USB serial converter. Inside the `properties` we have all the 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).
156
145
157
146
The `LIST` command performs a one-shot polling of the ports. If you need continuous monitoring of ports you should use the `START_SYNC` command.
158
147
@@ -177,10 +166,6 @@ The `add` event looks like the following:
@@ -246,58 +231,64 @@ In case different discoveries provide conflicting information (for example if tw
246
231
247
232
#### Board identification
248
233
249
-
The metadata `identificationPrefs` associated to a port can be used to identify the board attached to that port. The algorithm is very simple: if a board listed in the platform file `boards.txt` match the same `identificationPrefs` coming from the discovery then the board is a “candidate” board attached to that port. Some identification properties may be imperfect and not uniquely identify a board, in that case more boards can match the same `identificationPrefs`, that’s why we called it “candidate”.
234
+
The `properties` associated to a port can be used to identify the board attached to that port. The algorithm is simple:
235
+
236
+
- each board listed in the platform file `boards.txt` may declare a set of `upload_port.*` properties
237
+
- if each `upload_port.*` property has a match in the `properties` set coming from the discovery then the board is a “candidate” board attached to that port.
250
238
251
-
Let’s see an example to clarify things a bit, let suppose that we have the following `identificationPrefs` coming from the serial discovery:
239
+
Some port `properties` may not be precise enough to uniquely identify a board, in that case more boards may match the same set of `properties`, that’s why we called it “candidate”.
240
+
241
+
Let’s see an example to clarify things a bit, let's suppose that we have the following `properties` coming from the serial discovery:
so we got `pid=0x804e, vid=0x2341`. Let’s suppose we have the following `boards.txt`:
255
+
in this case we can use `vid` and `pid` to identify the board. The `serialNumber`, instead, is unique for that specific instance of the board so it can't be used to identify the board model. Let’s suppose we have the following `boards.txt`:
265
256
266
257
```
267
258
# Arduino Zero (Prorgamming Port)
268
259
# ---------------------------------------
269
260
arduino_zero_edbg.name=Arduino Zero (Programming Port)
270
-
arduino_zero_edbg.vid.0=0x03eb
271
-
arduino_zero_edbg.pid.0=0x2157
261
+
arduino_zero_edbg.upload_port.vid=0x03eb
262
+
arduino_zero_edbg.upload_port.pid=0x2157
272
263
arduino_zero_edbg.debug.tool=gdb
273
264
arduino_zero_edbg.upload.tool=openocd
274
265
arduino_zero_edbg.upload.protocol=sam-ba
275
266
[...CUT...]
276
267
# Arduino Zero (Native USB Port)
277
268
# --------------------------------------
278
269
arduino_zero_native.name=Arduino Zero (Native USB Port)
As we can see the only board that has the two properties matching is the `mkr1000`, in this case the CLI knows that the board is surely an MKR1000.
308
299
309
-
Note that `vid` and `pid` properties are just free text key/value pairs: the discovery may returns basically anything, the board just needs to have the same properties defined in `boards.txt` to be identified.
300
+
Note that `vid` and `pid` properties are just free text key/value pairs: the discovery may return basically anything, the board just needs to have the same properties defined in `boards.txt` as `upload_port.*` to be identified.
310
301
311
302
We can also specify multiple identification properties for the same board using the `.N` suffix, for example:
will match on both `pears=20, apples=30` and `pears=30, apples=40` but not `pears=20, apples=40`, in that sense each "set" of identification properties is indepentent from each other and cannot be mixed for port matching.
0 commit comments