FPv2: log all responses (#25239)

* should be all that's required

* try using rx_addr (should be the same)

* log bus

* bump cereal

* remove debugging

* bump cereal to master

* rm line

* add printing to offline debug script
old-commit-hash: 937013e488
taco
Shane Smiskol 3 years ago committed by GitHub
parent 8a7454eec3
commit 430a888fc3
  1. 2
      cereal
  2. 36
      selfdrive/car/fw_versions.py
  3. 2
      selfdrive/debug/test_fw_query_on_routes.py

@ -1 +1 @@
Subproject commit 7870a1123d4e8dfe5c39e86224c2f851382f3fed
Subproject commit bc999518e73c2b04fee3b8207b3c28a8644233ea

@ -452,7 +452,8 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1,
addrs.insert(0, parallel_addrs)
fw_versions = {}
# Get versions and build capnp list to put into CarParams
car_fw = []
requests = [r for r in REQUESTS if query_brand is None or r.brand == query_brand]
for addr in tqdm(addrs, disable=not progress):
for addr_chunk in chunks(addr):
@ -463,26 +464,23 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1,
if addrs:
query = IsoTpParallelQuery(sendcan, logcan, r.bus, addrs, r.request, r.response, r.rx_offset, debug=debug)
fw_versions.update({(r.brand, addr): (version, r) for (addr, _), version in query.get_data(timeout).items()})
except Exception:
cloudlog.warning(f"FW query exception: {traceback.format_exc()}")
for (addr, rx_addr), version in query.get_data(timeout).items():
f = car.CarParams.CarFw.new_message()
# Build capnp list to put into CarParams
car_fw = []
for (brand, addr), (version, request) in fw_versions.items():
f = car.CarParams.CarFw.new_message()
f.ecu = ecu_types[(r.brand, addr[0], addr[1])]
f.fwVersion = version
f.address = addr[0]
f.responseAddress = rx_addr
f.request = r.request
f.brand = r.brand
f.bus = r.bus
f.ecu = ecu_types[(brand, addr[0], addr[1])]
f.fwVersion = version
f.address = addr[0]
f.responseAddress = uds.get_rx_addr_for_tx_addr(addr[0], request.rx_offset)
f.request = request.request
f.brand = brand
if addr[1] is not None:
f.subAddress = addr[1]
if addr[1] is not None:
f.subAddress = addr[1]
car_fw.append(f)
car_fw.append(f)
except Exception:
cloudlog.warning(f"FW query exception: {traceback.format_exc()}")
return car_fw
@ -531,7 +529,7 @@ if __name__ == "__main__":
padding = max([len(fw.brand) for fw in fw_vers] or [0])
for version in fw_vers:
subaddr = None if version.subAddress == 0 else hex(version.subAddress)
print(f" Brand: {version.brand:{padding}} - (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}]")
print(f" Brand: {version.brand:{padding}}, bus: {version.bus} - (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}]")
print("}")
print()

@ -115,7 +115,7 @@ if __name__ == "__main__":
padding = max([len(fw.brand or UNKNOWN_BRAND) for fw in car_fw])
for version in sorted(car_fw, key=lambda fw: fw.brand):
subaddr = None if version.subAddress == 0 else hex(version.subAddress)
print(f" Brand: {version.brand or UNKNOWN_BRAND:{padding}} - (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}],")
print(f" Brand: {version.brand or UNKNOWN_BRAND:{padding}}, bus: {version.bus} - (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}],")
print("Mismatches")
found = False

Loading…
Cancel
Save