From 28a5ad1646b2994853e310354b604547950a55c0 Mon Sep 17 00:00:00 2001 From: Nick Sanders Date: Thu, 14 Sep 2017 16:16:10 -0700 Subject: servo: add usb updater This updater combines console and firmware update commands to update both RO and RW sections of servo_v4 and servo_micro. BRANCH=None BUG=b:37513705 TEST=updated firmware Change-Id: I9f585c90f5849f8dd7c9d2e08111ffbd5770fd54 Signed-off-by: Nick Sanders Reviewed-on: https://chromium-review.googlesource.com/668156 Reviewed-by: Nicolas Boichat --- extra/tigertool/ecusb/stm32uart.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'extra/tigertool/ecusb/stm32uart.py') diff --git a/extra/tigertool/ecusb/stm32uart.py b/extra/tigertool/ecusb/stm32uart.py index 3f39b23faa..459ca8e90f 100644 --- a/extra/tigertool/ecusb/stm32uart.py +++ b/extra/tigertool/ecusb/stm32uart.py @@ -4,6 +4,8 @@ """Allow creation of uart/console interface via stm32 usb endpoint.""" +from __future__ import print_function + import os import select import sys @@ -33,7 +35,7 @@ class SuartError(Exception): class Suart(object): """Provide interface to stm32 serial usb endpoint.""" def __init__(self, vendor=0x18d1, product=0x501a, interface=0, - serialname=None, ftdi_context=None): + serialname=None, debuglog=False): """Suart contstructor. Initializes stm32 USB stream interface. @@ -42,8 +44,8 @@ class Suart(object): vendor: usb vendor id of stm32 device product: usb product id of stm32 device interface: interface number of stm32 device to use - serialname: n/a. Defaults to None. - ftdi_context: n/a. Defaults to None. + serialname: serial name to target. Defaults to None. + debuglog: chatty output. Defaults to False. Raises: SuartError: If init fails @@ -53,6 +55,7 @@ class Suart(object): self._ptyname = None self._rx_thread = None self._tx_thread = None + self._debuglog = debuglog self._susb = stm32usb.Susb(vendor=vendor, product=product, interface=interface, serialname=serialname) self._running = False @@ -83,6 +86,8 @@ class Suart(object): try: r = self._susb._read_ep.read(64, self._susb.TIMEOUT_MS) if r: + if self._debuglog: + print(''.join([chr(x) for x in r]), end='') os.write(self._ptym, r) # If we miss some characters on pty disconnect, that's fine. -- cgit v1.2.1