diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-02-14 15:09:45 +0100 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-02-14 15:57:49 +0100 |
commit | 589fab595ad96d75d8a2bfba051b608c5f0b438b (patch) | |
tree | 826939bb4da04d198cfbbffc708c15abad4be72c /lavalab-gen.py | |
parent | 19d2b8a497597f49dc20f4902e2f29f31696ce92 (diff) |
Force the use of hexadecimal values for product/vendor IDs
Using "idproduct: 6001" let python convert 6001 to 24577 and so corrupt
the UDEV line.
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-x | lavalab-gen.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py index 5e79dc5..f151aa1 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -92,13 +92,19 @@ def main(args): baud = b["uart"].get("baud", baud_default) idvendor = b["uart"]["idvendor"] idproduct = b["uart"]["idproduct"] + if type(idproduct) == str: + print("Please put hexadecimal IDs for product %s (like 0x%s)" % (board_name,idproduct)) + sys.exit(1) + if type(idvendor) == str: + print("Please put hexadecimal IDs for vendor %s (like 0x%s)" % (board_name,idvendor)) + sys.exit(1) line = template_conmux.substitute(board=board_name, baud=baud) if "serial" in uart: serial = b["uart"]["serial"] - udev_line += template_udev_serial.substitute(board=board_name, serial=serial, idvendor=idvendor, idproduct=idproduct) + udev_line += template_udev_serial.substitute(board=board_name, serial=serial, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct) else: devpath = b["uart"]["devpath"] - udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor=idvendor, idproduct=idproduct) + udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct) if "devices" in dockcomp["services"][lab_name]: dc_devices = dockcomp["services"][lab_name]["devices"] else: |