diff options
Diffstat (limited to 'tools/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index c73b269..19d21a6 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -74,6 +74,7 @@ | |||
| 74 | 74 | ||
| 75 | static int verbose = 1; | 75 | static int verbose = 1; |
| 76 | static int quit_flag = 0; | 76 | static int quit_flag = 0; |
| 77 | static int passcode_requested = 0; | ||
| 77 | 78 | ||
| 78 | #define PRINT_VERBOSE(min_level, ...) if (verbose >= min_level) { printf(__VA_ARGS__); }; | 79 | #define PRINT_VERBOSE(min_level, ...) if (verbose >= min_level) { printf(__VA_ARGS__); }; |
| 79 | 80 | ||
| @@ -115,6 +116,10 @@ static void notify_cb(const char *notification, void *userdata) | |||
| 115 | quit_flag++; | 116 | quit_flag++; |
| 116 | } else if (!strcmp(notification, NP_BACKUP_DOMAIN_CHANGED)) { | 117 | } else if (!strcmp(notification, NP_BACKUP_DOMAIN_CHANGED)) { |
| 117 | backup_domain_changed = 1; | 118 | backup_domain_changed = 1; |
| 119 | } else if (!strcmp(notification, "com.apple.LocalAuthentication.ui.presented")) { | ||
| 120 | passcode_requested = 1; | ||
| 121 | } else if (!strcmp(notification, "com.apple.LocalAuthentication.ui.dismissed")) { | ||
| 122 | passcode_requested = 0; | ||
| 118 | } else { | 123 | } else { |
| 119 | PRINT_VERBOSE(1, "Unhandled notification '%s' (TODO: implement)\n", notification); | 124 | PRINT_VERBOSE(1, "Unhandled notification '%s' (TODO: implement)\n", notification); |
| 120 | } | 125 | } |
| @@ -1867,11 +1872,13 @@ int main(int argc, char *argv[]) | |||
| 1867 | if ((ldret == LOCKDOWN_E_SUCCESS) && service && service->port) { | 1872 | if ((ldret == LOCKDOWN_E_SUCCESS) && service && service->port) { |
| 1868 | np_client_new(device, service, &np); | 1873 | np_client_new(device, service, &np); |
| 1869 | np_set_notify_callback(np, notify_cb, NULL); | 1874 | np_set_notify_callback(np, notify_cb, NULL); |
| 1870 | const char *noties[5] = { | 1875 | const char *noties[7] = { |
| 1871 | NP_SYNC_CANCEL_REQUEST, | 1876 | NP_SYNC_CANCEL_REQUEST, |
| 1872 | NP_SYNC_SUSPEND_REQUEST, | 1877 | NP_SYNC_SUSPEND_REQUEST, |
| 1873 | NP_SYNC_RESUME_REQUEST, | 1878 | NP_SYNC_RESUME_REQUEST, |
| 1874 | NP_BACKUP_DOMAIN_CHANGED, | 1879 | NP_BACKUP_DOMAIN_CHANGED, |
| 1880 | "com.apple.LocalAuthentication.ui.presented", | ||
| 1881 | "com.apple.LocalAuthentication.ui.dismissed", | ||
| 1875 | NULL | 1882 | NULL |
| 1876 | }; | 1883 | }; |
| 1877 | np_observe_notifications(np, noties); | 1884 | np_observe_notifications(np, noties); |
| @@ -2058,6 +2065,16 @@ checkpoint: | |||
| 2058 | } else { | 2065 | } else { |
| 2059 | PRINT_VERBOSE(1, "Incremental backup mode.\n"); | 2066 | PRINT_VERBOSE(1, "Incremental backup mode.\n"); |
| 2060 | } | 2067 | } |
| 2068 | if (device_version >= DEVICE_VERSION(16,1,0)) { | ||
| 2069 | /* let's wait 2 second to see if the device passcode is requested */ | ||
| 2070 | int retries = 20; | ||
| 2071 | while (retries-- > 0 && !passcode_requested) { | ||
| 2072 | usleep(100000); | ||
| 2073 | } | ||
| 2074 | if (passcode_requested) { | ||
| 2075 | printf("*** Waiting for passcode to be entered on the device ***\n"); | ||
| 2076 | } | ||
| 2077 | } | ||
| 2061 | } else { | 2078 | } else { |
| 2062 | if (err == MOBILEBACKUP2_E_BAD_VERSION) { | 2079 | if (err == MOBILEBACKUP2_E_BAD_VERSION) { |
| 2063 | printf("ERROR: Could not start backup process: backup protocol version mismatch!\n"); | 2080 | printf("ERROR: Could not start backup process: backup protocol version mismatch!\n"); |
