Ejemplo n.º 1
0
    addrs += [0x18da0000 + (i << 8) + 0xf1 for i in range(256)]
    results = {}

    panda = Panda()
    panda.set_safety_mode(Panda.SAFETY_ELM327)
    print("querying addresses ...")
    with tqdm(addrs) as t:
        for addr in t:
            # skip functional broadcast addrs
            if addr == 0x7df or addr == 0x18db33f1:
                continue
            t.set_description(hex(addr))

            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:
Ejemplo n.º 2
0
  try:
    check_output(["pidof", "boardd"])
    print("boardd is running, please kill openpilot before running this script! (aborted)")
    sys.exit(1)
  except CalledProcessError as e:
    if e.returncode != 1: # 1 == no process found (boardd not running)
      raise e

  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
Ejemplo n.º 3
0
#!/usr/bin/env python3
from panda import Panda
from panda.python.uds import UdsClient, NegativeResponseError, DATA_IDENTIFIER_TYPE

if __name__ == "__main__":
    address = 0x18da30f1  # Honda EPS
    panda = Panda()
    uds_client = UdsClient(panda, address, debug=False)

    print("tester present ...")
    uds_client.tester_present()

    try:
        print("")
        print("read data by id: boot software id ...")
        data = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.BOOT_SOFTWARE_IDENTIFICATION)
        print(data.decode('utf-8'))
    except NegativeResponseError as e:
        print(e)

    try:
        print("")
        print("read data by id: application software id ...")
        data = uds_client.read_data_by_identifier(
            DATA_IDENTIFIER_TYPE.APPLICATION_SOFTWARE_IDENTIFICATION)
        print(data.decode('utf-8'))
    except NegativeResponseError as e:
        print(e)

    try:
Ejemplo n.º 4
0
if __name__ == "__main__":
  addrs = [0x700 + i for i in range(256)]
  addrs += [0x18da0000 + (i << 8) + 0xf1 for i in range(256)]
  results = {}

  panda = Panda()
  panda.set_safety_mode(Panda.SAFETY_ELM327)
  print("querying addresses ...")
  with tqdm(addrs) as t:
    for addr in t:
      # skip functional broadcast addrs
      if addr == 0x7df or addr == 0x18db33f1:
        continue
      t.set_description(hex(addr))

      uds_client = UdsClient(panda, addr, bus=1 if panda.has_obd() else 0, timeout=0.1, debug=False)
      try:
        uds_client.tester_present()
        uds_client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
      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:
Ejemplo n.º 5
0
      uds_data_ids[uds_id] = "IDENTIFICATION_OPTION_SYSTEM_SUPPLIER_SPECIFIC"

  panda = Panda()
  panda.set_safety_mode(Panda.SAFETY_ELM327)
  print("querying addresses ...")
  with tqdm(addrs) as t:
    for addr in t:
      # skip functional broadcast addrs
      if addr == 0x7df or addr == 0x18db33f1:
        continue
      t.set_description(hex(addr))
      panda.send_heartbeat()

      bus = 1 if panda.has_obd() else 0
      rx_addr = addr + int(args.rxoffset, base=16) if args.rxoffset else None
      uds_client = UdsClient(panda, addr, rx_addr, bus, timeout=0.2, debug=args.debug)
      # Check for anything alive at this address, and switch to the highest
      # 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):
Ejemplo n.º 6
0
                uds_id] = "IDENTIFICATION_OPTION_SYSTEM_SUPPLIER_SPECIFIC"

    panda = Panda()
    panda.set_safety_mode(Panda.SAFETY_ELM327)
    panda.set_power_save(0)
    print("querying addresses ...")
    with tqdm(addrs) as t:
        for addr in t:
            # skip functional broadcast addrs
            if addr == 0x7df or addr == 0x18db33f1:
                continue
            t.set_description(hex(addr))

            uds_client = UdsClient(panda,
                                   addr,
                                   addr + int(args.rxoffset, base=16),
                                   bus=1 if panda.has_obd() else 0,
                                   timeout=0.2,
                                   debug=args.debug)
            # Check for anything alive at this address, and switch to the highest
            # 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
Ejemplo n.º 7
0
                  "turn ignition off and on again for any changes to take effect."
    parser = argparse.ArgumentParser(description=desc_text, epilog=epilog_text)
    parser.add_argument("--debug",
                        action="store_true",
                        help="enable ISO-TP/UDS stack debugging output")
    parser.add_argument("action",
                        choices={"show", "enable", "disable"},
                        help="show or modify current EPS HCA config")
    args = parser.parse_args()

    panda = Panda()
    panda.set_safety_mode(Panda.SAFETY_ELM327)
    bus = 1 if panda.has_obd() else 0
    uds_client = UdsClient(panda,
                           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(
Ejemplo n.º 8
0
parser.add_argument('--debug', action='store_true')
args = parser.parse_args()

try:
    check_output(["pidof", "boardd"])
    print(
        "boardd is running, please kill openpilot before running this script! (aborted)"
    )
    sys.exit(1)
except CalledProcessError as e:
    if e.returncode != 1:  # 1 == no process found (boardd not running)
        raise e

panda = Panda()
panda.set_safety_mode(Panda.SAFETY_ELM327)
uds_client = UdsClient(panda, args.addr, bus=args.bus, debug=args.debug)
print("extended diagnostic session ...")
try:
    uds_client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
except MessageTimeoutError:
    # functional address isn't properly handled so a timeout occurs
    if args.addr != 0x7DF:
        raise
print("clear diagnostic info ...")
try:
    uds_client.clear_diagnostic_information(DTC_GROUP_TYPE.ALL)
except MessageTimeoutError:
    # functional address isn't properly handled so a timeout occurs
    if args.addr != 0x7DF:
        pass
print("")
Ejemplo n.º 9
0
parser = argparse.ArgumentParser(description="read DTC status")
parser.add_argument("addr", type=lambda x: int(x, 0))
parser.add_argument("--bus", type=int, default=0)
parser.add_argument('--debug', action='store_true')
args = parser.parse_args()

try:
    check_output(["pidof", "boardd"])
    print(
        "boardd is running, please kill openpilot before running this script! (aborted)"
    )
    sys.exit(1)
except CalledProcessError as e:
    if e.returncode != 1:  # 1 == no process found (boardd not running)
        raise e

panda = Panda()
panda.set_safety_mode(Panda.SAFETY_ELM327)
uds_client = UdsClient(panda, args.addr, bus=args.bus, debug=args.debug)
print("extended diagnostic session ...")
uds_client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
print("read diagnostic codes ...")
data = uds_client.read_dtc_information(DTC_REPORT_TYPE.DTC_BY_STATUS_MASK,
                                       DTC_STATUS_MASK_TYPE.ALL)
print("status availability:", " ".join(get_dtc_status_names(data[0])))
print("DTC status:")
for i in range(1, len(data), 4):
    dtc_num = get_dtc_num_as_str(data[i:i + 3])
    dtc_status = " ".join(get_dtc_status_names(data[i + 3]))
    print(dtc_num, dtc_status)