mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/tools/litex_term: continue cleanup
This commit is contained in:
parent
2fa848c15f
commit
042c36ee1b
1 changed files with 9 additions and 17 deletions
|
@ -116,7 +116,7 @@ class LiteXTerm:
|
|||
self.reader_alive = False
|
||||
self.writer_alive = False
|
||||
|
||||
self.promp_detect_buffer = bytes(len(sfl_prompt_req))
|
||||
self.prompt_detect_buffer = bytes(len(sfl_prompt_req))
|
||||
self.magic_detect_buffer = bytes(len(sfl_magic_req))
|
||||
|
||||
def open(self, port, baudrate):
|
||||
|
@ -182,8 +182,8 @@ class LiteXTerm:
|
|||
|
||||
def detect_prompt(self, data):
|
||||
if len(data):
|
||||
self.promp_detect_buffer = self.promp_detect_buffer[1:] + data
|
||||
return self.promp_detect_buffer == sfl_prompt_req
|
||||
self.prompt_detect_buffer = self.prompt_detect_buffer[1:] + data
|
||||
return self.prompt_detect_buffer == sfl_prompt_req
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -213,11 +213,7 @@ class LiteXTerm:
|
|||
if c == b"\r":
|
||||
sys.stdout.write(b"\n")
|
||||
else:
|
||||
try:
|
||||
# TODO: cleanup
|
||||
sys.stdout.write(c.decode())
|
||||
except:
|
||||
pass
|
||||
sys.stdout.buffer.write(c)
|
||||
sys.stdout.flush()
|
||||
|
||||
if self.kernel_image is not None:
|
||||
|
@ -243,10 +239,7 @@ class LiteXTerm:
|
|||
def writer(self):
|
||||
try:
|
||||
while self.writer_alive:
|
||||
try:
|
||||
b = getkey()
|
||||
except KeyboardInterrupt:
|
||||
b = b"\x03"
|
||||
b = getkey()
|
||||
if b == b"\x03":
|
||||
self.stop()
|
||||
elif b == b"\n":
|
||||
|
@ -296,13 +289,12 @@ def _get_args():
|
|||
def main():
|
||||
args = _get_args()
|
||||
term = LiteXTerm(args.serial_boot, args.kernel, args.kernel_adr)
|
||||
term.open(args.port, args.speed)
|
||||
term.start()
|
||||
try:
|
||||
term.open(args.port, args.speed)
|
||||
term.start()
|
||||
term.join(True)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
term.close()
|
||||
finally:
|
||||
term.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue