litex_term: make sure to unconfigure console when board is unplugged
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 6 Aug 2019 06:46:25 +0000 (08:46 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 6 Aug 2019 06:46:25 +0000 (08:46 +0200)
litex/tools/litex_term.py

index 1cd9a5131b02acac6c6aaf5e64ae28f2b5da3078..a075615e386ecb50becd83efd88bf5a4d7564b3d 100755 (executable)
@@ -268,6 +268,7 @@ class LiteXTerm:
 
         except serial.SerialException:
             self.reader_alive = False
+            self.console.unconfigure()
             raise
 
     def start_reader(self):
@@ -292,6 +293,7 @@ class LiteXTerm:
                     self.port.write(b)
         except:
             self.writer_alive = False
+            self.console.unconfigure()
             raise
 
     def start_writer(self):
@@ -334,8 +336,8 @@ def _get_args():
 def main():
     args = _get_args()
     term = LiteXTerm(args.serial_boot, args.kernel, args.kernel_adr, args.images)
-    term.console.configure()
     term.open(args.port, int(float(args.speed)))
+    term.console.configure()
     term.start()
     term.join(True)