let user pass in tx for rx addrs

pull/25939/head
Shane Smiskol 3 years ago
parent 99bb51902f
commit 98e35ef739
  1. 11
      selfdrive/car/isotp_parallel_query.py
  2. 4
      selfdrive/car/vin.py

@ -5,7 +5,7 @@ from functools import partial
import cereal.messaging as messaging
from system.swaglog import cloudlog
from selfdrive.boardd.boardd import can_list_to_can_capnp
from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr
from panda.python.uds import CanClient, IsoTpMessage, get_rx_addr_for_tx_addr
class IsoTpParallelQuery:
@ -22,10 +22,11 @@ class IsoTpParallelQuery:
if self.functional_addr:
# Add standard physical addresses to tx on after initial functional address query
self.msg_addrs = {}
for a in FUNCTIONAL_ADDRS:
if a in addrs:
for fun_addr in FUNCTIONAL_ADDRS[a]:
self.msg_addrs[get_rx_addr_for_tx_addr(fun_addr, rx_offset=response_offset)] = (a, None)
for a in addrs:
if a < 2 ** 11:
self.msg_addrs[get_rx_addr_for_tx_addr(a, response_offset)] = (0x7DF, None)
else:
self.msg_addrs[get_rx_addr_for_tx_addr(a, response_offset)] = (0x18DB33F1, None)
else:
real_addrs = [a if isinstance(a, tuple) else (a, None) for a in addrs]

@ -15,11 +15,11 @@ def is_valid_vin(vin: str):
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
addrs = list(range(0x7e0, 0x7e8)) + list(range(0x18DA00F1, 0x18DB00F1, 0x100))
for i in range(retry):
for request, response in ((StdQueries.UDS_VIN_REQUEST, StdQueries.UDS_VIN_RESPONSE), (StdQueries.OBD_VIN_REQUEST, StdQueries.OBD_VIN_RESPONSE)):
try:
query = IsoTpParallelQuery(sendcan, logcan, bus, addrs, [request, ], [response, ], debug=debug)
query = IsoTpParallelQuery(sendcan, logcan, bus, addrs, [request, ], [response, ], functional_addr=True, debug=debug)
for (addr, rx_addr), vin in query.get_data(timeout).items():
# Honda Bosch response starts with a length, trim to correct length

Loading…
Cancel
Save