Subaru: remove A/C fw version (#24224)

* Subaru: remove A/C fw version

* add test to ensure the ecu isn't added again

* check CP.carName

* clean up

one line

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 599b1ab3ff5bc75603469916a8ecda644657dc34
This commit is contained in:
martinl
2022-04-26 02:41:34 +03:00
committed by GitHub
parent 38e14ed47b
commit 752ccac435
2 changed files with 16 additions and 3 deletions

View File

@@ -122,9 +122,6 @@ FW_VERSIONS = {
b'\x00\x00c\xf4\x00\x00\x00\x00',
b'\x00\x00d\xdc\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x7c4, None): [
b'\xf1\x00\xac\x02\x00',
],
(Ecu.engine, 0x7e0, None): [
b'\xaa\x61\x66\x73\x07',
b'\xbeacr\a',

View File

@@ -4,6 +4,7 @@ import unittest
from parameterized import parameterized
from cereal import car
from selfdrive.car.car_helpers import interfaces
from selfdrive.car.fingerprints import FW_VERSIONS
from selfdrive.car.fw_versions import match_fw_to_car
@@ -12,6 +13,7 @@ Ecu = car.CarParams.Ecu
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
class TestFwFingerprint(unittest.TestCase):
def assertFingerprints(self, candidates, expected):
candidates = list(candidates)
@@ -42,5 +44,19 @@ class TestFwFingerprint(unittest.TestCase):
self.assertTrue(passed, "Duplicate FW versions found")
def test_blacklisted_ecus(self):
passed = True
blacklisted_addrs = (0x7c4, 0x7d0) # includes A/C ecu and an unknown ecu
for car_model, ecus in FW_VERSIONS.items():
CP = interfaces[car_model][0].get_params(car_model)
if CP.carName == 'subaru':
for ecu in ecus.keys():
if ecu[1] in blacklisted_addrs:
print(f'{car_model}: Blacklisted ecu: (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])})')
passed = False
self.assertTrue(passed, "Blacklisted FW versions found")
if __name__ == "__main__":
unittest.main()