From 5d0dc2ded27886b2edfd57391a54fc5f2ce0ff20 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 17 Apr 2024 00:09:20 -0700 Subject: [PATCH] Toyota: remove unecessary ECUs for fingerprinting (#32235) * remove some ecus * missing doc * fix * fix * clean up * update refs * rm --- selfdrive/car/tests/test_fw_fingerprint.py | 6 ++--- selfdrive/car/toyota/values.py | 28 +++++++++------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/selfdrive/car/tests/test_fw_fingerprint.py b/selfdrive/car/tests/test_fw_fingerprint.py index 18868c3e417a83..ed5edbef313633 100755 --- a/selfdrive/car/tests/test_fw_fingerprint.py +++ b/selfdrive/car/tests/test_fw_fingerprint.py @@ -245,7 +245,7 @@ def _assert_timing(self, avg_time, ref_time): def test_startup_timing(self): # Tests worse-case VIN query time and typical present ECU query time vin_ref_times = {'worst': 1.4, 'best': 0.7} # best assumes we go through all queries to get a match - present_ecu_ref_time = 0.75 + present_ecu_ref_time = 0.45 def fake_get_ecu_addrs(*_, timeout): self.total_time += timeout @@ -271,7 +271,7 @@ def fake_get_ecu_addrs(*_, timeout): print(f'get_vin {name} case, query time={self.total_time / self.N} seconds') def test_fw_query_timing(self): - total_ref_time = {1: 8.1, 2: 8.7} + total_ref_time = {1: 7.2, 2: 7.8} brand_ref_times = { 1: { 'gm': 1.0, @@ -284,7 +284,7 @@ def test_fw_query_timing(self): 'nissan': 0.8, 'subaru': 0.65, 'tesla': 0.3, - 'toyota': 1.6, + 'toyota': 0.7, 'volkswagen': 0.65, }, 2: { diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 4f6fdef1ba5627..dbab2e92556d72 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -494,22 +494,20 @@ def match_fw_to_car_fuzzy(live_fw_versions, vin, offline_fw_versions) -> set[str Request( [StdQueries.SHORT_TESTER_PRESENT_REQUEST, TOYOTA_VERSION_REQUEST_KWP], [StdQueries.SHORT_TESTER_PRESENT_RESPONSE, TOYOTA_VERSION_RESPONSE_KWP], - whitelist_ecus=[Ecu.fwdCamera, Ecu.fwdRadar, Ecu.dsu, Ecu.abs, Ecu.eps, Ecu.epb, Ecu.telematics, - Ecu.srs, Ecu.combinationMeter, Ecu.transmission, Ecu.gateway, Ecu.hvac], + whitelist_ecus=[Ecu.fwdCamera, Ecu.fwdRadar, Ecu.dsu, Ecu.abs, Ecu.eps, Ecu.srs, Ecu.transmission, Ecu.hvac], bus=0, ), Request( [StdQueries.SHORT_TESTER_PRESENT_REQUEST, StdQueries.OBD_VERSION_REQUEST], [StdQueries.SHORT_TESTER_PRESENT_RESPONSE, StdQueries.OBD_VERSION_RESPONSE], - whitelist_ecus=[Ecu.engine, Ecu.epb, Ecu.telematics, Ecu.hybrid, Ecu.srs, Ecu.combinationMeter, Ecu.transmission, - Ecu.gateway, Ecu.hvac], + whitelist_ecus=[Ecu.engine, Ecu.hybrid, Ecu.srs, Ecu.transmission, Ecu.hvac], bus=0, ), Request( [StdQueries.TESTER_PRESENT_REQUEST, StdQueries.DEFAULT_DIAGNOSTIC_REQUEST, StdQueries.EXTENDED_DIAGNOSTIC_REQUEST, StdQueries.UDS_VERSION_REQUEST], [StdQueries.TESTER_PRESENT_RESPONSE, StdQueries.DEFAULT_DIAGNOSTIC_RESPONSE, StdQueries.EXTENDED_DIAGNOSTIC_RESPONSE, StdQueries.UDS_VERSION_RESPONSE], - whitelist_ecus=[Ecu.engine, Ecu.fwdRadar, Ecu.fwdCamera, Ecu.abs, Ecu.eps, Ecu.epb, Ecu.telematics, - Ecu.hybrid, Ecu.srs, Ecu.combinationMeter, Ecu.transmission, Ecu.gateway, Ecu.hvac], + whitelist_ecus=[Ecu.engine, Ecu.fwdRadar, Ecu.fwdCamera, Ecu.abs, Ecu.eps, + Ecu.hybrid, Ecu.srs, Ecu.transmission, Ecu.hvac], bus=0, ), ], @@ -523,33 +521,29 @@ def match_fw_to_car_fuzzy(live_fw_versions, vin, offline_fw_versions) -> set[str extra_ecus=[ # All known ECUs on a late-model Toyota vehicle not queried here: # Responds to UDS: + # - Combination Meter (0x7c0) # - HV Battery (0x713, 0x747) # - Motor Generator (0x716, 0x724) # - 2nd ABS "Brake/EPB" (0x730) + # - Electronic Parking Brake ((0x750, 0x2c)) + # - Telematics ((0x750, 0xc7)) # Responds to KWP (0x1a8801): # - Steering Angle Sensor (0x7b3) # - EPS/EMPS (0x7a0, 0x7a1) + # - 2nd SRS Airbag (0x784) + # - Central Gateway ((0x750, 0x5f)) + # - Telematics ((0x750, 0xc7)) # Responds to KWP (0x1a8881): # - Body Control Module ((0x750, 0x40)) + # - Telematics ((0x750, 0xc7)) # Hybrid control computer can be on 0x7e2 (KWP) or 0x7d2 (UDS) depending on platform (Ecu.hybrid, 0x7e2, None), # Hybrid Control Assembly & Computer - # TODO: if these duplicate ECUs always exist together, remove one (Ecu.srs, 0x780, None), # SRS Airbag - (Ecu.srs, 0x784, None), # SRS Airbag 2 - # Likely only exists on cars where EPB isn't standard (e.g. Camry, Avalon (/Hybrid)) - # On some cars, EPB is controlled by the ABS module - (Ecu.epb, 0x750, 0x2c), # Electronic Parking Brake - # This isn't accessible on all cars - (Ecu.gateway, 0x750, 0x5f), - # On some cars, this only responds to b'\x1a\x88\x81', which is reflected by the b'\x1a\x88\x00' query - (Ecu.telematics, 0x750, 0xc7), # Transmission is combined with engine on some platforms, such as TSS-P RAV4 (Ecu.transmission, 0x701, None), # A few platforms have a tester present response on this address, add to log (Ecu.transmission, 0x7e1, None), - # On some cars, this only responds to b'\x1a\x88\x80' - (Ecu.combinationMeter, 0x7c0, None), (Ecu.hvac, 0x7c4, None), ], match_fw_to_car_fuzzy=match_fw_to_car_fuzzy,