summaryrefslogtreecommitdiff
path: root/tools/insert-usb-ids.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-08-01 11:04:15 +1000
committerDamien George <damien@micropython.org>2021-08-07 23:13:55 +1000
commit96c6b8cae3ad5037c41f4e029974fb17d727d012 (patch)
treeff028e52838ef1cfa677578cd217eaf64339bf12 /tools/insert-usb-ids.py
parent45f9a38451ce7419c9a97f8f2b471746a383c7b7 (diff)
ports: Rename USBD_VID/PID config macros to MICROPY_HW_USB_VID/PID.
For consistency with other board-level config macros that begin with MICROPY_HW_USB. Also allow boards in the mimxrt, nrf and samd ports to configure these values. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tools/insert-usb-ids.py')
-rw-r--r--tools/insert-usb-ids.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py
index b1d848ad4..9b53f3f68 100644
--- a/tools/insert-usb-ids.py
+++ b/tools/insert-usb-ids.py
@@ -8,6 +8,7 @@ import sys
import re
import string
+config_prefix = "MICROPY_HW_USB_"
needed_keys = ("USB_PID_CDC_MSC", "USB_PID_CDC_HID", "USB_PID_CDC", "USB_VID")
@@ -16,10 +17,10 @@ def parse_usb_ids(filename):
for line in open(filename).readlines():
line = line.rstrip("\r\n")
match = re.match("^#define\s+(\w+)\s+\(0x([0-9A-Fa-f]+)\)$", line)
- if match and match.group(1).startswith("USBD_"):
- key = match.group(1).replace("USBD", "USB")
+ if match and match.group(1).startswith(config_prefix):
+ key = match.group(1).replace(config_prefix, "USB_")
val = match.group(2)
- print("key =", key, "val =", val)
+ # print("key =", key, "val =", val)
if key in needed_keys:
rv[key] = val
for k in needed_keys: