From 1e41659aab31226efbea621e636227ec4b898f94 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 28 Aug 2023 23:08:41 -0700 Subject: [PATCH] Revert "iso-tp: more checks (#1487)" (#1616) * Revert "iso-tp: return if updated (#1610)" This reverts commit 0eb04fae67646e283b7d750d1e2119e37c398f95. * Revert "iso-tp: more sanity checks (#1487)" This reverts commit 01db9e4a83b6d5e910e09f8bd696568904df31bb. --- python/uds.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/python/uds.py b/python/uds.py index 7d2a0ce0d6..9b25dffe66 100644 --- a/python/uds.py +++ b/python/uds.py @@ -449,18 +449,18 @@ def recv(self, timeout=None) -> Tuple[Optional[bytes], bool]: timeout = self.timeout start_time = time.monotonic() - updated = False + rx_in_progress = False try: while True: for msg in self._can_client.recv(): - self._isotp_rx_next(msg) + frame_type = self._isotp_rx_next(msg) start_time = time.monotonic() - updated = True + rx_in_progress = frame_type == ISOTP_FRAME_TYPE.CONSECUTIVE if self.tx_done and self.rx_done: - return self.rx_dat, updated + return self.rx_dat, False # no timeout indicates non-blocking if timeout == 0: - return None, updated + return None, rx_in_progress if time.monotonic() - start_time > timeout: raise MessageTimeoutError("timeout waiting for response") finally: @@ -473,7 +473,6 @@ def _isotp_rx_next(self, rx_data: bytes) -> ISOTP_FRAME_TYPE: # assert len(rx_data) == self.max_len, f"isotp - rx: invalid CAN frame length: {len(rx_data)}" if rx_data[0] >> 4 == ISOTP_FRAME_TYPE.SINGLE: - assert not self.rx_done, "isotp - rx: unexpected single frame" self.rx_len = rx_data[0] & 0x0F assert self.rx_len < self.max_len, f"isotp - rx: invalid single frame length: {self.rx_len}" self.rx_dat = rx_data[1:1 + self.rx_len] @@ -484,7 +483,6 @@ def _isotp_rx_next(self, rx_data: bytes) -> ISOTP_FRAME_TYPE: return ISOTP_FRAME_TYPE.SINGLE elif rx_data[0] >> 4 == ISOTP_FRAME_TYPE.FIRST: - assert self.rx_dat == b"", "isotp - rx: first frame with data already received" self.rx_len = ((rx_data[0] & 0x0F) << 8) + rx_data[1] assert self.max_len <= self.rx_len, f"isotp - rx: invalid first frame length: {self.rx_len}" self.rx_dat = rx_data[2:]