|
|
@ -5,7 +5,6 @@ import traceback |
|
|
|
|
|
|
|
|
|
|
|
import cereal.messaging as messaging |
|
|
|
import cereal.messaging as messaging |
|
|
|
import panda.python.uds as uds |
|
|
|
import panda.python.uds as uds |
|
|
|
from panda.python.uds import FUNCTIONAL_ADDRS |
|
|
|
|
|
|
|
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery |
|
|
|
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery |
|
|
|
from system.swaglog import cloudlog |
|
|
|
from system.swaglog import cloudlog |
|
|
|
|
|
|
|
|
|
|
@ -24,10 +23,11 @@ def is_valid_vin(vin: str): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_vin(logcan, sendcan, bus, timeout=0.1, retry=5, debug=False): |
|
|
|
def get_vin(logcan, sendcan, bus, timeout=0.1, retry=5, debug=False): |
|
|
|
|
|
|
|
addrs = [0x7e0, 0x7e2, 0x18da10f1, 0x18da0ef1] # engine, VMCU, 29-bit engine, PGM-FI |
|
|
|
for i in range(retry): |
|
|
|
for i in range(retry): |
|
|
|
for request, response in ((UDS_VIN_REQUEST, UDS_VIN_RESPONSE), (OBD_VIN_REQUEST, OBD_VIN_RESPONSE)): |
|
|
|
for request, response in ((UDS_VIN_REQUEST, UDS_VIN_RESPONSE), (OBD_VIN_REQUEST, OBD_VIN_RESPONSE)): |
|
|
|
try: |
|
|
|
try: |
|
|
|
query = IsoTpParallelQuery(sendcan, logcan, bus, FUNCTIONAL_ADDRS, [request, ], [response, ], functional_addr=True, debug=debug) |
|
|
|
query = IsoTpParallelQuery(sendcan, logcan, bus, addrs, [request, ], [response, ], debug=debug) |
|
|
|
for (addr, rx_addr), vin in query.get_data(timeout).items(): |
|
|
|
for (addr, rx_addr), vin in query.get_data(timeout).items(): |
|
|
|
|
|
|
|
|
|
|
|
# Honda Bosch response starts with a length, trim to correct length |
|
|
|
# Honda Bosch response starts with a length, trim to correct length |
|
|
|