do all fingerprints

pull/33208/head
Shane Smiskol 10 months ago
parent db592ed38b
commit d2c5602250
  1. 4
      selfdrive/car/body/fingerprints.py
  2. 4
      selfdrive/car/chrysler/fingerprints.py
  3. 88
      selfdrive/car/data_structures.py
  4. 4
      selfdrive/car/ford/fingerprints.py
  5. 4
      selfdrive/car/honda/fingerprints.py
  6. 4
      selfdrive/car/hyundai/fingerprints.py
  7. 4
      selfdrive/car/mazda/fingerprints.py
  8. 4
      selfdrive/car/nissan/fingerprints.py
  9. 4
      selfdrive/car/subaru/fingerprints.py
  10. 4
      selfdrive/car/tesla/fingerprints.py
  11. 4
      selfdrive/car/toyota/fingerprints.py
  12. 4
      selfdrive/car/toyota/toyotacan.py
  13. 3
      selfdrive/car/toyota/values.py
  14. 4
      selfdrive/car/volkswagen/fingerprints.py
  15. 15
      selfdrive/debug/format_fingerprints.py

@ -1,8 +1,8 @@
# ruff: noqa: E501
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.body.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
# debug ecu fw version is the git hash of the firmware

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.chrysler.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.CHRYSLER_PACIFICA_2018: {

@ -1,34 +1,54 @@
from enum import StrEnum, auto
class Ecu(StrEnum):
eps = auto()
abs = auto()
fwdRadar = auto()
fwdCamera = auto()
engine = auto()
unknown = auto()
transmission = auto() # Transmission Control Module
hybrid = auto() # hybrid control unit, e.g. Chrysler's HCP, Honda's IMA Control Unit, Toyota's hybrid control computer
srs = auto() # airbag
gateway = auto() # can gateway
hud = auto() # heads up display
combinationMeter = auto() # instrument cluster
electricBrakeBooster = auto()
shiftByWire = auto()
adas = auto()
cornerRadar = auto()
hvac = auto()
parkingAdas = auto() # parking assist system ECU, e.g. Toyota's IPAS, Hyundai's RSPA, etc.
epb = auto() # electronic parking brake
telematics = auto()
body = auto() # body control module
# Toyota only
dsu = auto()
# Honda only
vsa = auto() # Vehicle Stability Assist
programmedFuelInjection = auto()
debug = auto()
from dataclasses import dataclass
from enum import StrEnum as _StrEnum, auto
class StrEnum(_StrEnum):
@staticmethod
def _generate_next_value_(name, *args):
# auto() defaults to name.lower()
return name
@dataclass
class CarParams:
carName: str
carFingerprint: str
fuzzyFingerprint: bool
notCar: bool # flag for non-car robotics platforms
class SteerControlType(StrEnum):
torque = auto()
angle = auto()
class Ecu(StrEnum):
eps = auto()
abs = auto()
fwdRadar = auto()
fwdCamera = auto()
engine = auto()
unknown = auto()
transmission = auto() # Transmission Control Module
hybrid = auto() # hybrid control unit, e.g. Chrysler's HCP, Honda's IMA Control Unit, Toyota's hybrid control computer
srs = auto() # airbag
gateway = auto() # can gateway
hud = auto() # heads up display
combinationMeter = auto() # instrument cluster
electricBrakeBooster = auto()
shiftByWire = auto()
adas = auto()
cornerRadar = auto()
hvac = auto()
parkingAdas = auto() # parking assist system ECU, e.g. Toyota's IPAS, Hyundai's RSPA, etc.
epb = auto() # electronic parking brake
telematics = auto()
body = auto() # body control module
# Toyota only
dsu = auto()
# Honda only
vsa = auto() # Vehicle Stability Assist
programmedFuelInjection = auto()
debug = auto()

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.ford.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.FORD_BRONCO_SPORT_MK1: {

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.honda.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
# Modified FW can be identified by the second dash being replaced by a comma
# For example: `b'39990-TVA,A150\x00\x00'`

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.hyundai.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
# The existence of SCC or RDR in the fwdRadar FW usually determines the radar's function,
# i.e. if it sends the SCC messages or if another ECU like the camera or ADAS Driving ECU does

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.mazda.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.MAZDA_CX5_2022: {

@ -1,8 +1,8 @@
# ruff: noqa: E501
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.nissan.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FINGERPRINTS = {
CAR.NISSAN_XTRAIL: [{

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.subaru.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.SUBARU_ASCENT: {

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.tesla.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.TESLA_AP2_MODELS: {

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.toyota.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
FW_VERSIONS = {
CAR.TOYOTA_AVALON: {

@ -1,6 +1,6 @@
from cereal import car
from selfdrive.car.data_structures import CarParams
SteerControlType = car.CarParams.SteerControlType
SteerControlType = CarParams.SteerControlType
def create_steer_command(packer, steer, steer_req):

@ -4,11 +4,12 @@ from dataclasses import dataclass, field
from enum import Enum, IntFlag
from openpilot.selfdrive.car import CarSpecs, PlatformConfig, Platforms, AngleRateLimit, dbc_dict
from openpilot.selfdrive.car.data_structures import Ecu
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.conversions import Conversions as CV
from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarDocs, Column, CarParts, CarHarness
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries
Ecu = CarParams.Ecu
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
PEDAL_TRANSITION = 10. * CV.MPH_TO_MS

@ -1,7 +1,7 @@
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
from openpilot.selfdrive.car.volkswagen.values import CAR
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
# TODO: Sharan Mk2 EPS and DQ250 auto trans both require KWP2000 support for fingerprinting

@ -2,28 +2,24 @@
import jinja2
import os
from cereal import car
from openpilot.common.basedir import BASEDIR
from openpilot.selfdrive.car.interfaces import get_interface_attr
Ecu = car.CarParams.Ecu
CARS = get_interface_attr('CAR')
FW_VERSIONS = get_interface_attr('FW_VERSIONS')
FINGERPRINTS = get_interface_attr('FINGERPRINTS')
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
FINGERPRINTS_PY_TEMPLATE = jinja2.Template("""
{%- if FINGERPRINTS[brand] %}
# ruff: noqa: E501
{% endif %}
{% if FW_VERSIONS[brand] %}
from cereal import car
from openpilot.selfdrive.car.data_structures import CarParams
{% endif %}
from openpilot.selfdrive.car.{{brand}}.values import CAR
{% if FW_VERSIONS[brand] %}
Ecu = car.CarParams.Ecu
Ecu = CarParams.Ecu
{% endif %}
{% if comments +%}
{{ comments | join() }}
@ -49,7 +45,7 @@ FW_VERSIONS{% if not FW_VERSIONS[brand] %}: dict[str, dict[tuple, list[bytes]]]{
{% for car, _ in FW_VERSIONS[brand].items() %}
CAR.{{car.name}}: {
{% for key, fw_versions in FW_VERSIONS[brand][car].items() %}
(Ecu.{{ECU_NAME[key[0]]}}, 0x{{"%0x" | format(key[1] | int)}}, \
(Ecu.{{key[0]}}, 0x{{"%0x" | format(key[1] | int)}}, \
{% if key[2] %}0x{{"%0x" | format(key[2] | int)}}{% else %}{{key[2]}}{% endif %}): [
{% for fw_version in (fw_versions + extra_fw_versions.get(car, {}).get(key, [])) | unique | sort %}
{{fw_version}},
@ -71,9 +67,8 @@ def format_brand_fw_versions(brand, extra_fw_versions: None | dict[str, dict[tup
comments = [line for line in f.readlines() if line.startswith("#") and "noqa" not in line]
with open(fingerprints_file, "w") as f:
f.write(FINGERPRINTS_PY_TEMPLATE.render(brand=brand, comments=comments, ECU_NAME=ECU_NAME,
FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=FW_VERSIONS,
extra_fw_versions=extra_fw_versions))
f.write(FINGERPRINTS_PY_TEMPLATE.render(brand=brand, comments=comments, FINGERPRINTS=FINGERPRINTS,
FW_VERSIONS=FW_VERSIONS, extra_fw_versions=extra_fw_versions))
if __name__ == "__main__":

Loading…
Cancel
Save