|
9 | 9 | from tqdm import tqdm |
10 | 10 |
|
11 | 11 | from panda import Panda |
12 | | -try: |
13 | | - # If openpilot is installed |
14 | | - from panda.python.uds import UdsClient, ACCESS_TYPE, SESSION_TYPE, DATA_IDENTIFIER_TYPE, SERVICE_TYPE, ROUTINE_CONTROL_TYPE, NegativeResponseError |
15 | | -except ImportError: |
16 | | - # If installed from pip |
17 | | - from panda.uds import UdsClient, ACCESS_TYPE, SESSION_TYPE, DATA_IDENTIFIER_TYPE, SERVICE_TYPE, ROUTINE_CONTROL_TYPE, NegativeResponseError |
| 12 | +from opendbc.car.uds import UdsClient, ACCESS_TYPE, SESSION_TYPE, DATA_IDENTIFIER_TYPE, SERVICE_TYPE, ROUTINE_CONTROL_TYPE, NegativeResponseError |
| 13 | +from opendbc.car.structs import CarParams |
| 14 | +from opendbc.car.isotp import isotp_send |
18 | 15 |
|
19 | 16 | ADDR = 0x7a1 |
20 | 17 | DEBUG = False |
@@ -58,11 +55,13 @@ def get_secoc_key(key_struct): |
58 | 55 | except CalledProcessError as e: |
59 | 56 | if e.returncode != 1: # 1 == no process found (boardd not running) |
60 | 57 | raise e |
| 58 | + except FileNotFoundError: |
| 59 | + pass |
61 | 60 |
|
62 | 61 | panda = Panda() |
63 | | - panda.set_safety_mode(Panda.SAFETY_ELM327) |
| 62 | + panda.set_safety_mode(CarParams.SafetyModel.elm327) |
64 | 63 |
|
65 | | - uds_client = UdsClient(panda, ADDR, ADDR + 8, BUS, timeout=0.1, response_pending_timeout=0.1, debug=DEBUG) |
| 64 | + uds_client = UdsClient(panda, ADDR, ADDR + 8, BUS, timeout=0.1, response_pending_timeout=0.1) |
66 | 65 |
|
67 | 66 | print("Getting application versions...") |
68 | 67 |
|
@@ -180,7 +179,7 @@ def get_secoc_key(key_struct): |
180 | 179 | # Manually send so we don't get stuck waiting for the response |
181 | 180 | # uds_client.routine_control(ROUTINE_CONTROL_TYPE.START, 0xff00, data) |
182 | 181 | erase = b"\x31\x01\xff\x00" + data |
183 | | - panda.isotp_send(ADDR, erase, bus=BUS) |
| 182 | + isotp_send(panda, erase, ADDR, bus=BUS) |
184 | 183 |
|
185 | 184 | print("\nDumping keys...") |
186 | 185 | start = 0xfebe6e34 |
|
0 commit comments