Esempio n. 1
0
  confirm = input("power on the vehicle keeping the engine off (press start button twice) then type OK to continue: ").upper().strip()
  if confirm != "OK":
    print("\nyou didn't type 'OK! (aborted)")
    sys.exit(0)

  panda = Panda() # type: ignore
  panda.set_safety_mode(Panda.SAFETY_ELM327)
  uds_client = UdsClient(panda, 0x7D0, bus=args.bus, debug=args.debug)

  print("\n[START DIAGNOSTIC SESSION]")
  session_type : SESSION_TYPE = 0x07 # type: ignore
  uds_client.diagnostic_session_control(session_type)

  print("[HARDWARE/SOFTWARE VERSION]")
  fw_version_data_id : DATA_IDENTIFIER_TYPE = 0xf100 # type: ignore
  fw_version = uds_client.read_data_by_identifier(fw_version_data_id)
  print(fw_version)
  if fw_version not in SUPPORTED_FW_VERSIONS.keys():
    print("radar not supported! (aborted)")
    sys.exit(1)

  print("[GET CONFIGURATION]")
  config_data_id : DATA_IDENTIFIER_TYPE = 0x0142 # type: ignore
  current_config = uds_client.read_data_by_identifier(config_data_id)
  config_values = SUPPORTED_FW_VERSIONS[fw_version]
  new_config = config_values.default_config if args.default else config_values.tracks_enabled
  print(f"current config: 0x{current_config.hex()}")
  if current_config != new_config:
    print("[CHANGE CONFIGURATION]")
    print(f"new config:     0x{new_config.hex()}")
    uds_client.write_data_by_identifier(config_data_id, new_config)
Esempio n. 2
0
      # available diagnostic session without security access
      try:
        uds_client.tester_present()
        uds_client.diagnostic_session_control(SESSION_TYPE.DEFAULT)
        uds_client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
      except NegativeResponseError:
        pass
      except MessageTimeoutError:
        continue

      # Run queries against all standard UDS data identifiers, plus selected
      # non-standardized identifier ranges if requested
      resp = {}
      for uds_data_id in sorted(uds_data_ids):
        try:
          data = uds_client.read_data_by_identifier(uds_data_id)  # type: ignore
          if data:
            resp[uds_data_id] = data
        except (NegativeResponseError, MessageTimeoutError):
          pass

      if resp.keys():
        results[addr] = resp

    if len(results.items()):
      for addr, resp in results.items():
        print(f"\n\n*** Results for address 0x{addr:X} ***\n\n")
        for rid, dat in resp.items():
          print(f"0x{rid:02X} {uds_data_ids[rid]}: {dat}")
    else:
      print("no fw versions found!")
Esempio n. 3
0
            uds_client = UdsClient(panda,
                                   addr,
                                   bus=1 if panda.has_obd() else 0,
                                   timeout=0.1,
                                   debug=False)
            try:
                uds_client.tester_present()
            except NegativeResponseError:
                pass
            except MessageTimeoutError:
                continue

            resp = {}

            try:
                data = uds_client.read_data_by_identifier(
                    DATA_IDENTIFIER_TYPE.BOOT_SOFTWARE_IDENTIFICATION)
                if data:
                    resp[DATA_IDENTIFIER_TYPE.
                         BOOT_SOFTWARE_IDENTIFICATION] = data
            except NegativeResponseError:
                pass

            try:
                data = uds_client.read_data_by_identifier(
                    DATA_IDENTIFIER_TYPE.APPLICATION_SOFTWARE_IDENTIFICATION)
                if data:
                    resp[DATA_IDENTIFIER_TYPE.
                         APPLICATION_SOFTWARE_IDENTIFICATION] = data
            except NegativeResponseError:
                pass
Esempio n. 4
0
                           MQB_EPS_CAN_ADDR,
                           MQB_EPS_CAN_ADDR + RX_OFFSET,
                           bus,
                           timeout=0.2,
                           debug=args.debug)

    try:
        uds_client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
    except MessageTimeoutError:
        print("Timeout opening session with EPS")
        quit()

    odx_file, current_coding = None, None
    try:
        hw_pn = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.VEHICLE_MANUFACTURER_ECU_HARDWARE_NUMBER
        ).decode("utf-8")
        sw_pn = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.VEHICLE_MANUFACTURER_SPARE_PART_NUMBER
        ).decode("utf-8")
        sw_ver = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.
            VEHICLE_MANUFACTURER_ECU_SOFTWARE_VERSION_NUMBER).decode("utf-8")
        component = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.SYSTEM_NAME_OR_ENGINE_TYPE).decode("utf-8")
        odx_file = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.ODX_FILE).decode("utf-8")
        current_coding = uds_client.read_data_by_identifier(
            VOLKSWAGEN_DATA_IDENTIFIER_TYPE.CODING)  # type: ignore
        coding_text = current_coding.hex()