Skip to content

Commit

Permalink
Fix multi message iso tp requests
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed May 19, 2020
1 parent 0610ed1 commit 5307bf7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/uds.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ def send(self, dat: bytes) -> None:
self._tx_first_frame()

def _tx_first_frame(self) -> None:
if self.tx_len < 8:
if self.tx_len < self.max_len:
# single frame (send all bytes)
if self.debug: print("ISO-TP: TX - single frame")
msg = (bytes([self.tx_len]) + self.tx_dat).ljust(self.max_len, b"\x00")
self.tx_done = True
else:
# first frame (send first 6 bytes)
if self.debug: print("ISO-TP: TX - first frame")
msg = (struct.pack("!H", 0x1000 | self.tx_len) + self.tx_dat[:6]).ljust(self.max_len, b"\x00")
msg = (struct.pack("!H", 0x1000 | self.tx_len) + self.tx_dat[:self.max_len - 2]).ljust(self.max_len - 2, b"\x00")
self._can_client.send([msg])

def recv(self) -> bytes:
Expand Down

0 comments on commit 5307bf7

Please sign in to comment.