diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 4880e0b3e0..5617b1682b 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -345,10 +345,9 @@ FINGERPRINTS = { def get_platform_codes(fw_versions: List[bytes]) -> Set[bytes]: - platform_code_regex = b'(?<=' + HYUNDAI_VERSION_REQUEST_LONG[1:] + b')[A-Z]{2}[A-Za-z0-9]{0,2}' codes = set() for fw in fw_versions: - matches = re.findall(platform_code_regex, fw) + matches = re.findall(PLATFORM_CODE_PATTERN, fw) if len(matches): codes.add(matches[0]) return codes @@ -367,6 +366,8 @@ HYUNDAI_VERSION_REQUEST_MULTI = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER] HYUNDAI_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) +PLATFORM_CODE_PATTERN = re.compile(b'(?<=' + HYUNDAI_VERSION_REQUEST_LONG[1:] + b')[A-Z]{2}[A-Za-z0-9]{0,2}') + FW_QUERY_CONFIG = FwQueryConfig( requests=[ # TODO: minimize shared whitelists for CAN and cornerRadar for CAN-FD