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>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user