m1n1.proxy: Allow overriding default timeout with M1N1TIMEOUT

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-08-23 17:03:20 +09:00
parent 017f050fff
commit cc39491863
2 changed files with 3 additions and 2 deletions

View file

@ -139,7 +139,7 @@ class UartInterface(Reloadable):
#d = self.dev.read(1)
#while d != "":
#d = self.dev.read(1)
self.dev.timeout = 3
self.dev.timeout = int(os.environ.get("M1N1TIMEOUT", "3"))
self.tty_enable = True
self.handlers = {}
self.evt_handlers = {}

View file

@ -441,6 +441,7 @@ class GuardedHeap:
self.ptrs = set()
def bootstrap_port(iface, proxy):
to = iface.dev.timeout
try:
iface.dev.timeout = 0.15
iface.nop()
@ -449,4 +450,4 @@ def bootstrap_port(iface, proxy):
iface.dev.baudrate = 1500000
iface.nop()
iface.dev.timeout = 3
iface.dev.timeout = to