From eefccd83b0272f99f947ee4947a7b02a44513c36 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Wed, 2 Sep 2026 19:08:17 +0800 Subject: [PATCH] Toyota: Sienna 2021-26 PATCHED support (EPS-bypassed SecOC), replacing Sienna 2026 PRC --- opendbc_repo/docs/CARS.md | 3 ++- .../opendbc/car/torque_data/params.toml | 2 +- .../opendbc/car/torque_data/substitute.toml | 1 + .../opendbc/car/toyota/fingerprints.py | 17 ----------------- opendbc_repo/opendbc/car/toyota/interface.py | 2 +- .../opendbc/car/toyota/tests/test_toyota.py | 12 +++++++++++- opendbc_repo/opendbc/car/toyota/values.py | 14 +++++++------- .../opendbc/sunnypilot/car/car_list.json | 9 +++++++-- .../sunnypilot/car/toyota/fingerprints_ext.py | 18 ++++++++++++++++++ 9 files changed, 48 insertions(+), 30 deletions(-) diff --git a/opendbc_repo/docs/CARS.md b/opendbc_repo/docs/CARS.md index 09a0b4db9..02a0fbc6d 100644 --- a/opendbc_repo/docs/CARS.md +++ b/opendbc_repo/docs/CARS.md @@ -1,6 +1,6 @@ -# Support Information for 401 Known Cars +# Support Information for 402 Known Cars |Make|Model|Package|Support Level| |---|---|---|:---:| @@ -358,6 +358,7 @@ |Toyota|Sequoia 2023-25|All|[Not compatible](#can-bus-security)| |Toyota|Sienna 2018-20|All|[Upstream](#upstream)| |Toyota|Sienna 2021-23|All|[Custom](#secoc-cars-with-recoverable-keys)| +|Toyota|Sienna 2021-26|All|[Custom](#secoc-cars-with-eps-patched)| |Toyota|Sienna 2024-25|All|[Not compatible](#can-bus-security)| |Toyota|Tundra 2022-25|All|[Not compatible](#can-bus-security)| |Toyota|Venza 2021-25|All|[Not compatible](#can-bus-security)| diff --git a/opendbc_repo/opendbc/car/torque_data/params.toml b/opendbc_repo/opendbc/car/torque_data/params.toml index 439192625..b5ae6a449 100644 --- a/opendbc_repo/opendbc/car/torque_data/params.toml +++ b/opendbc_repo/opendbc/car/torque_data/params.toml @@ -75,7 +75,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "TOYOTA_SIENNA" = [1.689726, 1.3208264576110418, 0.140456] # Initial calibration matches TOYOTA_SIENNA_4TH_GEN's resolved parameters. # Replace with vehicle-specific values after collecting a dedicated route. -"TOYOTA_SIENNA_2026_PRC" = [1.7, 2.0, 0.14] +"TOYOTA_SIENNA_PATCHED" = [1.7, 2.0, 0.14] "TOYOTA_YARIS" = [2.22984, 1.86145, 0.168189] "VOLKSWAGEN_ARTEON_MK1" = [1.45136518053819, 1.3639364049316804, 0.23806361745695032] "VOLKSWAGEN_ATLAS_MK1" = [1.4677006726964945, 1.6733266634075656, 0.12959584092073367] diff --git a/opendbc_repo/opendbc/car/torque_data/substitute.toml b/opendbc_repo/opendbc/car/torque_data/substitute.toml index 945ab3596..d3e524121 100644 --- a/opendbc_repo/opendbc/car/torque_data/substitute.toml +++ b/opendbc_repo/opendbc/car/torque_data/substitute.toml @@ -10,6 +10,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "TOYOTA_ALPHARD_TSS2" = "TOYOTA_SIENNA" "TOYOTA_PRIUS_V" = "TOYOTA_PRIUS" "TOYOTA_SIENNA_4TH_GEN" = "TOYOTA_RAV4_PRIME" +"TOYOTA_SIENNA_PATCHED" = "TOYOTA_RAV4_PRIME" "LEXUS_IS" = "LEXUS_NX" "LEXUS_CTH" = "LEXUS_NX" "LEXUS_ES" = "TOYOTA_CAMRY" diff --git a/opendbc_repo/opendbc/car/toyota/fingerprints.py b/opendbc_repo/opendbc/car/toyota/fingerprints.py index cbefd9923..8cc87b2b1 100644 --- a/opendbc_repo/opendbc/car/toyota/fingerprints.py +++ b/opendbc_repo/opendbc/car/toyota/fingerprints.py @@ -1325,23 +1325,6 @@ FW_VERSIONS = { b'\x028646F0802400\x00\x00\x00\x008646G4202100\x00\x00\x00\x00', ], }, - CAR.TOYOTA_SIENNA_2026_PRC: { - (Ecu.engine, 0x700, None): [ - b'\x01896630867000\x00\x00\x00\x00', - ], - (Ecu.abs, 0x7b0, None): [ - b'\x01F15264510100\x00\x00\x00\x00', - ], - (Ecu.eps, 0x7a1, None): [ - b'\x018965B4512000\x00\x00\x00\x00', - ], - (Ecu.fwdRadar, 0x750, 0xf): [ - b'\x018821F4501000\x00\x00\x00\x00', - ], - (Ecu.fwdCamera, 0x750, 0x6d): [ - b'\x028646F0805200\x00\x00\x00\x008646G4202100\x00\x00\x00\x00', - ], - }, CAR.LEXUS_CTH: { (Ecu.dsu, 0x791, None): [ b'881517601100\x00\x00\x00\x00', diff --git a/opendbc_repo/opendbc/car/toyota/interface.py b/opendbc_repo/opendbc/car/toyota/interface.py index 18428c027..00707981a 100644 --- a/opendbc_repo/opendbc/car/toyota/interface.py +++ b/opendbc_repo/opendbc/car/toyota/interface.py @@ -115,7 +115,7 @@ class CarInterface(CarInterfaceBase): # This platform only uses openpilot for lateral control. All longitudinal # control and its SecOC traffic remain stock. - if ret.flags & ToyotaFlags.EPS_BRIDGED_SECOC.value: + if ret.flags & ToyotaFlags.EPS_BYPASS_SECOC.value: ret.openpilotLongitudinalControl = False ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR diff --git a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py index 9d825d359..4bd7727f8 100644 --- a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py +++ b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py @@ -1,11 +1,12 @@ import unittest -from opendbc.car import Bus +from opendbc.car import Bus, gen_empty_fingerprint from opendbc.car.structs import CarParams from opendbc.car.fw_versions import build_fw_dict from opendbc.car.toyota.fingerprints import FW_VERSIONS from opendbc.car.toyota.values import CAR, DBC, ToyotaFlags, FW_QUERY_CONFIG, PLATFORM_CODE_ECUS, \ FUZZY_EXCLUDED_PLATFORMS, get_platform_codes +from opendbc.car.toyota.interface import CarInterface from opendbc.testing import fuzzy_test Ecu = CarParams.Ecu @@ -29,6 +30,15 @@ class TestToyotaInterfaces(unittest.TestCase): # At this time, only RAV4 2023 is expected to use LTA/angle control assert cars_with(ToyotaFlags.ANGLE_CONTROL) == {CAR.TOYOTA_RAV4_TSS2_2023} + def test_eps_bypass_secoc(self): + # Only the patched Sienna uses EPS-bypassed SecOC + assert cars_with(ToyotaFlags.EPS_BYPASS_SECOC) == {CAR.TOYOTA_SIENNA_PATCHED} + + # EPS-bypass SecOC platforms are lateral-only: longitudinal remains stock + CP = CarInterface.get_params(CAR.TOYOTA_SIENNA_PATCHED, gen_empty_fingerprint(), list(), + alpha_long=False, is_release=False, docs=False) + assert not CP.openpilotLongitudinalControl + def test_tss2_dbc(self): # We make some assumptions about TSS2 platforms, # like looking up certain signals only in this DBC diff --git a/opendbc_repo/opendbc/car/toyota/values.py b/opendbc_repo/opendbc/car/toyota/values.py index 593b73ba8..038e832f4 100644 --- a/opendbc_repo/opendbc/car/toyota/values.py +++ b/opendbc_repo/opendbc/car/toyota/values.py @@ -76,7 +76,7 @@ class ToyotaFlags(IntFlag): SECOC = 2048 # The EPS firmware accepts dummy SecOC MACs for lateral frames. Longitudinal # control remains entirely stock on this platform. - EPS_BRIDGED_SECOC = 4096 + EPS_BYPASS_SECOC = 4096 # deprecated flags # these cars are speculated to allow stop and go when the DSU is unplugged or disabled with sDSU @@ -106,12 +106,12 @@ class ToyotaSecOcCarDocs(ToyotaCarDocs): @dataclass -class ToyotaSienna2026PRCCarDocs(ToyotaSecOcCarDocs): +class ToyotaSiennaPatchedCarDocs(ToyotaSecOcCarDocs): def __post_init__(self): super().__post_init__() self.model = "Sienna" - self.years = "2026" - self.year_list = ["2026"] + self.years = "2021-26" + self.year_list = ["2021", "2022", "2023", "2024", "2025", "2026"] @dataclass @@ -322,10 +322,10 @@ class CAR(Platforms): [ToyotaSecOcCarDocs("Toyota Sienna 2021-23", min_enable_speed=MIN_ACC_SPEED)], CarSpecs(mass=4625. * CV.LB_TO_KG, wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444), ) - TOYOTA_SIENNA_2026_PRC = ToyotaSecOCPlatformConfig( - [ToyotaSienna2026PRCCarDocs("Toyota Sienna 2026 PRC", min_enable_speed=MIN_ACC_SPEED)], + TOYOTA_SIENNA_PATCHED = ToyotaSecOCPlatformConfig( + [ToyotaSiennaPatchedCarDocs("Toyota Sienna 2021-26 PATCHED", min_enable_speed=MIN_ACC_SPEED)], CarSpecs(mass=4625. * CV.LB_TO_KG, wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444), - flags=ToyotaFlags.EPS_BRIDGED_SECOC, + flags=ToyotaFlags.EPS_BYPASS_SECOC, ) # Lexus diff --git a/opendbc_repo/opendbc/sunnypilot/car/car_list.json b/opendbc_repo/opendbc/sunnypilot/car/car_list.json index 73dd217fe..ed17de4d7 100644 --- a/opendbc_repo/opendbc/sunnypilot/car/car_list.json +++ b/opendbc_repo/opendbc/sunnypilot/car/car_list.json @@ -4236,12 +4236,17 @@ ], "package": "All" }, - "Toyota Sienna 2026 PRC": { - "platform": "TOYOTA_SIENNA_2026_PRC", + "Toyota Sienna 2021-26 PATCHED": { + "platform": "TOYOTA_SIENNA_PATCHED", "make": "Toyota", "brand": "toyota", "model": "Sienna", "year": [ + "2021", + "2022", + "2023", + "2024", + "2025", "2026" ], "package": "All" diff --git a/opendbc_repo/opendbc/sunnypilot/car/toyota/fingerprints_ext.py b/opendbc_repo/opendbc/sunnypilot/car/toyota/fingerprints_ext.py index 5ed391b5f..5544fd971 100644 --- a/opendbc_repo/opendbc/sunnypilot/car/toyota/fingerprints_ext.py +++ b/opendbc_repo/opendbc/sunnypilot/car/toyota/fingerprints_ext.py @@ -1,6 +1,24 @@ from opendbc.car.structs import CarParams +from opendbc.car.toyota.values import CAR Ecu = CarParams.Ecu FW_VERSIONS_EXT = { + CAR.TOYOTA_SIENNA_PATCHED: { + (Ecu.engine, 0x700, None): [ + b'\x01896630867000\x00\x00\x00\x00', + ], + (Ecu.abs, 0x7b0, None): [ + b'\x01F15264510100\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'\x018965B4512000\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'\x018821F4501000\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646F0805200\x00\x00\x00\x008646G4202100\x00\x00\x00\x00', + ], + }, }