aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-11-19 10:54:28 +0100
committerCorentin LABBE <clabbe@baylibre.com>2018-11-20 12:15:37 +0100
commit17d04b53f1e857ce95c3917c7cc9f90fc45e4dcc (patch)
tree0d71301ce90ba093d69cd35bbfa6e20956d0b67a
parentf7ea4ac6d1197d0d5b2a45456e5d4abb964a2726 (diff)
lavalab-gen.py: support adding ser2net options
-rw-r--r--README.md3
-rwxr-xr-xlavalab-gen.py12
2 files changed, 9 insertions, 6 deletions
diff --git a/README.md b/README.md
index 97129c8..bdbfee5 100644
--- a/README.md
+++ b/README.md
@@ -287,6 +287,9 @@ boards:
devpath: the UDEV devpath to this uart for UART without serial number
interfacenum: (optional) The interfacenumber of the serial. (Used with two serial in one device)
use_ser2net: True/false (Use ser2net instead of conmux-console)
+ ser2net_options (optional) A list of ser2net options to add
+ - option1
+ - option2
use_screen: True/false (Use screen via ssh instead of conmux-console)
connection_command: A command to be ran for getting a serial console
pdu_generic:
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 9eae28e..4287efc 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -38,9 +38,6 @@ template_device_pdu_generic = string.Template("""
{% set power_on_command = '${power_on_command}' %}
""")
-template_ser2net = string.Template("""
-${port}:telnet:600:/dev/${board}:${baud} 8DATABITS NONE 1STOPBIT banner
-""")
template_device_ser2net = string.Template("""
{% set connection_command = 'telnet 127.0.0.1 ${port}' %}
""")
@@ -482,13 +479,16 @@ def main():
if not worker_name in ser2net_ports:
ser2net_ports[worker_name] = ser2net_port_start
fp = open("%s/ser2net.conf" % workerdir, "a")
- fp.write("DEFAULT:max-connections:10")
+ fp.write("DEFAULT:max-connections:10\n")
fp.close()
- ser2net_line = template_ser2net.substitute(port=ser2net_ports[worker_name],baud=baud,board=board_name)
+ ser2net_line = "%d:telnet:600:/dev/%s:%d 8DATABITS NONE 1STOPBIT" % (ser2net_ports[worker_name], board_name, baud)
+ if "ser2net_options" in uart:
+ for ser2net_option in uart["ser2net_options"]:
+ ser2net_line += " %s" % ser2net_option
device_line += template_device_ser2net.substitute(port=ser2net_ports[worker_name])
ser2net_ports[worker_name] += 1
fp = open("%s/ser2net.conf" % workerdir, "a")
- fp.write(ser2net_line)
+ fp.write(ser2net_line + " banner\n")
fp.close()
if use_screen:
device_line += template_device_screen.substitute(board=board_name)