Skip to content

Commit

Permalink
should have bounty to refactor that ish
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Mar 8, 2018
1 parent b65d30c commit 083cd12
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/isotp.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def isotp_send(panda, x, addr, bus=0, recvaddr=None, subaddr=None):
# actually send
panda.can_send(addr, ss, bus)
rr = recv(panda, 1, recvaddr, bus)[0]
panda.can_send_many([(addr, None, s, 0) for s in sends])
if rr.find("\x30\x01"):
for s in sends[:-1]:
panda.can_send(addr, s, 0)
rr = recv(panda, 1, recvaddr, bus)[0]
panda.can_send(addr, sends[-1], 0)
else:
panda.can_send_many([(addr, None, s, 0) for s in sends])

def isotp_recv_subaddr(panda, addr, bus, sendaddr, subaddr):
msg = recv(panda, 1, addr, bus)[0]
Expand Down Expand Up @@ -83,6 +89,7 @@ def isotp_recv_subaddr(panda, addr, bus, sendaddr, subaddr):
tlen = ord(msg[1]) & 0xf
dat = msg[2:]
else:
print msg.encode("hex")
assert False

return dat[0:tlen]
Expand Down

0 comments on commit 083cd12

Please sign in to comment.