tools/litex_term: Avoid importing termios and pty on Windows.

This commit is contained in:
William D. Jones 2021-01-11 14:51:55 -05:00
parent 460fada3ac
commit bfc624f23e
1 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,6 @@ import threading
import multiprocessing import multiprocessing
import argparse import argparse
import json import json
import pty
import telnetlib import telnetlib
# Console ------------------------------------------------------------------------------------------ # Console ------------------------------------------------------------------------------------------
@ -35,6 +34,7 @@ if sys.platform == "win32":
return msvcrt.getch() return msvcrt.getch()
else: else:
import termios import termios
import pty
class Console: class Console:
def __init__(self): def __init__(self):
self.fd = sys.stdin.fileno() self.fd = sys.stdin.fileno()
@ -495,6 +495,9 @@ def main():
print("[LXTERM] --no-crc is deprecated and now does nothing (CRC checking is now fast)") 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) term = LiteXTerm(args.serial_boot, args.kernel, args.kernel_adr, args.images, args.flash)
if sys.platform == "win32":
bridge_cls = None
else:
bridge_cls = {"crossover": CrossoverUART, "jtag_uart": JTAGUART}.get(args.port, None) bridge_cls = {"crossover": CrossoverUART, "jtag_uart": JTAGUART}.get(args.port, None)
if bridge_cls is not None: if bridge_cls is not None:
bridge = bridge_cls() bridge = bridge_cls()