diff --git a/cereal b/cereal index ab32956aaf..6c4735f219 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit ab32956aaf927ee6318bcf639e3a25eea72027a9 +Subproject commit 6c4735f2199568cd0dc786a165d275cd8665596f diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 2d0445004d..f1766075ea 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -133,6 +133,11 @@ def fingerprint(logcan, sendcan, has_relay): car_fingerprint = list(fw_candidates)[0] source = car.CarParams.FingerprintSource.fw + fixed_fingerprint = os.environ.get('FINGERPRINT', "") + if len(fixed_fingerprint): + car_fingerprint = fixed_fingerprint + source = car.CarParams.FingerprintSource.fixed + cloudlog.warning("fingerprinted %s", car_fingerprint) return car_fingerprint, finger, vin, car_fw, source diff --git a/selfdrive/car/fingerprints.py b/selfdrive/car/fingerprints.py index 4ca9fa0931..c2c39f687f 100644 --- a/selfdrive/car/fingerprints.py +++ b/selfdrive/car/fingerprints.py @@ -1,11 +1,12 @@ import os from common.basedir import BASEDIR -def get_attr_from_cars(attr): + +def get_attr_from_cars(attr, result=dict): # read all the folders in selfdrive/car and return a dict where: # - keys are all the car models # - values are attr values from all car folders - result = {} + result = result() for car_folder in [x[0] for x in os.walk(BASEDIR + '/selfdrive/car')]: try: @@ -16,8 +17,11 @@ def get_attr_from_cars(attr): else: continue - for f, v in attr_values.items(): - result[f] = v + if isinstance(attr_values, dict): + for f, v in attr_values.items(): + result[f] = v + elif isinstance(attr_values, list): + result += attr_values except (ImportError, IOError): pass @@ -25,20 +29,9 @@ def get_attr_from_cars(attr): return result -def get_fw_versions_list(): - return get_attr_from_cars('FW_VERSIONS') - - -def get_fingerprint_list(): - # read all the folders in selfdrive/car and return a dict where: - # - keys are all the car models for which we have a fingerprint - # - values are lists dicts of messages that constitute the unique - # CAN fingerprint of each car model and all its variants - return get_attr_from_cars('FINGERPRINTS') - - -FW_VERSIONS = get_fw_versions_list() -_FINGERPRINTS = get_fingerprint_list() +FW_VERSIONS = get_attr_from_cars('FW_VERSIONS') +_FINGERPRINTS = get_attr_from_cars('FINGERPRINTS') +IGNORED_FINGERPRINTS = get_attr_from_cars('IGNORED_FINGERPRINTS', list) _DEBUG_ADDRESS = {1880: 8} # reserved for debug purposes @@ -61,6 +54,9 @@ def eliminate_incompatible_cars(msg, candidate_cars): compatible_cars = [] for car_name in candidate_cars: + if car_name in IGNORED_FINGERPRINTS: + continue + car_fingerprints = _FINGERPRINTS[car_name] for fingerprint in car_fingerprints: diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 8f57b18c73..a0521f1223 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -257,10 +257,7 @@ FINGERPRINTS = { { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 658: 8, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 764: 8, 765: 8, 767:4, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 882: 8, 885: 8, 889: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913:8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1696: 8, 1745: 8, 1775: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }, - # German Lounge - { - 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 658: 8, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 764: 8, 765: 8, 767:4, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 882: 8, 885: 8, 889: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1696: 8, 1745: 8, 1775: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1792: 8, 1800: 8, 1872: 8, 1880: 8, 1904: 8, 1912: 8, 1937: 8, 1945: 8, 1953: 8, 1961: 8, 1968: 8, 1976: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 - }], + ], CAR.LEXUS_CTH: [{ 36: 8, 37: 8, 170: 8, 180: 8, 288: 8, 426: 6, 452: 8, 466: 8, 467: 8, 548: 8, 552: 4, 560: 7, 581: 5, 608: 8, 610: 5, 643: 7, 713: 8, 740: 5, 800: 8, 810: 2, 832: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 1, 921: 8, 933: 8, 944: 6, 945: 8, 950: 8, 951: 8, 953: 3, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1056: 8, 1057: 8, 1059: 1, 1076: 8, 1077: 8, 1114: 8, 1116: 8, 1160: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1190: 8, 1191: 8, 1192: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1558: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }], @@ -269,6 +266,9 @@ FINGERPRINTS = { }] } +# Don't use theses fingerprints for fingerprinting, they are still needed for ECU detection +IGNORED_FINGERPRINTS = [CAR.RAV4H_TSS2] + FW_VERSIONS = { CAR.AVALON: { (Ecu.esp, 0x7b0, None): [b'F152607060\x00\x00\x00\x00\x00\x00'], diff --git a/selfdrive/test/test_car_models.py b/selfdrive/test/test_car_models.py index 80eeae0f52..1436f404e7 100755 --- a/selfdrive/test/test_car_models.py +++ b/selfdrive/test/test_car_models.py @@ -58,7 +58,6 @@ def get_route_log(route_name): sys.exit(-1) routes = { - "975b26878285314d|2018-12-25--14-42-13": { 'carFingerprint': CHRYSLER.PACIFICA_2018_HYBRID, 'enableCamera': True, @@ -290,6 +289,7 @@ routes = { "7e34a988419b5307|2019-12-18--19-13-30": { 'carFingerprint': TOYOTA.RAV4H_TSS2, 'enableCamera': True, + 'fingerprintSource': 'fixed' }, "e6a24be49a6cd46e|2019-10-29--10-52-42": { 'carFingerprint': TOYOTA.LEXUS_ES_TSS2, @@ -517,6 +517,11 @@ if __name__ == "__main__": params.put("CommunityFeaturesToggle", "1") params.put("Passive", "1" if route in passive_routes else "0") + if checks.get('fingerprintSource', None) == 'fixed': + os.environ['FINGERPRINT'] = checks['carFingerprint'] + else: + os.environ['FINGERPRINT'] = "" + print("testing ", route, " ", checks['carFingerprint']) print("Starting processes") for p in tested_procs: