summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Josef Micka2022-09-21 14:50:55 +0200
committerGravatar Nikias Bassen2022-09-21 17:08:58 +0200
commit7f24e9a9c9e862c4d65c3a460fc2315d606d9c7d (patch)
tree31f61e678dec5cbdb32d971e950bdb3a8e6cd319 /src
parentf50e52f3393a9149ac65fdda8f0d425109efc7fe (diff)
downloadusbmuxd-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.
Diffstat (limited to 'src')
-rw-r--r--src/preflight.c22
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)
148 148
149 plist_t value = NULL; 149 plist_t value = NULL;
150 char* version_str = NULL; 150 char* version_str = NULL;
151 char* platform_str = NULL; 151 char* deviceclass_str = NULL;
152 152
153 usbmuxd_log(LL_INFO, "%s: Starting preflight on device %s...", __func__, _dev->udid); 153 usbmuxd_log(LL_INFO, "%s: Starting preflight on device %s...", __func__, _dev->udid);
154 154
@@ -228,28 +228,28 @@ retry:
228 goto leave; 228 goto leave;
229 } 229 }
230 230
231 lerr = lockdownd_get_value(lockdown, NULL, "ProductName", &value); 231 lerr = lockdownd_get_value(lockdown, NULL, "DeviceClass", &value);
232 if (lerr != LOCKDOWN_E_SUCCESS) { 232 if (lerr != LOCKDOWN_E_SUCCESS) {
233 usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get ProductName from device %s, lockdown error %d", __func__, _dev->udid, lerr); 233 usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get DeviceClass from device %s, lockdown error %d", __func__, _dev->udid, lerr);
234 goto leave; 234 goto leave;
235 } 235 }
236 if (value && plist_get_node_type(value) == PLIST_STRING) { 236 if (value && plist_get_node_type(value) == PLIST_STRING) {
237 plist_get_string_val(value, &platform_str); 237 plist_get_string_val(value, &deviceclass_str);
238 } 238 }
239 plist_free(value); 239 plist_free(value);
240 240
241 if (!platform_str) { 241 if (!deviceclass_str) {
242 usbmuxd_log(LL_ERROR, "%s: Could not get ProductName string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data); 242 usbmuxd_log(LL_ERROR, "%s: Could not get DeviceClass string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data);
243 goto leave; 243 goto leave;
244 } 244 }
245 245
246 int version_major = strtol(version_str, NULL, 10); 246 int version_major = strtol(version_str, NULL, 10);
247 if ((!strcmp(platform_str, "iPhone OS") && version_major >= 7) 247 if (((!strcmp(deviceclass_str, "iPhone") || !strcmp(deviceclass_str, "iPad")) && version_major >= 7)
248 || ((!strcmp(platform_str, "watchOS") || !strcmp(platform_str, "Watch OS")) && version_major >= 2) 248 || (!strcmp(deviceclass_str, "Watch") && version_major >= 2)
249 || (!strcmp(platform_str, "Apple TVOS") && version_major >= 9) 249 || (!strcmp(deviceclass_str, "AppleTV") && version_major >= 9)
250 ) { 250 ) {
251 /* iOS 7.0 / watchOS 2.0 / tvOS 9.0 and later */ 251 /* iOS 7.0 / watchOS 2.0 / tvOS 9.0 and later */
252 usbmuxd_log(LL_INFO, "%s: Found %s %s device %s", __func__, platform_str, version_str, _dev->udid); 252 usbmuxd_log(LL_INFO, "%s: Found %s %s device %s", __func__, deviceclass_str, version_str, _dev->udid);
253 253
254 lockdownd_set_untrusted_host_buid(lockdown); 254 lockdownd_set_untrusted_host_buid(lockdown);
255 255
@@ -356,7 +356,7 @@ retry:
356 } 356 }
357 357
358leave: 358leave:
359 free(platform_str); 359 free(deviceclass_str);
360 free(version_str); 360 free(version_str);
361 if (lockdown) 361 if (lockdown)
362 lockdownd_client_free(lockdown); 362 lockdownd_client_free(lockdown);