From 29cb892e1a0afb2ad1e647f100bf9f789291dad8 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 18 Jul 2026 19:17:25 -0500 Subject: [PATCH] Toyota --- opendbc_repo/opendbc/car/toyota/interface.py | 7 ++++++- .../opendbc/car/toyota/tests/test_toyota.py | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/opendbc_repo/opendbc/car/toyota/interface.py b/opendbc_repo/opendbc/car/toyota/interface.py index 29cb7fd77..2278606d9 100644 --- a/opendbc_repo/opendbc/car/toyota/interface.py +++ b/opendbc_repo/opendbc/car/toyota/interface.py @@ -62,8 +62,13 @@ class CarInterface(CarInterfaceBase): # A DSU bypass adapter reroutes the stock DSU messages to the camera bus. # These messages are normally absent there on pre-TSS2 platforms. + # Require the native-bus message to be absent so startup relay mirroring is not mistaken for an adapter. + pt_fingerprint = fingerprint.get(0, {}) + radar_fingerprint = fingerprint.get(1, {}) camera_fingerprint = fingerprint.get(2, {}) - if not use_sdsu and candidate not in TSS2_CAR and (0x343 in camera_fingerprint or 0x4CB in camera_fingerprint): + has_dsu_bypass = ((0x343 in camera_fingerprint and 0x343 not in radar_fingerprint) or + (0x4CB in camera_fingerprint and 0x4CB not in pt_fingerprint)) + if not use_sdsu and candidate not in TSS2_CAR and has_dsu_bypass: ret.flags |= ToyotaFlags.DSU_BYPASS.value # In TSS2 cars, the camera does long control diff --git a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py index 535b46994..8fe72e05e 100644 --- a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py +++ b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py @@ -113,6 +113,26 @@ class TestToyotaInterfaces: assert message not in can_parsers[Bus.pt].vl assert message in can_parsers[Bus.cam].vl + @pytest.mark.parametrize(("native_bus", "message"), [(1, 0x343), (0, 0x4CB)]) + def test_dsu_bypass_ignores_startup_bus_mirror(self, native_bus, message): + fingerprint = {bus: {} for bus in range(8)} + fingerprint[native_bus][message] = 8 + fingerprint[2][message] = 8 + + car_params = CarInterface.get_params( + CAR.LEXUS_IS, + fingerprint, + [], + alpha_long=False, + is_release=False, + docs=False, + starpilot_toggles=SimpleNamespace(), + ) + + assert not car_params.flags & ToyotaFlags.DSU_BYPASS.value + assert not car_params.openpilotLongitudinalControl + assert car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value + def test_dsu_bypass_does_not_change_tss2_or_smart_dsu(self): fingerprint = {bus: {} for bus in range(8)} fingerprint[0][0x2FF] = 8