summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-02-14 15:09:45 +0100
committerCorentin LABBE <clabbe@baylibre.com>2018-02-14 15:57:49 +0100
commit589fab595ad96d75d8a2bfba051b608c5f0b438b (patch)
tree826939bb4da04d198cfbbffc708c15abad4be72c
parent19d2b8a497597f49dc20f4902e2f29f31696ce92 (diff)
Force the use of hexadecimal values for product/vendor IDs
Using "idproduct: 6001" let python convert 6001 to 24577 and so corrupt the UDEV line.
-rw-r--r--README.md4
-rw-r--r--boards.yaml.example24
-rwxr-xr-xlavalab-gen.py10
3 files changed, 22 insertions, 16 deletions
diff --git a/README.md b/README.md
index e54b729..a3c297c 100644
--- a/README.md
+++ b/README.md
@@ -223,8 +223,8 @@ lab-slave-XX: The name of the slave (where XX is a number)
macaddr: (Optional) the MAC address to set in uboot
# One of uart or connection_command must be choosen
uart:
- idvendor: The VID of the UART
- idproduct: the PID of the UART
+ idvendor: The VID of the UART (Formated as 0xXXXX)
+ idproduct: the PID of the UART (Formated as 0xXXXX)
serial: The serial number in case of FTDI uart
devpath: the UDEV devpath to this uart for UART without serial number
connection_command: A command to be ran for getting a serial console
diff --git a/boards.yaml.example b/boards.yaml.example
index e989af9..1e485a4 100644
--- a/boards.yaml.example
+++ b/boards.yaml.example
@@ -10,8 +10,8 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 1
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 1
uart:
- idvendor: "0403"
- idproduct: 6001
+ idvendor: 0x0403
+ idproduct: 0x6001
serial: FT9QQZTA
am335x-boneblack-01:
type: beaglebone-black
@@ -20,8 +20,8 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 2
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 2
uart:
- idvendor: "0403"
- idproduct: 6001
+ idvendor: 0x0403
+ idproduct: 0x6001
serial: FT9QR1A9
meson-gxl-s905x-libretech-cc-01:
type: meson-gxl-s905x-libretech-cc
@@ -30,8 +30,8 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 3
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 3
uart:
- idvendor: 067b
- idproduct: 2303
+ idvendor: 0x067b
+ idproduct: 0x2303
devpath: 1.1.4
macaddr: "00:FA:E0:DE:AD:78"
dragonboard-410c-01:
@@ -41,8 +41,8 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 4
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 4
uart:
- idvendor: "0403"
- idproduct: 6001
+ idvendor: 0x403
+ idproduct: 0x6001
serial: FT9R7VDB
r8a7796-m3ulcb-01:
type: r8a7796-m3ulcb
@@ -51,8 +51,8 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 5
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 5
uart:
- idvendor: "0403"
- idproduct: 6001
+ idvendor: 0x0403
+ idproduct: 0x6001
serial: AK04WW0Q
imx6q-sabrelite-01:
type: imx6q-sabrelite
@@ -61,6 +61,6 @@ lab-slave-0:
power_off_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_off 6
power_on_command: /usr/local/bin/acme-cli -s 192.168.66.2 switch_on 6
uart:
- idvendor: "0403"
- idproduct: 6015
+ idvendor: 0x0403
+ idproduct: 0x6015
serial: DAZ0KEUH
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 5e79dc5..f151aa1 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -92,13 +92,19 @@ def main(args):
baud = b["uart"].get("baud", baud_default)
idvendor = b["uart"]["idvendor"]
idproduct = b["uart"]["idproduct"]
+ if type(idproduct) == str:
+ print("Please put hexadecimal IDs for product %s (like 0x%s)" % (board_name,idproduct))
+ sys.exit(1)
+ if type(idvendor) == str:
+ print("Please put hexadecimal IDs for vendor %s (like 0x%s)" % (board_name,idvendor))
+ sys.exit(1)
line = template_conmux.substitute(board=board_name, baud=baud)
if "serial" in uart:
serial = b["uart"]["serial"]
- udev_line += template_udev_serial.substitute(board=board_name, serial=serial, idvendor=idvendor, idproduct=idproduct)
+ udev_line += template_udev_serial.substitute(board=board_name, serial=serial, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct)
else:
devpath = b["uart"]["devpath"]
- udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor=idvendor, idproduct=idproduct)
+ udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct)
if "devices" in dockcomp["services"][lab_name]:
dc_devices = dockcomp["services"][lab_name]["devices"]
else: