From bfc624f23ed935b6b1d698456a2d22ccb214fde9 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Mon, 11 Jan 2021 14:51:55 -0500 Subject: [PATCH] tools/litex_term: Avoid importing termios and pty on Windows. --- litex/tools/litex_term.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/litex/tools/litex_term.py b/litex/tools/litex_term.py index 904f820dd..37b74feb7 100755 --- a/litex/tools/litex_term.py +++ b/litex/tools/litex_term.py @@ -17,7 +17,6 @@ import threading import multiprocessing import argparse import json -import pty import telnetlib # Console ------------------------------------------------------------------------------------------ @@ -35,6 +34,7 @@ if sys.platform == "win32": return msvcrt.getch() else: import termios + import pty class Console: def __init__(self): self.fd = sys.stdin.fileno() @@ -495,7 +495,10 @@ def main(): print("[LXTERM] --no-crc is deprecated and now does nothing (CRC checking is now fast)") term = LiteXTerm(args.serial_boot, args.kernel, args.kernel_adr, args.images, args.flash) - bridge_cls = {"crossover": CrossoverUART, "jtag_uart": JTAGUART}.get(args.port, None) + if sys.platform == "win32": + bridge_cls = None + else: + bridge_cls = {"crossover": CrossoverUART, "jtag_uart": JTAGUART}.get(args.port, None) if bridge_cls is not None: bridge = bridge_cls() bridge.open()