just add matches with fuzzy FP

pull/26939/head
Shane Smiskol 2 years ago
parent 603bed3a85
commit 068ce6349e
  1. 14
      selfdrive/car/fw_versions.py
  2. 5
      selfdrive/car/hyundai/tests/test_hyundai.py

@ -86,15 +86,11 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None):
for addr, versions in fw_versions_dict.items(): for addr, versions in fw_versions_dict.items():
ecu_key = (addr[0], addr[1]) ecu_key = (addr[0], addr[1])
for version in versions: for version in versions:
# Fall back to matching with full FW versions if brand does not implement platform codes # All cars that have this FW response on the specified address
candidates = set() candidates = all_fw_versions[(*ecu_key, version)]
# TODO: we might want to try both, the only reason we'd want to replace exact with platform codes is if
# previous function was giving us false positives, which it isn't. we lose fuzzy FP for a lot of platforms # If no exact FW matches, try brand-specific fuzzy fingerprinting
# with just platform codes on two ECUs... if len(candidates) != 1 and config.fuzzy_get_platform_codes is not None:
if config.fuzzy_get_platform_codes is None:
# All cars that have this FW response on the specified address
candidates = all_fw_versions[(*ecu_key, version)]
else:
# Returns one or none, all cars that have this platform code # Returns one or none, all cars that have this platform code
for platform_code in config.fuzzy_get_platform_codes([version]): for platform_code in config.fuzzy_get_platform_codes([version]):
candidates = all_platform_codes[(*ecu_key, platform_code)] candidates = all_platform_codes[(*ecu_key, platform_code)]

@ -121,7 +121,12 @@ class TestHyundaiFingerprint(TestFwFingerprintBase):
for platform, fw_by_addr in FW_VERSIONS.items(): for platform, fw_by_addr in FW_VERSIONS.items():
car_fw = [] car_fw = []
for ecu, fw_versions in fw_by_addr.items(): for ecu, fw_versions in fw_by_addr.items():
# Only test fuzzy ECUs so excluded platforms for platforms codes are accurate
# We can still fuzzy match via exact FW matches
ecu_name, addr, sub_addr = ecu ecu_name, addr, sub_addr = ecu
if ecu_name not in FW_QUERY_CONFIG.fuzzy_ecus:
continue
for fw in fw_versions: for fw in fw_versions:
car_fw.append({"ecu": ecu_name, "fwVersion": fw, 'brand': 'hyundai', car_fw.append({"ecu": ecu_name, "fwVersion": fw, 'brand': 'hyundai',
"address": addr, "subAddress": 0 if sub_addr is None else sub_addr}) "address": addr, "subAddress": 0 if sub_addr is None else sub_addr})

Loading…
Cancel
Save