Skip to content

Commit

Permalink
try to add support for switchpatch programming mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bri3d committed Sep 29, 2022
1 parent 9cda3c1 commit 42480ef
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/flash_uds.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,24 @@ def volkswagen_security_algo(level: int, seed: bytes, params=None) -> bytes:
)

detailedLogger.info("Upgrading to programming session...")
client.change_session(
services.DiagnosticSessionControl.Session.programmingSession
)

try:
client.change_session(
services.DiagnosticSessionControl.Session.programmingSession
)
except:

def switchpatch_programming_payload(payload):
# Switchpatch ASW takes `3E 10 02` and enters a Programming session even if conditions are not met
return bytes([0x3E, 0x10, 0x02])

with client.payload_override(switchpatch_programming_payload):
client.session_timing["p2_server_max"] = 30
client.config["request_timeout"] = 30
try:
client.tester_present()
except exceptions.UnexpectedResponseException:
pass

# Fix timeouts to work around setups which lie about their response speed
client.session_timing["p2_server_max"] = 30
Expand Down

0 comments on commit 42480ef

Please sign in to comment.