mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-28 15:53:43 +08:00
Recognize complete 2025 Impreza camera firmware identity
This commit is contained in:
@@ -622,6 +622,7 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.fwdCamera, 0x787, None): [
|
||||
b'\x1d!\x08\x00F\x00\x00\x00\x00\x00',
|
||||
b'\x1d!\x08\x00F\x14!\x08\x00=',
|
||||
],
|
||||
(Ecu.engine, 0x7a2, None): [
|
||||
b'\x04"ep\x07',
|
||||
|
||||
@@ -41,7 +41,10 @@ def test_foreign_version_appended_to_valid_ecu_rejects_mixed_observation(car, ec
|
||||
live = records(car)
|
||||
target = next(record for record in live if record.ecu == ecu)
|
||||
foreign = next(record for record in records(peer) if record.ecu == ecu)
|
||||
foreign.fwVersion = next(version for version in FW_VERSIONS[peer][ecu, foreign.address, None]
|
||||
if version not in FW_VERSIONS[car][ecu, target.address, None])
|
||||
assert foreign.address == target.address and foreign.fwVersion != target.fwVersion
|
||||
assert foreign.fwVersion not in FW_VERSIONS[car][ecu, target.address, None]
|
||||
live.append(foreign)
|
||||
_, matches = match_fw_to_car(live, VIN, allow_exact=allow_exact, log=False)
|
||||
assert not (set(CARS) & matches)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Supported Subaru identities preserve exact matching and stock-only admission."""
|
||||
import unittest
|
||||
import pytest
|
||||
|
||||
from opendbc.car.structs import CarParams
|
||||
from opendbc.car.fw_versions import match_fw_to_car_exact
|
||||
@@ -23,6 +24,7 @@ RESTORED = [
|
||||
('SUBARU_IMPREZA_2025', 'abs', 1968, 'a220240705'),
|
||||
('SUBARU_IMPREZA_2025', 'eps', 1862, 'c220240101'),
|
||||
('SUBARU_IMPREZA_2025', 'fwdCamera', 1927, '1d210800460000000000'),
|
||||
('SUBARU_IMPREZA_2025', 'fwdCamera', 1927, '1d21080046142108003d'),
|
||||
('SUBARU_IMPREZA_2025', 'engine', 1954, '0422657007'),
|
||||
('SUBARU_LEGACY_2025', 'abs', 1968, 'a120241100'),
|
||||
('SUBARU_LEGACY_2025', 'eps', 1862, '5bc0d11000'),
|
||||
@@ -89,15 +91,36 @@ def recorded_impreza_firmware():
|
||||
for ecu, address, version, logging, bus, obd in rows]
|
||||
|
||||
|
||||
def test_recorded_impreza_firmware_selects_exact_identity_without_overrides():
|
||||
@pytest.mark.parametrize('full_startup', [False, True])
|
||||
def test_recorded_impreza_firmware_selects_exact_identity_without_overrides(full_startup):
|
||||
from opendbc.car.fw_versions import match_fw_to_car, build_fw_dict
|
||||
|
||||
fw = recorded_impreza_firmware()
|
||||
fw = recorded_impreza_startup_firmware() if full_startup else recorded_impreza_firmware()
|
||||
exact, matches = match_fw_to_car(fw, '0' * 17, log=False)
|
||||
assert exact and matches == {CAR.SUBARU_IMPREZA_2025}
|
||||
assert bytes.fromhex('20020e') not in build_fw_dict(fw)[0x787, None]
|
||||
for ecu in (CarParams.Ecu.engine, CarParams.Ecu.fwdCamera):
|
||||
for ecu in (CarParams.Ecu.abs, CarParams.Ecu.engine, CarParams.Ecu.fwdCamera):
|
||||
unknown = [CarParams.CarFw(ecu=row.ecu, address=row.address, subAddress=row.subAddress,
|
||||
fwVersion=b'unknown firmware' if row.ecu == ecu and not row.logging else row.fwVersion,
|
||||
brand=row.brand, logging=row.logging) for row in fw]
|
||||
assert CAR.SUBARU_IMPREZA_2025 not in match_fw_to_car(unknown, '0' * 17, log=False)[1]
|
||||
|
||||
|
||||
def recorded_impreza_startup_firmware(camera_version='1d21080046142108003d'):
|
||||
# 388aeb4f2701bd8e/0000001e--432395cebf: preserve all actual responses, including other query brands.
|
||||
rows = (
|
||||
('abs', 1968, 'a220240705', 'subaru', True, 1, True),
|
||||
('engine', 1954, '0422657007', 'subaru', True, 1, True),
|
||||
('eps', 1862, 'c220240101', 'subaru', True, 1, True),
|
||||
('fwdCamera', 1927, camera_version, 'subaru', False, 0, True),
|
||||
('fwdCamera', 1927, '20020e', 'subaru', True, 0, True),
|
||||
('abs', 1968, 'a220240705', 'subaru', False, 1, False),
|
||||
('engine', 1954, '0422657007', 'subaru', False, 1, False),
|
||||
('hvac', 1971, 'f100b90100', 'hyundai', True, 1, True),
|
||||
('fwdRadar', 2000, 'f100000002', 'hyundai', False, 1, True),
|
||||
('fwdCamera', 1988, 'f100ac0300', 'hyundai', False, 1, True),
|
||||
('adas', 1840, 'f100bb0f07', 'hyundai', True, 1, False),
|
||||
)
|
||||
return [CarParams.CarFw(ecu=ecu, address=address, fwVersion=bytes.fromhex(version),
|
||||
brand=brand, logging=logging, bus=bus, obdMultiplexing=obd)
|
||||
for ecu, address, version, brand, logging, bus, obd in rows]
|
||||
|
||||
@@ -563,7 +563,12 @@ def test_actual_main_during_temporary_eps_waits_for_clear(subaru_native_pair, tm
|
||||
CAR.SUBARU_IMPREZA_2020, subaru_native_pair, tmp_path, main_only=True, main_during_eps=True)
|
||||
|
||||
|
||||
def test_actual_impreza2025_automatic_full_stack(subaru_native_pair, tmp_path):
|
||||
@pytest.mark.parametrize('full_startup', [False, True])
|
||||
def test_actual_impreza2025_automatic_full_stack(subaru_native_pair, tmp_path, full_startup):
|
||||
from opendbc.car.subaru.tests.test_supported_firmware import recorded_impreza_startup_firmware
|
||||
|
||||
camera_version = '1d21080046142108003d' if full_startup else '1d210800460000000000'
|
||||
firmware = recorded_impreza_startup_firmware(camera_version)
|
||||
test_actual_full_engage_brake_reverse_temporary_recovery_mainoff(
|
||||
CAR.SUBARU_IMPREZA_2025, subaru_native_pair, tmp_path, main_only=True,
|
||||
stop_resume=True, hard_stop_native_first=True)
|
||||
stop_resume=True, hard_stop_native_first=True, firmware=firmware)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "a84217262974a7646bd1d6cae5a300f954fd0a8d1ec827f44435e5116f9262f6", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "83237d06437bc81e92392b5a1195097519dab1837ab89231e5ffa09d7b60826f", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user