|
|
@ -22,6 +22,7 @@ def get_vin(logcan, sendcan, buses, timeout=0.1, retry=2, debug=False): |
|
|
|
(StdQueries.UDS_VIN_REQUEST, StdQueries.UDS_VIN_RESPONSE, (0, 1), STANDARD_VIN_ADDRS, FUNCTIONAL_ADDRS, 0x8), |
|
|
|
(StdQueries.UDS_VIN_REQUEST, StdQueries.UDS_VIN_RESPONSE, (0, 1), STANDARD_VIN_ADDRS, FUNCTIONAL_ADDRS, 0x8), |
|
|
|
(StdQueries.OBD_VIN_REQUEST, StdQueries.OBD_VIN_RESPONSE, (0, 1), STANDARD_VIN_ADDRS, FUNCTIONAL_ADDRS, 0x8), |
|
|
|
(StdQueries.OBD_VIN_REQUEST, StdQueries.OBD_VIN_RESPONSE, (0, 1), STANDARD_VIN_ADDRS, FUNCTIONAL_ADDRS, 0x8), |
|
|
|
(StdQueries.GM_VIN_REQUEST, StdQueries.GM_VIN_RESPONSE, (0,), [0x24b], None, 0x400), # Bolt fwdCamera |
|
|
|
(StdQueries.GM_VIN_REQUEST, StdQueries.GM_VIN_RESPONSE, (0,), [0x24b], None, 0x400), # Bolt fwdCamera |
|
|
|
|
|
|
|
(StdQueries.KWP_VIN_REQUEST, StdQueries.KWP_VIN_RESPONSE, (0,), [0x797], None, 0x3), # Nissan Leaf VCM |
|
|
|
): |
|
|
|
): |
|
|
|
if bus not in valid_buses: |
|
|
|
if bus not in valid_buses: |
|
|
|
continue |
|
|
|
continue |
|
|
@ -40,8 +41,8 @@ def get_vin(logcan, sendcan, buses, timeout=0.1, retry=2, debug=False): |
|
|
|
for addr in vin_addrs: |
|
|
|
for addr in vin_addrs: |
|
|
|
vin = results.get((addr, None)) |
|
|
|
vin = results.get((addr, None)) |
|
|
|
if vin is not None: |
|
|
|
if vin is not None: |
|
|
|
# Ford pads with null bytes |
|
|
|
# Ford and Nissan pads with null bytes |
|
|
|
if len(vin) == 24: |
|
|
|
if len(vin) in (19, 24): |
|
|
|
vin = re.sub(b'\x00*$', b'', vin) |
|
|
|
vin = re.sub(b'\x00*$', b'', vin) |
|
|
|
|
|
|
|
|
|
|
|
# Honda Bosch response starts with a length, trim to correct length |
|
|
|
# Honda Bosch response starts with a length, trim to correct length |
|
|
|