summaryrefslogtreecommitdiffstats
path: root/src/device.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-07-09 17:34:12 +0200
committerGravatar Nikias Bassen2010-07-09 17:34:12 +0200
commit113022dbed485bec83b359677874d06230c15edf (patch)
tree67d76b30daf688975dd014ee6e5aeeb494cd43f0 /src/device.c
parent445026e4728feef1295d6d47ba8e873e87fdec41 (diff)
downloadsbmanager-113022dbed485bec83b359677874d06230c15edf.tar.gz
sbmanager-113022dbed485bec83b359677874d06230c15edf.tar.bz2
Only try to load wallpaper for iOS 4.0+
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index a76b6e7..4617118 100644
--- a/src/device.c
+++ b/src/device.c
@@ -47,7 +47,7 @@ void device_init()
device_domain = g_quark_from_string("libimobiledevice");
}
-sbservices_client_t device_sbs_new(const char *uuid, GError **error)
+sbservices_client_t device_sbs_new(const char *uuid, uint32_t *osversion, GError **error)
{
sbservices_client_t sbc = NULL;
idevice_t phone = NULL;
@@ -70,6 +70,23 @@ sbservices_client_t device_sbs_new(const char *uuid, GError **error)
goto leave_cleanup;
}
+ plist_t version = NULL;
+ if (osversion && lockdownd_get_value(client, NULL, "ProductVersion", &version) == LOCKDOWN_E_SUCCESS) {
+ if (plist_get_node_type(version) == PLIST_STRING) {
+ char *version_string = NULL;
+ plist_get_string_val(version, &version_string);
+ if (version_string) {
+ /* parse version */
+ int maj = 0;
+ int min = 0;
+ int rev = 0;
+ sscanf(version_string, "%d.%d.%d", &maj, &min, &rev);
+ free(version_string);
+ *osversion = ((maj & 0xFF) << 24) + ((min & 0xFF) << 16) + ((rev & 0xFF) << 8);
+ }
+ }
+ }
+
if ((lockdownd_start_service(client, "com.apple.springboardservices", &port) != LOCKDOWN_E_SUCCESS) || !port) {
if (error)
*error = g_error_new(device_domain, EIO, _("Could not start com.apple.springboardservices service! Remind that this feature is only supported in OS 3.1 and later!"));