Esempio n. 1
0
  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)
    if not args.default and current_config != SUPPORTED_FW_VERSIONS[fw_version].default_config:
      print("\ncurrent config does not match expected default! (aborted)")
      sys.exit(1)

    print("[DONE]")
    print("\nrestart your vehicle and ensure there are no faults")
    if not args.default:
      print("you can run this script again with --default to go back to the original (factory) settings")
  else:
    print("[DONE]")
    print("\ncurrent config is already the desired configuration")
    sys.exit(0)
Esempio n. 2
0
            uds_client.security_access(ACCESS_TYPE_LEVEL_1.SEND_KEY,
                                       struct.pack("!I", key))  # type: ignore
        except (NegativeResponseError, MessageTimeoutError):
            print("Security access failed!")
            quit()

        try:
            # Programming date and tester number must be written before making
            # a change, or write to CODING will fail with request sequence error
            # Encoding on tester is unclear, it contains the workshop code in the
            # last two bytes, but not the VZ/importer or tester serial number
            # Can't seem to read it back, but we can read the calibration tester,
            # so fib a little and say that same tester did the programming
            # TODO: encode the actual current date
            prog_date = b'\x22\x02\x08'
            uds_client.write_data_by_identifier(
                DATA_IDENTIFIER_TYPE.PROGRAMMING_DATE, prog_date)
            tester_num = uds_client.read_data_by_identifier(
                DATA_IDENTIFIER_TYPE.
                CALIBRATION_REPAIR_SHOP_CODE_OR_CALIBRATION_EQUIPMENT_SERIAL_NUMBER
            )
            uds_client.write_data_by_identifier(
                DATA_IDENTIFIER_TYPE.REPAIR_SHOP_CODE_OR_TESTER_SERIAL_NUMBER,
                tester_num)
            uds_client.write_data_by_identifier(
                VOLKSWAGEN_DATA_IDENTIFIER_TYPE.CODING,
                new_coding)  # type: ignore
        except (NegativeResponseError, MessageTimeoutError):
            print("Writing new configuration failed!")
            quit()

        try: