diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-16 11:45:52 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-16 11:45:52 +0100 |
commit | ecdf6cdc5bdbb51451604df0713f1b24476f0714 (patch) | |
tree | 9a6e6e9a792325097ded2efdba3e6dfad8d1568d /tools/insert-usb-ids.py | |
parent | bda2f709646f80dc82e52cd664d17cd41e8b2b6a (diff) |
tools: Fix up pybcdc.inf generation: new lines and hex digits.
Using Python's file open in 'r' mode opens it for text reading, which
converts all new lines to \n. Could use 'rb' binary mode, but then
don't have access to the string Template replacement functions. Thus,
force the output to have '\\r\\n' ending.
Also fix regex to match hex digits.
Diffstat (limited to 'tools/insert-usb-ids.py')
-rw-r--r-- | tools/insert-usb-ids.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py index af010dad9..42303da8b 100644 --- a/tools/insert-usb-ids.py +++ b/tools/insert-usb-ids.py @@ -13,7 +13,7 @@ def parse_usb_ids(filename): if filename == 'usbd_desc_cdc_msc.c': for line in open(filename).readlines(): line = line.rstrip('\r\n') - match = re.match('^#define\s+(\w+)\s+0x(\d+)$', line) + match = re.match('^#define\s+(\w+)\s+0x([0-9A-Fa-f]+)$', line) if match: if match.group(1) == 'USBD_VID': rv['USB_VID'] = match.group(2) |