flashtool: increase default read timeout

Signed-off-by:  Eric Callahan <arksine.code@gmail.com
This commit is contained in:
Eric Callahan 2024-09-03 15:24:48 -04:00
parent 730fde48ab
commit 10abb2a086
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B

View File

@ -207,9 +207,11 @@ class CanFlasher:
tries -= 1 tries -= 1
# clear the read buffer # clear the read buffer
try: try:
await self.node.read(1024, timeout=.1) ret = await self.node.read(1024, timeout=.25)
except asyncio.TimeoutError: except asyncio.TimeoutError:
pass pass
else:
logging.info(f"Read Buffer Contents: {ret!r}")
await asyncio.sleep(.1) await asyncio.sleep(.1)
raise FlashError("Error sending command [%s] to Device" % (cmdname)) raise FlashError("Error sending command [%s] to Device" % (cmdname))
@ -300,17 +302,17 @@ class CanNode:
self._cansocket = cansocket self._cansocket = cansocket
async def read( async def read(
self, n: int = -1, timeout: Optional[float] = 2 self, n: int = -1, timeout: Optional[float] = 5.
) -> bytes: ) -> bytes:
return await asyncio.wait_for(self._reader.read(n), timeout) return await asyncio.wait_for(self._reader.read(n), timeout)
async def readexactly( async def readexactly(
self, n: int, timeout: Optional[float] = 2 self, n: int, timeout: Optional[float] = 5.
) -> bytes: ) -> bytes:
return await asyncio.wait_for(self._reader.readexactly(n), timeout) return await asyncio.wait_for(self._reader.readexactly(n), timeout)
async def readuntil( async def readuntil(
self, sep: bytes = b"\x03", timeout: Optional[float] = 2 self, sep: bytes = b"\x03", timeout: Optional[float] = 5.
) -> bytes: ) -> bytes:
return await asyncio.wait_for(self._reader.readuntil(sep), timeout) return await asyncio.wait_for(self._reader.readuntil(sep), timeout)