fix fingerprint debug scripts (#33277)

* fix fp debugging

* fix these
old-commit-hash: 90ce7781f4
This commit is contained in:
Shane Smiskol 2024-08-12 17:41:08 -05:00 committed by GitHub
parent 7a4b2b5c44
commit 7b4a538eaa
4 changed files with 13 additions and 7 deletions

View File

@ -40,10 +40,12 @@ def disable_ecu(can_recv, can_send, bus=0, addr=0x7d0, sub_addr=None, com_cont_r
if __name__ == "__main__":
import time
import cereal.messaging as messaging
from openpilot.selfdrive.car.card import can_comm_callbacks
sendcan = messaging.pub_sock('sendcan')
logcan = messaging.sub_sock('can')
can_callbacks = can_comm_callbacks(logcan, sendcan)
time.sleep(1)
# honda bosch radar disable
disabled = disable_ecu(logcan, sendcan, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03', timeout=0.5, debug=False)
disabled = disable_ecu(*can_callbacks, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03', timeout=0.5, debug=False)
print(f"disabled: {disabled}")

View File

@ -62,7 +62,7 @@ if __name__ == "__main__":
import argparse
import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.selfdrive.car.card import obd_callback
from openpilot.selfdrive.car.card import can_comm_callbacks, obd_callback
parser = argparse.ArgumentParser(description='Get addresses of all ECUs')
parser.add_argument('--debug', action='store_true')
@ -73,6 +73,7 @@ if __name__ == "__main__":
logcan = messaging.sub_sock('can')
sendcan = messaging.pub_sock('sendcan')
can_callbacks = can_comm_callbacks(logcan, sendcan)
# Set up params for pandad
params = Params()
@ -84,7 +85,7 @@ if __name__ == "__main__":
obd_callback(params)(not args.no_obd)
print("Getting ECU addresses ...")
ecu_addrs = _get_all_ecu_addrs(logcan, sendcan, args.bus, args.timeout, debug=args.debug)
ecu_addrs = _get_all_ecu_addrs(*can_callbacks, args.bus, args.timeout, debug=args.debug)
print()
print("Found ECUs on rx addresses:")

View File

@ -335,7 +335,7 @@ if __name__ == "__main__":
import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.selfdrive.car.vin import get_vin
from openpilot.selfdrive.car.card import obd_callback
from openpilot.selfdrive.car.card import can_comm_callbacks, obd_callback
parser = argparse.ArgumentParser(description='Get firmware version of ECUs')
parser.add_argument('--scan', action='store_true')
@ -346,6 +346,7 @@ if __name__ == "__main__":
logcan = messaging.sub_sock('can')
pandaStates_sock = messaging.sub_sock('pandaStates')
sendcan = messaging.pub_sock('sendcan')
can_callbacks = can_comm_callbacks(logcan, sendcan)
# Set up params for pandad
params = Params()
@ -370,13 +371,13 @@ if __name__ == "__main__":
t = time.time()
print("Getting vin...")
set_obd_multiplexing(True)
vin_rx_addr, vin_rx_bus, vin = get_vin(logcan, sendcan, (0, 1), debug=args.debug)
vin_rx_addr, vin_rx_bus, vin = get_vin(*can_callbacks, (0, 1), debug=args.debug)
print(f'RX: {hex(vin_rx_addr)}, BUS: {vin_rx_bus}, VIN: {vin}')
print(f"Getting VIN took {time.time() - t:.3f} s")
print()
t = time.time()
fw_vers = get_fw_versions(logcan, sendcan, set_obd_multiplexing, query_brand=args.brand, extra=extra, num_pandas=num_pandas, debug=args.debug, progress=True)
fw_vers = get_fw_versions(*can_callbacks, set_obd_multiplexing, query_brand=args.brand, extra=extra, num_pandas=num_pandas, debug=args.debug, progress=True)
_, candidates = match_fw_to_car(fw_vers, vin)
print()

View File

@ -63,6 +63,7 @@ if __name__ == "__main__":
import argparse
import time
import cereal.messaging as messaging
from openpilot.selfdrive.car.card import can_comm_callbacks
parser = argparse.ArgumentParser(description='Get VIN of the car')
parser.add_argument('--debug', action='store_true')
@ -73,7 +74,8 @@ if __name__ == "__main__":
sendcan = messaging.pub_sock('sendcan')
logcan = messaging.sub_sock('can')
can_callbacks = can_comm_callbacks(logcan, sendcan)
time.sleep(1)
vin_rx_addr, vin_rx_bus, vin = get_vin(logcan, sendcan, (args.bus,), args.timeout, args.retry, debug=args.debug)
vin_rx_addr, vin_rx_bus, vin = get_vin(*can_callbacks, (args.bus,), args.timeout, args.retry, debug=args.debug)
print(f'RX: {hex(vin_rx_addr)}, BUS: {vin_rx_bus}, VIN: {vin}')