Skip to content

Subaru Fingerprinting v2

martinl edited this page Mar 11, 2023 · 11 revisions

Fingerprinting 2.0

Fingerprinting 2.0 is using car ECU firmware versions to identify make and model

Prerequisites

  • switch to subaru-community fork

Get Fingerprint 2.0

Follow the guide in Openpilot Wiki https://github.com/commaai/openpilot/wiki/Fingerprinting

Get Full Fingerprint 2.0

Full fingerprint scans all ecus in the car to get descriptions and firmware versions

  • Turn off car

  • Using Black Panda and EON:

    • connect Black Panda to car harness and EON to Black Panda
  • Using Comma 2:

    • connect Comma 2 to car harness
  • Switch Enabled toggle Off in Openpilot menu to put Openpilot in passive mode

  • Create /data/cpuset.sh to set cpu affinity (for C2 only)

echo $$ > /dev/cpuset/app/tasks
# (our parent, tmux, also gets all the cores)
echo $PPID > /dev/cpuset/app/tasks
  • Run these commands in 2 separate sessions (SSH into EON, run "tmux a" and press "` + c" to create new sessions)...
    in first session run: ../cpuset.sh
    pkill boardd /data/openpilot/selfdrive/boardd/boardd
    in second session run (one line):
    PYTHONPATH=/data/openpilot /data/openpilot/selfdrive/car/ecu_list_subaru.py --scan

  • Turn on the car's ignition, and wait up to ~20 seconds until you get a list of ECU descriptions

Found ECU descriptions
{
  (Ecu.unknown, 0x7d0, None): [b'\xf1\x00\x00\x00\x02']
  (Ecu.unknown, 0x7e0, None): [b'2.0 DOHC                        ']
  (Ecu.unknown, 0x7c4, None): [b'Air Condition System            ']
  (Ecu.unknown, 0x7e1, None): [b'CVT                             ']
  (Ecu.unknown, 0x746, None): [b'Power Steering System           ']
  (Ecu.unknown, 0x787, None): [b'EyeSight System                 ']
  (Ecu.unknown, 0x7b0, None): [b'VDC/Parking Brake System        ']
  (Ecu.unknown, 0x780, None): [b'Airbag System\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f']
  (Ecu.unknown, 0x735, None): [b'Keyless Entry System            ']
  (Ecu.unknown, 0x747, None): [b'Automatic Headlight Leveling    ']
  (Ecu.unknown, 0x753, None): [b'Tire pressure monitor           ']
  (Ecu.unknown, 0x752, None): [b'\xf1\x00 \x80\x86']
  (Ecu.unknown, 0x783, None): [b'METER                           ']
  (Ecu.unknown, 0x7d5, None): [b'\xf1\x000\x00\x00']
  (Ecu.unknown, 0x7f1, None): [b'Airbag System\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f']
  (Ecu.unknown, 0x750, 0xec): [b'\xf1\x00\x00\x00\x00']
}
  • in same session run (one line):
    PYTHONPATH=/data/openpilot /data/openpilot/selfdrive/car/fw_versions.py --scan

  • Wait up to ~20 seconds for the scan to complete until you get a list of FW versions

Found FW versions
{
  (Ecu.eps, 0x746, None): [b'\x7a\xc0\x0c\x00']
  (Ecu.esp, 0x7b0, None): [b'\x7a\x94\x3f\x90\x00']
  (Ecu.fwdCamera, 0x787, None): [b'\x00\x00\x64\xb5\x1f\x40\x20\x0e']
  (Ecu.engine, 0x7e0, None): [b'\xaa\x61\x66\x73\x07']
  (Ecu.transmission, 0x7e1, None): [b'\xe3\xe5\x46\x31\x00']
  (Ecu.unknown, 0x735, None): [b'\x04\x06\x02\x00\x01']
  (Ecu.srs, 0x780, None): [b'\x00\x92\x15\x16\x00']
  (Ecu.unknown, 0x747, None): [b'\x16 \x14\x00']
  (Ecu.unknown, 0x753, None): [b'z\xaa\x01\x00']
  (Ecu.unknown, 0x752, None): [b'A\x85\xcc\x00']
  (Ecu.unknown, 0x783, None): [b'143\x00\x07']
  (Ecu.unknown, 0x7d0, None): [b'\x00\x00\x01']
  (Ecu.unknown, 0x7c4, None): [b'\x12\x00\x10\x00\x01']
}
  • Copy the FW versions obtained in previous step by car model and ECU address (0x780) into the "FW_FINGERPRINTS" section of
    /data/openpilot/selfdrive/car/subaru/values.py eg:
  CAR.IMPREZA: {
    # 2018 Crosstrek - EDM / @martinl
    # 2018 Impreza - ADM / @Michael
    # Ecu, addr, subaddr: ROM ID
    (Ecu.esp, 0x7b0, None): [
      b'\x7a\x94\x3f\x90\x00',
      b'\xa2 \x185\x00',
    ],
    (Ecu.eps, 0x746, None): [
      b'\x7a\xc0\x0c\x00',
      b'z\xc0\b\x00',
    ],
    (Ecu.fwdCamera, 0x787, None): [
      b'\x00\x00\x64\xb5\x1f\x40\x20\x0e',
      b'\x00\x00d\xdc\x1f@ \x0e',
    ],
    (Ecu.engine, 0x7e0, None): [
      b'\xaa\x61\x66\x73\x07',
      b'\xbeacr\a',
    ],
    (Ecu.transmission, 0x7e1, None): [
      b'\xe3\xe5\x46\x31\x00',
      b'\xe4\xe5\x061\x00',
    ],
  },
  • Turn off car's ignition
  • Switch Openpilot Enabled toggle in the menu On
  • Reboot EON/C2