From 3017583fc45d5819f89e4b799502da44b930eb53 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 11 Jan 2018 16:42:38 +0100 Subject: 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. --- lavalab-gen.py | 18 ++++++++++++++---- 1 file 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) -- cgit 1.2.3-korg From 4278e548edc710a4432d3badadb9ae3644937a9c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 11 Jan 2018 16:56:25 +0100 Subject: Implement connection_command connection_command is a generic way to get console from devices. It could ran telnet for accessin ser2net for example. --- lavalab-gen.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lavalab-gen.py b/lavalab-gen.py index b7b4356..0e6408f 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -28,6 +28,9 @@ template_device = string.Template("""{% extends '${devicetype}.jinja2' %} template_device_conmux = string.Template(""" {% set connection_command = 'conmux-console ${board}' %} """) +template_device_connection_command = string.Template("""# +{% set connection_command = '${connection_command}' %} +""") template_device_pdu_generic = string.Template(""" {% set hard_reset_command = '${hard_reset_command}' %} {% set power_off_command = '${power_off_command}' %} @@ -95,6 +98,9 @@ def main(args): fp.write(line) fp.close() device_line += template_device_conmux.substitute(board=board_name) + elif b.has_key("connection_command"): + connection_command = b["connection_command"] + device_line += template_device_connection_command.substitute(connection_command=connection_command) if b.has_key("fastboot_serial_number"): fserial = b["fastboot_serial_number"] device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial -- cgit 1.2.3-korg From 45449dafeb3a54c47e022dbb86ad4eb44ea71385 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 11 Jan 2018 16:58:14 +0100 Subject: Handle optional macaddr Some boards need to have a macaddr set in uboot (like meson-gxl-s905x-libretech-cc) This patch add support for it. --- lavalab-gen.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lavalab-gen.py b/lavalab-gen.py index 0e6408f..f8a5d95 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -101,6 +101,9 @@ def main(args): elif b.has_key("connection_command"): connection_command = b["connection_command"] device_line += template_device_connection_command.substitute(connection_command=connection_command) + if b.has_key("macaddr"): + device_line += '{% set uboot_set_mac = true %}' + device_line += "{%% set uboot_mac_addr = '%s' %%}" % b["macaddr"] if b.has_key("fastboot_serial_number"): fserial = b["fastboot_serial_number"] device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial -- cgit 1.2.3-korg