Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/restorekit-sys/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ compiles the patched copy.
off USB as it reboots or re-enumerating once it's back. It then bailed with
"Unable to discover device mode" while the Mac was still on its way back.
Loop until the mode is known or the minute is up.
- `0008-send-appletcon-firmware-without-response-tags.patch` — since upstream
started honoring `ResponseTags`, the AppleTCON updater only gets
`FirmwareData` when the request lists it. A Mac16,5 sends its request with
no `ResponseTags` at all, gets just the Baobab ticket, and fails checkpoint
0x1332 ("failed to copy response for AppleTCON") while the restore carries
on. When `ResponseTags` is missing, send the firmware like before, falling
back to the ticket-only reply if it can't be extracted.

## Updating a patch

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/src/restore.c b/src/restore.c
index 7ffe876..0fc2c08 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -3343,14 +3343,26 @@ static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* cl
logger(LL_ERROR, "No 'Baobab,Ticket' in TSS response, this might not work\n");
}

- /* don't add FirmwareData if not requested via ResponseTags */
- if (!_wants_firmware_data(arguments)) {
+ /* don't add FirmwareData if not requested via ResponseTags. A request
+ * with no ResponseTags at all (seen from a Mac16,5) doesn't say what it
+ * wants, and a ticket-only reply fails the updater with "failed to copy
+ * response for AppleTCON", so send the firmware there like we did before
+ * ResponseTags were honored. */
+ int has_response_tags = plist_access_path(arguments, 2, "DeviceGeneratedTags", "ResponseTags") != NULL;
+ if (has_response_tags && !_wants_firmware_data(arguments)) {
logger(LL_DEBUG, "Not adding FirmwareData as it was not requested\n");
return response;
}
+ if (!has_response_tags) {
+ logger(LL_INFO, "AppleTCON: request has no ResponseTags, adding FirmwareData\n");
+ }

if (build_identity_get_component_path(client->restore->build_identity, comp_name, &comp_path) < 0) {
logger(LL_ERROR, "Unable to get path for '%s' component\n", comp_name);
+ if (!has_response_tags) {
+ /* Keep the previous ticket-only reply rather than fail the restore. */
+ return response;
+ }
plist_free(response);
return NULL;
}
@@ -3361,6 +3373,9 @@ static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* cl
comp_path = NULL;
if (ret < 0) {
logger(LL_ERROR, "Unable to extract '%s' component\n", comp_name);
+ if (!has_response_tags) {
+ return response;
+ }
plist_free(response);
return NULL;
}
Loading