summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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