Skip to content

Commit

Permalink
add pandadebug support
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Jan 24, 2018
1 parent b5e4962 commit b68957e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")

DEBUG = os.getenv("PANDADEBUG") is not None

# *** wifi mode ***

def build_st(target, mkfile="Makefile"):
Expand All @@ -34,7 +36,10 @@ def parse_can_buffer(dat):
address = f1 >> 3
else:
address = f1 >> 21
ret.append((address, f2>>16, ddat[8:8+(f2&0xF)], (f2>>4)&0xFF))
dddat = ddat[8:8+(f2&0xF)]
if DEBUG:
print(" R %x: %s" % (address, str(dddat).encode("hex")))
ret.append((address, f2>>16, dddat, (f2>>4)&0xFF))
return ret

class PandaWifiStreaming(object):
Expand Down Expand Up @@ -369,6 +374,8 @@ def can_send_many(self, arr):
extended = 4
for addr, _, dat, bus in arr:
assert len(dat) <= 8
if DEBUG:
print(" W %x: %s" % (addr, dat.encode("hex")))
if addr >= 0x800:
rir = (addr << 3) | transmit | extended
else:
Expand Down

0 comments on commit b68957e

Please sign in to comment.