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):
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
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:
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":
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__":