diff --git a/selfdrive/car/fw_query_definitions.py b/selfdrive/car/fw_query_definitions.py index 06abfbef7f..f4621857e1 100755 --- a/selfdrive/car/fw_query_definitions.py +++ b/selfdrive/car/fw_query_definitions.py @@ -80,7 +80,9 @@ class FwQueryConfig: fuzzy_min_match_count: int = 2 # A function to get uniquely identifiable codes for a version fuzzy_get_platform_codes: Optional[Callable[[List[bytes]], Set[bytes]]] = None + # List of ECUs to consider for fuzzy fingerprinting, and an option to require them to exist fuzzy_ecus: List[capnp.lib.capnp._EnumModule] = field(default_factory=set) + fuzzy_ecus_must_exist: bool = False def __post_init__(self): for i in range(len(self.requests)): diff --git a/selfdrive/car/fw_versions.py b/selfdrive/car/fw_versions.py index c576906d89..828d4904b8 100755 --- a/selfdrive/car/fw_versions.py +++ b/selfdrive/car/fw_versions.py @@ -62,6 +62,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None): # Build lookup table from (addr, sub_addr, fw) to list of candidate cars all_fw_versions = defaultdict(set) all_platform_codes = defaultdict(set) + seen_ecus = defaultdict(bool) for candidate, fw_by_addr in FW_VERSIONS.items(): if MODEL_TO_BRAND[candidate] != 'hyundai': continue @@ -87,6 +88,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None): print(all_platform_codes) match_count = 0 candidate = None + seen_addrs = set() for addr, versions in fw_versions_dict.items(): for version in versions: # All cars that have this FW response on the specified address diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 4880e0b3e0..eb5c5cf694 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -428,6 +428,7 @@ FW_QUERY_CONFIG = FwQueryConfig( fuzzy_get_platform_codes=get_platform_codes, # Hyundai works best with camera and radar (which have standardized platform codes) fuzzy_ecus=[Ecu.fwdRadar, Ecu.fwdCamera], + fuzzy_ecus_must_exist=True, ) FW_VERSIONS = {