Skip to content

Commit e17982c

Browse files
committed
Removed identificationPrefs
It has been replaced by the upload_port.* prefix in the boards.txt.
1 parent 2cab0a9 commit e17982c

File tree

1 file changed

+43
-55
lines changed

1 file changed

+43
-55
lines changed

RFCs/0002-pluggable-discovery.md

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ The pluggable discovery aims to provide a solution to these problems.
3030

3131
- Each port must be **enumerated/discovered**
3232

33-
- Each port may provide metadata to identify the board model (**identification properites**)
34-
3533
- Each port may provide **properties relative to the port** (USB serial number / MAC address)
3634

3735
- Each port must have an **unique address and protocol pair**
@@ -100,9 +98,6 @@ The `LIST` command executes an enumeration of the ports and returns a list of th
10098
"protocolLabel": <-- HOW THE PROTOCOL IS DISPLAYED ON THE GUI
10199
"properties": {
102100
<-- A LIST OF PROPERTIES OF THE PORT
103-
},
104-
"identificationPrefs": {
105-
<-- A LIST OF PROPERTIES TO IDENTIFY THE BOARD MODEL
106101
}
107102
}, {
108103
... <-- OTHER PORTS...
@@ -125,8 +120,6 @@ Each port has:
125120

126121
- `properties` is a list of key/value pairs that represent information relative to the specific port
127122

128-
- `identificationPrefs` is a list of key value pairs that represent information to identify the board **model**
129-
130123
To make the above more clear let’s show an example with the `serial_discovery`:
131124

132125
```JSON
@@ -142,17 +135,13 @@ To make the above more clear let’s show an example with the `serial_discovery`
142135
"pid": "0x804e",
143136
"vid": "0x2341",
144137
"serialNumber": "EBEABFD6514D32364E202020FF10181E"
145-
},
146-
"identificationPrefs": {
147-
"pid": "0x804e",
148-
"vid": "0x2341"
149138
}
150139
}
151140
]
152141
}
153142
```
154143

155-
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).
156145

157146
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.
158147

@@ -177,10 +166,6 @@ The `add` event looks like the following:
177166
"vid": "0x2341",
178167
"serialNumber": "EBEABFD6514D32364E202020FF10181E"
179168
},
180-
"identificationPrefs": {
181-
"pid": "0x804e",
182-
"vid": "0x2341"
183-
},
184169
"protocol": "serial",
185170
"protocolLabel": "Serial Port (USB)"
186171
}
@@ -246,58 +231,64 @@ In case different discoveries provide conflicting information (for example if tw
246231

247232
#### Board identification
248233

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.
250238

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:
252242

253243
```JSON
254244
[...CUT...]
255245
"port": {
256246
"address": "/dev/ttyACM0",
257-
"identificationPrefs": {
247+
"properties": {
258248
"pid": "0x804e",
259-
"vid": "0x2341"
249+
"vid": "0x2341",
250+
"serialNumber": "EBEABFD6514D32364E202020FF10181E"
260251
}
261252
[...CUT...]
262253
```
263254

264-
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`:
265256

266257
```
267258
# Arduino Zero (Prorgamming Port)
268259
# ---------------------------------------
269260
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
272263
arduino_zero_edbg.debug.tool=gdb
273264
arduino_zero_edbg.upload.tool=openocd
274265
arduino_zero_edbg.upload.protocol=sam-ba
275266
[...CUT...]
276267
# Arduino Zero (Native USB Port)
277268
# --------------------------------------
278269
arduino_zero_native.name=Arduino Zero (Native USB Port)
279-
arduino_zero_native.vid.0=0x2341
280-
arduino_zero_native.pid.0=0x804d
281-
arduino_zero_native.vid.1=0x2341
282-
arduino_zero_native.pid.1=0x004d
283-
arduino_zero_native.vid.2=0x2341
284-
arduino_zero_native.pid.2=0x824d
285-
arduino_zero_native.vid.3=0x2341
286-
arduino_zero_native.pid.3=0x024d
270+
arduino_zero_native.upload_port.0.vid=0x2341
271+
arduino_zero_native.upload_port.0.pid=0x804d
272+
arduino_zero_native.upload_port.1.vid=0x2341
273+
arduino_zero_native.upload_port.1.pid=0x004d
274+
arduino_zero_native.upload_port.2.vid=0x2341
275+
arduino_zero_native.upload_port.2.pid=0x824d
276+
arduino_zero_native.upload_port.3.vid=0x2341
277+
arduino_zero_native.upload_port.3.pid=0x024d
287278
arduino_zero_native.upload.tool=bossac
288279
arduino_zero_native.upload.protocol=sam-ba
289280
[...CUT...]
290281
# Arduino MKR1000
291282
# -----------------------
292283
mkr1000.name=Arduino MKR1000
293-
mkr1000.vid.0=0x2341 <------- MATCHING IDs
294-
mkr1000.pid.0=0x804e <------- MATCHING IDs
295-
mkr1000.vid.1=0x2341
296-
mkr1000.pid.1=0x004e
297-
mkr1000.vid.2=0x2341
298-
mkr1000.pid.2=0x824e
299-
mkr1000.vid.3=0x2341
300-
mkr1000.pid.3=0x024e
284+
mkr1000.upload_port.0.vid=0x2341 <------- MATCHING IDs
285+
mkr1000.upload_port.0.pid=0x804e <------- MATCHING IDs
286+
mkr1000.upload_port.1.vid=0x2341
287+
mkr1000.upload_port.1.pid=0x004e
288+
mkr1000.upload_port.2.vid=0x2341
289+
mkr1000.upload_port.2.pid=0x824e
290+
mkr1000.upload_port.3.vid=0x2341
291+
mkr1000.upload_port.3.pid=0x024e
301292
mkr1000.debug.tool=gdb
302293
mkr1000.upload.tool=bossac
303294
mkr1000.upload.protocol=sam-ba
@@ -306,24 +297,24 @@ mkr1000.upload.protocol=sam-ba
306297

307298
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.
308299

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.
310301

311302
We can also specify multiple identification properties for the same board using the `.N` suffix, for example:
312303

313304
```
314305
myboard.name=My Wonderful Arduino Compatible Board
315-
myboard.pears=20
316-
myboard.apples=30
306+
myboard.upload_port.pears=20
307+
myboard.upload_port.apples=30
317308
```
318309

319310
will match on `pears=20, apples=30` but:
320311

321312
```
322313
myboard.name=My Wonderful Arduino Compatible Board
323-
myboard.pears.0=20
324-
myboard.apples.0=30
325-
myboard.pears.1=30
326-
myboard.apples.1=40
314+
myboard.upload_port.0.pears=20
315+
myboard.upload_port.0.apples=30
316+
myboard.upload_port.1.pears=30
317+
myboard.upload_port.1.apples=40
327318
```
328319

329320
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.
@@ -431,15 +422,12 @@ Here another example:
431422
"address": "192.168.1.232",
432423
"label": "SSH on my-board ()192.168.1.232)",
433424
"protocol": "ssh",
434-
"protocolLabel": "SSH Network port"
435-
"properties": {
436-
"macprefix": "AA:BB:CC",
437-
"macaddress": "AA:BB:CC:DD:EE:FF"
438-
},
439-
"identificationPrefs": {
440-
"macprefix": "AA:BB:CC"
441-
}
442-
}
425+
"protocolLabel": "SSH Network port",
426+
"properties": {
427+
"macprefix": "AA:BB:CC",
428+
"macaddress": "AA:BB:CC:DD:EE:FF"
429+
}
430+
}
443431
}
444432
```
445433

0 commit comments

Comments
 (0)