Merge pull request #1648 from dalegaard/bugfix/litex_term_connect_timeout

litex_term: improve connection setup
This commit is contained in:
enjoy-digital 2023-03-15 09:14:55 +01:00 committed by GitHub
commit cbf4db076e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -144,11 +144,15 @@ class JTAGUART:
self.alive = True
self.jtag2tcp_thread = threading.Thread(target=self.jtag2tcp, daemon=True)
self.jtag2tcp_thread.start()
time.sleep(0.5)
self.pty2tcp_thread = threading.Thread(target=self.pty2tcp, daemon=True)
self.tcp2pty_thread = threading.Thread(target=self.tcp2pty, daemon=True)
self.tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.tcp.connect(("localhost", self.port))
for _ in range(0, 50):
try:
self.tcp.connect(("localhost", self.port))
break
except ConnectionRefusedError:
time.sleep(0.1)
self.pty2tcp_thread.start()
self.tcp2pty_thread.start()