Add support for variable UDS RX offsets
@@ -486,13 +486,14 @@ class IsoTpMessage():
FUNCTIONAL_ADDRS = [0x7DF, 0x18DB33F1]
-def get_rx_addr_for_tx_addr(tx_addr):
+def get_rx_addr_for_tx_addr(tx_addr, rx_offset=0x8):
if tx_addr in FUNCTIONAL_ADDRS:
return None
if tx_addr < 0xFFF8:
- # standard 11 bit response addr (add 8)
- return tx_addr + 8
+ # pseudo-standard 11 bit response addr (add 8) works for most manufacturers
+ # allow override; some manufacturers use other offsets for non-OBD2 access
+ return tx_addr + rx_offset
if tx_addr > 0x10000000 and tx_addr < 0xFFFFFFFF:
# standard 29 bit response addr (flip last two bytes)
