summaryrefslogtreecommitdiff
path: root/extra/usb_serial
diff options
context:
space:
mode:
authorNick Sanders <nsanders@chromium.org>2017-11-15 15:42:28 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-16 21:07:40 -0800
commit26090a142b922dfe728a24241b60d47c50112b15 (patch)
tree57cfd9d2508fe0c8d6cdc93ac6972a38dbb13a98 /extra/usb_serial
parent80ef3f073e87cfba80666c922111b4c922769279 (diff)
downloadchrome-ec-26090a142b922dfe728a24241b60d47c50112b15.tar.gz
servo: add usb_console to chroot
add usb_console, console.py to chroot install. This tool allows directly accessing the usb console of servo v4, servo micro, cr50, etc. BUG=b:69016431 BRANCH=None TEST=usb_console -d 18d1:501b Change-Id: If9d5d49cf31d785ea9a7cec0a4eeeb34abae9cd1 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/773400
Diffstat (limited to 'extra/usb_serial')
-rwxr-xr-xextra/usb_serial/console.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/extra/usb_serial/console.py b/extra/usb_serial/console.py
index 36cd52c361..2494c59c79 100755
--- a/extra/usb_serial/console.py
+++ b/extra/usb_serial/console.py
@@ -242,7 +242,14 @@ parser.add_argument('-s', '--serialno', type=str,
help="serial number of device", default="")
-def main():
+def runconsole():
+ """Run the usb console code
+
+ Starts the pty thread, and idles until a ^C is caught.
+
+ Raises:
+ KeyboardInterrupt on ^C.
+ """
args = parser.parse_args()
vidstr, pidstr = args.device.split(':')
@@ -264,7 +271,7 @@ def main():
while sobj.running():
time.sleep(.1)
-if __name__ == '__main__':
+def main():
global old_settings
global fd
try:
@@ -274,7 +281,7 @@ if __name__ == '__main__':
except:
pass
try:
- main()
+ runconsole()
except KeyboardInterrupt:
sobj.exit()
except Exception as e:
@@ -285,3 +292,7 @@ if __name__ == '__main__':
traceback.print_exc()
finally:
force_exit()
+
+
+if __name__ == '__main__':
+ main()