summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-02-07 11:57:16 -0800
committerGitHub <noreply@github.com>2018-02-07 11:57:16 -0800
commit0ed26a14fa423c03fc9782bb05c9470105440670 (patch)
treebb7e4ddc428329806a128fd487a7b1ae5ab64e7e
parente133ad82d7f0bb710f3f1a2b1f12ad932e577592 (diff)
parent45449dafeb3a54c47e022dbb86ad4eb44ea71385 (diff)
Merge pull request #19 from montjoie/more_board_attributes
More board attributes
-rwxr-xr-xlavalab-gen.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 55f2317..f8a5d95 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -28,14 +28,20 @@ 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}' %}
{% 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,15 +82,28 @@ 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)
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("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