Files
dragonpilot/selfdrive/debug/get_fingerprint.py

30 lines
1002 B
Python
Raw Normal View History

2019-10-09 18:43:53 +00:00
#!/usr/bin/env python3
2018-01-16 16:51:33 -08:00
# simple script to get a vehicle fingerprint.
# Instructions:
# - connect to a Panda
# - run selfdrive/boardd/boardd
# - launching this script
2019-05-28 17:12:49 -07:00
# - turn on the car in STOCK MODE (set giraffe switches properly).
# Note: it's very important that the car is in stock mode, in order to collect a complete fingerprint
# - since some messages are published at low frequency, keep this script running for at least 30s,
# until all messages are received at least once
2018-01-16 16:51:33 -08:00
import selfdrive.messaging as messaging
2019-10-31 17:14:40 -07:00
logcan = messaging.sub_sock('can')
2018-01-16 16:51:33 -08:00
msgs = {}
while True:
lc = messaging.recv_sock(logcan, True)
for c in lc.can:
2018-06-16 20:59:34 -07:00
# read also msgs sent by EON on CAN bus 0x80 and filter out the
# addr with more than 11 bits
2019-10-31 17:14:40 -07:00
if c.src in [0, 2] and c.address < 0x800:
2018-01-16 16:51:33 -08:00
msgs[c.address] = len(c.dat)
fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items()))
2019-04-23 01:41:19 +00:00
print("number of messages {0}:".format(len(msgs)))
print("fingerprint {0}".format(fingerprint))