diff options
author | Josef Micka | 2022-09-21 14:50:55 +0200 |
---|---|---|
committer | Nikias Bassen | 2022-09-21 17:08:58 +0200 |
commit | 7f24e9a9c9e862c4d65c3a460fc2315d606d9c7d (patch) | |
tree | 31f61e678dec5cbdb32d971e950bdb3a8e6cd319 | |
parent | f50e52f3393a9149ac65fdda8f0d425109efc7fe (diff) | |
download | usbmuxd-7f24e9a9c9e862c4d65c3a460fc2315d606d9c7d.tar.gz usbmuxd-7f24e9a9c9e862c4d65c3a460fc2315d606d9c7d.tar.bz2 |
Fix preflight for older devices
On older devices with iOS 5 and even before there is no "ProductName", only
"ProductType" or "DeviceClass" (which is still present).
usbmuxd fails to connect these devices, because it can't receive product name.
"DeviceClass", like "ProductVersion", can be retrieved even in locked state,
so this commit changes it to use that instead.
-rw-r--r-- | src/preflight.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/preflight.c b/src/preflight.c index 5902f5d..68e7f2c 100644 --- a/src/preflight.c +++ b/src/preflight.c @@ -148,7 +148,7 @@ static void* preflight_worker_handle_device_add(void* userdata) plist_t value = NULL; char* version_str = NULL; - char* platform_str = NULL; + char* deviceclass_str = NULL; usbmuxd_log(LL_INFO, "%s: Starting preflight on device %s...", __func__, _dev->udid); @@ -228,28 +228,28 @@ retry: goto leave; } - lerr = lockdownd_get_value(lockdown, NULL, "ProductName", &value); + lerr = lockdownd_get_value(lockdown, NULL, "DeviceClass", &value); if (lerr != LOCKDOWN_E_SUCCESS) { - usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get ProductName from device %s, lockdown error %d", __func__, _dev->udid, lerr); + usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get DeviceClass from device %s, lockdown error %d", __func__, _dev->udid, lerr); goto leave; } if (value && plist_get_node_type(value) == PLIST_STRING) { - plist_get_string_val(value, &platform_str); + plist_get_string_val(value, &deviceclass_str); } plist_free(value); - if (!platform_str) { - usbmuxd_log(LL_ERROR, "%s: Could not get ProductName string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data); + if (!deviceclass_str) { + usbmuxd_log(LL_ERROR, "%s: Could not get DeviceClass string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data); goto leave; } int version_major = strtol(version_str, NULL, 10); - if ((!strcmp(platform_str, "iPhone OS") && version_major >= 7) - || ((!strcmp(platform_str, "watchOS") || !strcmp(platform_str, "Watch OS")) && version_major >= 2) - || (!strcmp(platform_str, "Apple TVOS") && version_major >= 9) + if (((!strcmp(deviceclass_str, "iPhone") || !strcmp(deviceclass_str, "iPad")) && version_major >= 7) + || (!strcmp(deviceclass_str, "Watch") && version_major >= 2) + || (!strcmp(deviceclass_str, "AppleTV") && version_major >= 9) ) { /* iOS 7.0 / watchOS 2.0 / tvOS 9.0 and later */ - usbmuxd_log(LL_INFO, "%s: Found %s %s device %s", __func__, platform_str, version_str, _dev->udid); + usbmuxd_log(LL_INFO, "%s: Found %s %s device %s", __func__, deviceclass_str, version_str, _dev->udid); lockdownd_set_untrusted_host_buid(lockdown); @@ -356,7 +356,7 @@ retry: } leave: - free(platform_str); + free(deviceclass_str); free(version_str); if (lockdown) lockdownd_client_free(lockdown); |