summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/device.c19
-rw-r--r--src/device.h2
-rw-r--r--src/gui.c11
-rw-r--r--src/sbmgr.c2
4 files changed, 27 insertions, 7 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!"));
diff --git a/src/device.h b/src/device.h
index b89f0ea..a12da88 100644
--- a/src/device.h
+++ b/src/device.h
@@ -37,7 +37,7 @@ struct device_info_int {
typedef struct device_info_int *device_info_t;
void device_init();
-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);
void device_sbs_free(sbservices_client_t sbc);
gboolean device_sbs_get_iconstate(sbservices_client_t sbc, plist_t *iconstate, GError **error);
gboolean device_sbs_save_icon(sbservices_client_t sbc, char *display_identifier, char *filename, GError **error);
diff --git a/src/gui.c b/src/gui.c
index a76034d..0ab2ac7 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1136,6 +1136,7 @@ static void gui_set_wallpaper(const char *wp)
static gboolean gui_pages_init_cb(gpointer user_data)
{
const char *uuid = (const char*)user_data;
+ uint32_t osversion = 0;
GError *error = NULL;
plist_t iconstate = NULL;
@@ -1147,7 +1148,7 @@ static gboolean gui_pages_init_cb(gpointer user_data)
/* connect to sbservices */
if (!sbc)
- sbc = device_sbs_new(uuid, &error);
+ sbc = device_sbs_new(uuid, &osversion, &error);
if (error) {
g_printerr("%s", error->message);
@@ -1156,9 +1157,11 @@ static gboolean gui_pages_init_cb(gpointer user_data)
}
if (sbc) {
- /* Load wallpaper if available */
- if (device_sbs_save_wallpaper(sbc, "/tmp/wallpaper.png", &error)) {
- gui_set_wallpaper("/tmp/wallpaper.png");
+ if (osversion >= 0x04000000) {
+ /* Load wallpaper if available */
+ if (device_sbs_save_wallpaper(sbc, "/tmp/wallpaper.png", &error)) {
+ gui_set_wallpaper("/tmp/wallpaper.png");
+ }
}
/* Load icon data */
diff --git a/src/sbmgr.c b/src/sbmgr.c
index b115a1e..2a3502c 100644
--- a/src/sbmgr.c
+++ b/src/sbmgr.c
@@ -131,7 +131,7 @@ void sbmgr_save(const char *uuid)
GError *error = NULL;
sbservices_client_t sbc;
- sbc = device_sbs_new(uuid, &error);
+ sbc = device_sbs_new(uuid, NULL, &error);
if (error) {
g_printerr("%s", error->message);