Subaru: ensure consistent firmware version size (#31001)

* fix copying mistakes

* fix SA

* remove print

* ensure size is same

* fix SA

* not in database
This commit is contained in:
Justin Newberry 2024-01-15 15:52:15 -05:00 committed by GitHub
parent a8afaf39d4
commit 94cd4c9046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View File

@ -54,7 +54,7 @@ FW_VERSIONS = {
b'\xa1 \x02\x01',
b'\xa1 \x02\x02',
b'\xa1 \x03\x03',
b'\xa1\\ x04\x01',
b'\xa1 \x04\x01',
],
(Ecu.eps, 0x746, None): [
b'\x9b\xc0\x11\x00',
@ -373,7 +373,6 @@ FW_VERSIONS = {
b'\x00\x00c\xb7\x1f@\x10\x16',
b'\x00\x00c\xd1\x1f@\x10\x17',
b'\x00\x00c\xec\x1f@ \x04',
b'\x00\x00c\xec7@\x04',
],
(Ecu.engine, 0x7e0, None): [
b'\xa0"@\x80\x07',
@ -447,9 +446,9 @@ FW_VERSIONS = {
},
CAR.OUTBACK: {
(Ecu.abs, 0x7b0, None): [
b'\xa1 \x06\x02',
b'\xa1 \x06\x00',
b'\xa1 \x06\x01',
b'\xa1 \x06\x02',
b'\xa1 \x07\x00',
b'\xa1 \x07\x02',
b'\xa1 \x08\x00',

View File

@ -0,0 +1,20 @@
from cereal import car
import unittest
from openpilot.selfdrive.car.subaru.fingerprints import FW_VERSIONS
Ecu = car.CarParams.Ecu
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
class TestSubaruFingerprint(unittest.TestCase):
def test_fw_version_format(self):
for platform, fws_per_ecu in FW_VERSIONS.items():
for (ecu, _, _), fws in fws_per_ecu.items():
fw_size = len(fws[0])
for fw in fws:
self.assertEqual(len(fw), fw_size, f"{platform} {ecu}: {len(fw)} {fw_size}")
if __name__ == "__main__":
unittest.main()