add blacklist

pull/28641/head
Shane Smiskol 2 years ago
parent 2d9a4ad5b2
commit 81c107652f
  1. 26
      selfdrive/car/toyota/tests/test_toyota.py
  2. 7
      selfdrive/car/toyota/values.py

@ -5,7 +5,8 @@ import unittest
from cereal import car from cereal import car
from openpilot.selfdrive.car.fw_versions import build_fw_dict from openpilot.selfdrive.car.fw_versions import build_fw_dict
from openpilot.selfdrive.car.toyota.values import CAR, DBC, TSS2_CAR, ANGLE_CONTROL_CAR, RADAR_ACC_CAR, FW_VERSIONS, \ from openpilot.selfdrive.car.toyota.values import CAR, DBC, TSS2_CAR, ANGLE_CONTROL_CAR, RADAR_ACC_CAR, FW_VERSIONS, \
FW_QUERY_CONFIG, PLATFORM_CODE_ECUS, get_platform_codes FW_QUERY_CONFIG, PLATFORM_CODE_ECUS, FUZZY_EXCLUDED_PLATFORMS, \
get_platform_codes
Ecu = car.CarParams.Ecu Ecu = car.CarParams.Ecu
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
@ -123,25 +124,6 @@ class TestToyotaFingerprint(unittest.TestCase):
def test_fuzzy_excluded_platforms(self): def test_fuzzy_excluded_platforms(self):
# Asserts a list of platforms that will not fuzzy fingerprint with platform codes due to them being shared. # Asserts a list of platforms that will not fuzzy fingerprint with platform codes due to them being shared.
# This list can be shrunk as we combine platforms, detect features, and add the hybrid ECU.
# Note: this list is so small because other ECUs are not shared between hybrid & ICE, commonly the ABS
# TODO: should this be put into the fuzzy FP function as a blacklist?
excluded_platforms = {
CAR.LEXUS_ES_TSS2,
CAR.LEXUS_RX_TSS2,
CAR.CHR,
CAR.CHRH,
CAR.COROLLA_TSS2,
CAR.COROLLAH_TSS2,
CAR.RAV4_TSS2,
CAR.RAV4H_TSS2,
CAR.LEXUS_NX_TSS2,
CAR.LEXUS_NXH,
CAR.LEXUS_NXH_TSS2,
CAR.LEXUS_NX,
CAR.LEXUS_RXH_TSS2,
}
platforms_with_shared_codes = set() platforms_with_shared_codes = set()
for platform, fw_by_addr in FW_VERSIONS.items(): for platform, fw_by_addr in FW_VERSIONS.items():
car_fw = [] car_fw = []
@ -159,8 +141,8 @@ class TestToyotaFingerprint(unittest.TestCase):
print('matches', platform, matches) print('matches', platform, matches)
platforms_with_shared_codes.add(platform) platforms_with_shared_codes.add(platform)
print(len(platforms_with_shared_codes), len(excluded_platforms)) print(len(platforms_with_shared_codes), len(FUZZY_EXCLUDED_PLATFORMS))
self.assertEqual(platforms_with_shared_codes, excluded_platforms, (len(platforms_with_shared_codes), len(FW_VERSIONS))) self.assertEqual(platforms_with_shared_codes, FUZZY_EXCLUDED_PLATFORMS, (len(platforms_with_shared_codes), len(FW_VERSIONS)))
if __name__ == "__main__": if __name__ == "__main__":

@ -318,7 +318,7 @@ def match_fw_to_car_fuzzy(live_fw_versions, exclude_fw: dict[int, bytes] = None)
if valid_expected_ecus.issubset(valid_found_ecus): if valid_expected_ecus.issubset(valid_found_ecus):
candidates.add(candidate) candidates.add(candidate)
return candidates return candidates - FUZZY_EXCLUDED_PLATFORMS
# Regex patterns for parsing more general platform-specific identifiers from FW versions. # Regex patterns for parsing more general platform-specific identifiers from FW versions.
@ -348,6 +348,11 @@ FW_CHUNK_LEN = 16
# - eps: describes lateral API changes for the EPS, such as using LTA for lane keeping and rejecting LKA messages # - eps: describes lateral API changes for the EPS, such as using LTA for lane keeping and rejecting LKA messages
PLATFORM_CODE_ECUS = [Ecu.fwdCamera, Ecu.abs, Ecu.eps] PLATFORM_CODE_ECUS = [Ecu.fwdCamera, Ecu.abs, Ecu.eps]
# These platforms have at least one platform code for all ECUs shared with another platform.
# This list can be shrunk as we combine platforms, detect features, and add the hybrid ECU
FUZZY_EXCLUDED_PLATFORMS = {CAR.LEXUS_ES_TSS2, CAR.LEXUS_RX_TSS2, CAR.CHR, CAR.CHRH, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2,
CAR.RAV4_TSS2, CAR.RAV4H_TSS2, CAR.LEXUS_NX_TSS2, CAR.LEXUS_NXH, CAR.LEXUS_NXH_TSS2,
CAR.LEXUS_NX, CAR.LEXUS_RXH_TSS2}
# Some ECUs that use KWP2000 have their FW versions on non-standard data identifiers. # Some ECUs that use KWP2000 have their FW versions on non-standard data identifiers.
# Toyota diagnostic software first gets the supported data ids, then queries them one by one. # Toyota diagnostic software first gets the supported data ids, then queries them one by one.

Loading…
Cancel
Save