From 12e24e4bd161c76631c77244f63ff02ef18f251d Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 4 Oct 2022 15:31:17 +0200 Subject: preflight: Assume old iOS version if retrieval of ProductVersion fails Some older devices (e.g. iOS 2.x) wouldn't allow querying the iOS version if the device is not paired. In this case we just assume an old version instead of erroring out, and this way the device will be made available. --- src/preflight.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/preflight.c b/src/preflight.c index 68e7f2c..9c57e98 100644 --- a/src/preflight.c +++ b/src/preflight.c @@ -214,18 +214,19 @@ retry: lerr = lockdownd_get_value(lockdown, NULL, "ProductVersion", &value); if (lerr != LOCKDOWN_E_SUCCESS) { - usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get ProductVersion 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, &version_str); - } - plist_free(value); + usbmuxd_log(LL_WARNING, "%s: Could not get ProductVersion from device %s, lockdown error %d", __func__, _dev->udid, lerr); + /* assume old iOS version */ + version_str = strdup("1.0"); + } else { + if (value && plist_get_node_type(value) == PLIST_STRING) { + plist_get_string_val(value, &version_str); + } + plist_free(value); - if (!version_str) { - usbmuxd_log(LL_ERROR, "%s: Could not get ProductVersion string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data); - goto leave; + if (!version_str) { + usbmuxd_log(LL_ERROR, "%s: Could not get ProductVersion string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data); + goto leave; + } } lerr = lockdownd_get_value(lockdown, NULL, "DeviceClass", &value); -- cgit v1.1-32-gdbae