Commit 4c0b81f
committed
[USB] Clean up USB id and string assignment
Previously, there were a few problems:
- USB manufacturer string was only configurable when an unknown VID was
used.
- USB product string would always include CDC/HID and HS/FS indication,
it was not possible to specify the full string.
- USB PID was always hardcoded, depending on the CDC/HID mode. These
hardcoded PIDs are really only valid within the ST PID, so it made
now sense that the vid *could* be specified.
This commit cleans this up:
- Boards must now either specify both the VID and PID, or neither.
- When boards specify no VID and PID, they use the ST VID with a pid
based on the CDC or HID mode like before.
- All boards used to specify the ST vid explicitly in boards.txt, now
they do not and rely on the default in the code.
- When no USB_MANUFACTURER_STRING is defined (can be in boards.txt or
variant.h now), a default is selected based on the VID, or "Unknown"
is used if the VID is unknown.
- When no USB_PRODUCT_STRING is defined (can be in boards.txt or
variant.h now), a default is based on the BOARD_NAME, CDC/HID and
FS/HS mode.
All included boards should work as before. Third-party board
definitions that use this core should be updated:
- If build.vid is 0x0483, it should be removed. Otherwise, both vid and
pid should be specified.
- If build.usb_manufacturer is specified, it should be replaced by
adding '-DUSB_MANUFACTURER_STRING="My Company"' to build.extra-flags.1 parent cc05df9 commit 4c0b81f
3 files changed
+71
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
165 | | - | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
| |||
423 | 421 | | |
424 | 422 | | |
425 | 423 | | |
426 | | - | |
427 | 424 | | |
428 | 425 | | |
429 | 426 | | |
| |||
517 | 514 | | |
518 | 515 | | |
519 | 516 | | |
520 | | - | |
521 | 517 | | |
522 | 518 | | |
523 | 519 | | |
| |||
635 | 631 | | |
636 | 632 | | |
637 | 633 | | |
638 | | - | |
639 | 634 | | |
640 | 635 | | |
641 | 636 | | |
| |||
668 | 663 | | |
669 | 664 | | |
670 | 665 | | |
671 | | - | |
672 | 666 | | |
673 | 667 | | |
674 | 668 | | |
| |||
756 | 750 | | |
757 | 751 | | |
758 | 752 | | |
759 | | - | |
760 | 753 | | |
761 | 754 | | |
762 | 755 | | |
| |||
894 | 887 | | |
895 | 888 | | |
896 | 889 | | |
897 | | - | |
898 | 890 | | |
899 | 891 | | |
900 | 892 | | |
| |||
936 | 928 | | |
937 | 929 | | |
938 | 930 | | |
939 | | - | |
940 | 931 | | |
941 | 932 | | |
942 | 933 | | |
| |||
1123 | 1114 | | |
1124 | 1115 | | |
1125 | 1116 | | |
1126 | | - | |
1127 | 1117 | | |
1128 | 1118 | | |
1129 | 1119 | | |
| |||
1172 | 1162 | | |
1173 | 1163 | | |
1174 | 1164 | | |
1175 | | - | |
1176 | 1165 | | |
1177 | 1166 | | |
1178 | 1167 | | |
| |||
1209 | 1198 | | |
1210 | 1199 | | |
1211 | 1200 | | |
1212 | | - | |
1213 | 1201 | | |
1214 | 1202 | | |
1215 | 1203 | | |
| |||
1280 | 1268 | | |
1281 | 1269 | | |
1282 | 1270 | | |
1283 | | - | |
1284 | 1271 | | |
1285 | 1272 | | |
1286 | 1273 | | |
| |||
1296 | 1283 | | |
1297 | 1284 | | |
1298 | 1285 | | |
1299 | | - | |
1300 | | - | |
1301 | 1286 | | |
1302 | 1287 | | |
1303 | 1288 | | |
| |||
1446 | 1431 | | |
1447 | 1432 | | |
1448 | 1433 | | |
1449 | | - | |
1450 | 1434 | | |
1451 | 1435 | | |
1452 | 1436 | | |
| |||
1531 | 1515 | | |
1532 | 1516 | | |
1533 | 1517 | | |
1534 | | - | |
1535 | 1518 | | |
1536 | 1519 | | |
1537 | 1520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
28 | 54 | | |
29 | 55 | | |
30 | 56 | | |
31 | 57 | | |
32 | 58 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 59 | | |
37 | | - | |
| 60 | + | |
38 | 61 | | |
| 62 | + | |
39 | 63 | | |
40 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
41 | 81 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
49 | 86 | | |
50 | 87 | | |
51 | 88 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
59 | 93 | | |
60 | 94 | | |
61 | 95 | | |
| |||
99 | 133 | | |
100 | 134 | | |
101 | 135 | | |
102 | | - | |
103 | | - | |
| 136 | + | |
| 137 | + | |
104 | 138 | | |
105 | 139 | | |
106 | 140 | | |
| |||
123 | 157 | | |
124 | 158 | | |
125 | 159 | | |
126 | | - | |
127 | | - | |
| 160 | + | |
| 161 | + | |
128 | 162 | | |
129 | 163 | | |
130 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| |||
0 commit comments