diff options
| author | 2025-06-07 12:11:59 +0200 | |
|---|---|---|
| committer | 2025-06-07 12:11:59 +0200 | |
| commit | 0480584865f0ce32cc9172a2e6468a7e991b46f5 (patch) | |
| tree | be9e68dd2d553d9e615332f382e6017d6d7edf20 | |
| parent | e3f2d6070de7125058c343ef63961c27bc991bb6 (diff) | |
| download | libimobiledevice-0480584865f0ce32cc9172a2e6468a7e991b46f5.tar.gz libimobiledevice-0480584865f0ce32cc9172a2e6468a7e991b46f5.tar.bz2 | |
idevicebackup2: Use new idevice_get_device_version helper
| -rw-r--r-- | tools/idevicebackup2.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 1a767cd..34b9739 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -1468,8 +1468,6 @@ static void print_usage(int argc, char **argv, int is_error) | |||
| 1468 | ); | 1468 | ); |
| 1469 | } | 1469 | } |
| 1470 | 1470 | ||
| 1471 | #define DEVICE_VERSION(maj, min, patch) ((((maj) & 0xFF) << 16) | (((min) & 0xFF) << 8) | ((patch) & 0xFF)) | ||
| 1472 | |||
| 1473 | int main(int argc, char *argv[]) | 1471 | int main(int argc, char *argv[]) |
| 1474 | { | 1472 | { |
| 1475 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 1473 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| @@ -1849,23 +1847,7 @@ int main(int argc, char *argv[]) | |||
| 1849 | } | 1847 | } |
| 1850 | 1848 | ||
| 1851 | /* get ProductVersion */ | 1849 | /* get ProductVersion */ |
| 1852 | char *product_version = NULL; | 1850 | int device_version = idevice_get_device_version(device); |
| 1853 | int device_version = 0; | ||
| 1854 | node_tmp = NULL; | ||
| 1855 | lockdownd_get_value(lockdown, NULL, "ProductVersion", &node_tmp); | ||
| 1856 | if (node_tmp) { | ||
| 1857 | if (plist_get_node_type(node_tmp) == PLIST_STRING) { | ||
| 1858 | plist_get_string_val(node_tmp, &product_version); | ||
| 1859 | } | ||
| 1860 | plist_free(node_tmp); | ||
| 1861 | node_tmp = NULL; | ||
| 1862 | } | ||
| 1863 | if (product_version) { | ||
| 1864 | int vers[3] = { 0, 0, 0 }; | ||
| 1865 | if (sscanf(product_version, "%d.%d.%d", &vers[0], &vers[1], &vers[2]) >= 2) { | ||
| 1866 | device_version = DEVICE_VERSION(vers[0], vers[1], vers[2]); | ||
| 1867 | } | ||
| 1868 | } | ||
| 1869 | 1851 | ||
| 1870 | /* start notification_proxy */ | 1852 | /* start notification_proxy */ |
| 1871 | ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); | 1853 | ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); |
| @@ -2065,7 +2047,7 @@ checkpoint: | |||
| 2065 | } else { | 2047 | } else { |
| 2066 | PRINT_VERBOSE(1, "Incremental backup mode.\n"); | 2048 | PRINT_VERBOSE(1, "Incremental backup mode.\n"); |
| 2067 | } | 2049 | } |
| 2068 | if (device_version >= DEVICE_VERSION(16,1,0)) { | 2050 | if (device_version >= IDEVICE_DEVICE_VERSION(16,1,0)) { |
| 2069 | /* let's wait 2 second to see if the device passcode is requested */ | 2051 | /* let's wait 2 second to see if the device passcode is requested */ |
| 2070 | int retries = 20; | 2052 | int retries = 20; |
| 2071 | while (retries-- > 0 && !passcode_requested) { | 2053 | while (retries-- > 0 && !passcode_requested) { |
| @@ -2246,7 +2228,7 @@ checkpoint: | |||
| 2246 | if (newpw || backup_password) { | 2228 | if (newpw || backup_password) { |
| 2247 | mobilebackup2_send_message(mobilebackup2, "ChangePassword", opts); | 2229 | mobilebackup2_send_message(mobilebackup2, "ChangePassword", opts); |
| 2248 | uint8_t passcode_hint = 0; | 2230 | uint8_t passcode_hint = 0; |
| 2249 | if (device_version >= DEVICE_VERSION(13,0,0)) { | 2231 | if (device_version >= IDEVICE_DEVICE_VERSION(13,0,0)) { |
| 2250 | diagnostics_relay_client_t diag = NULL; | 2232 | diagnostics_relay_client_t diag = NULL; |
| 2251 | if (diagnostics_relay_client_start_service(device, &diag, TOOL_NAME) == DIAGNOSTICS_RELAY_E_SUCCESS) { | 2233 | if (diagnostics_relay_client_start_service(device, &diag, TOOL_NAME) == DIAGNOSTICS_RELAY_E_SUCCESS) { |
| 2252 | plist_t dict = NULL; | 2234 | plist_t dict = NULL; |
