diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-01-11 16:42:38 +0100 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-02-02 14:27:37 +0100 |
commit | 3017583fc45d5819f89e4b799502da44b930eb53 (patch) | |
tree | 7e3c564ce285567b14e042afdd61d56327d5b8be /lavalab-gen.py | |
parent | dd13a9f0eb4732e72082738f800b81a92d0eb10c (diff) |
lavalab-gen.py: Handle non-FTDI UART via devpath
This patch add support for non-FTDI UART by adding a devpath member.
Since both FTDI and non-FTDI need also idevendor/idproduct, this patch
introduce them.
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-x | lavalab-gen.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py index 55f2317..b7b4356 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -34,8 +34,11 @@ template_device_pdu_generic = string.Template(""" {% set power_on_command = '${power_on_command}' %} """) -template_udev = string.Template("""# -SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="${serial}", MODE="0664", OWNER="uucp", SYMLINK+="${board}" +template_udev_serial = string.Template("""# +SUBSYSTEM=="tty", ATTRS{idVendor}=="${idvendor}", ATTRS{idProduct}=="${idproduct}", ATTRS{serial}=="${serial}", MODE="0664", OWNER="uucp", SYMLINK+="${board}" +""") +template_udev_devpath = string.Template("""# +SUBSYSTEM=="tty", ATTRS{idVendor}=="${idvendor}", ATTRS{idProduct}=="${idproduct}", ATTRS{devpath}=="${devpath}", MODE="0664", OWNER="uucp", SYMLINK+="${board}" """) def main(args): @@ -76,10 +79,17 @@ def main(args): power_on_command = b["pdu_generic"]["power_on_command"] device_line += template_device_pdu_generic.substitute(hard_reset_command=hard_reset_command, power_off_command=power_off_command, power_on_command=power_on_command) if b.has_key("uart"): + uart = b["uart"] baud = b["uart"].get("baud", baud_default) + idvendor = b["uart"]["idvendor"] + idproduct = b["uart"]["idproduct"] line = template_conmux.substitute(board=board_name, baud=baud) - serial = b["uart"]["serial"] - udev_line += template_udev.substitute(board=board_name, serial=serial) + if uart.has_key("serial"): + serial = b["uart"]["serial"] + udev_line += template_udev_serial.substitute(board=board_name, serial=serial, idvendor=idvendor, idproduct=idproduct) + else: + devpath = b["uart"]["devpath"] + udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor=idvendor, idproduct=idproduct) dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name)) fp = open("lava-slave/conmux/%s.cf" % board_name, "w") fp.write(line) |