From 988889121ec44674aadaf0a23e61630bf6105b16 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 28 Oct 2013 14:37:37 +0100 Subject: linux: Switch iDevices to use the new daemon poll And remove the gathering of the battery poll from the device itself, it's of nearly no use. --- src/linux/up-device-idevice.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c index 86eccf5..27d7319 100644 --- a/src/linux/up-device-idevice.c +++ b/src/linux/up-device-idevice.c @@ -41,13 +41,10 @@ #include "up-types.h" #include "up-device-idevice.h" -#define UP_DEVICE_IDEVICE_DEFAULT_POLL_TIME 60 /* seconds */ - struct UpDeviceIdevicePrivate { idevice_t dev; lockdownd_client_t client; - guint poll_timer_id; }; G_DEFINE_TYPE (UpDeviceIdevice, up_device_idevice, UP_TYPE_DEVICE) @@ -82,8 +79,6 @@ up_device_idevice_coldplug (UpDevice *device) GUdevDevice *native; const gchar *uuid; const gchar *model; - plist_t dict, node; - guint64 poll_seconds = 0; idevice_t dev = NULL; lockdownd_client_t client = NULL; UpDeviceKind kind; @@ -105,17 +100,6 @@ up_device_idevice_coldplug (UpDevice *device) if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake (dev, &client, "upower")) goto out; - /* Get the poll timeout */ - if (lockdownd_get_value (client, "com.apple.mobile.iTunes", "BatteryPollInterval", &dict) != LOCKDOWN_E_SUCCESS) - goto out; - - node = plist_dict_get_item (dict, "BatteryPollInterval"); - if (node != NULL) - plist_get_uint_val (node, &poll_seconds); - if (poll_seconds == 0) - poll_seconds = UP_DEVICE_IDEVICE_DEFAULT_POLL_TIME; - plist_free (dict); - /* Set up struct */ idevice->priv->dev = dev; idevice->priv->client = client; @@ -150,10 +134,7 @@ up_device_idevice_coldplug (UpDevice *device) idevice->priv->client = NULL; /* set up a poll */ - idevice->priv->poll_timer_id = g_timeout_add_seconds (poll_seconds, - (GSourceFunc) up_device_idevice_poll_cb, idevice); - - g_source_set_name_by_id (idevice->priv->poll_timer_id, "[upower] up_device_idevice_poll_cb (linux)"); + up_daemon_start_poll (G_OBJECT (idevice), (GSourceFunc) up_device_idevice_poll_cb); return TRUE; out: @@ -256,8 +237,7 @@ up_device_idevice_finalize (GObject *object) idevice = UP_DEVICE_IDEVICE (object); g_return_if_fail (idevice->priv != NULL); - if (idevice->priv->poll_timer_id > 0) - g_source_remove (idevice->priv->poll_timer_id); + up_daemon_stop_poll (object); if (idevice->priv->client != NULL) lockdownd_client_free (idevice->priv->client); idevice_free (idevice->priv->dev); -- cgit v1.2.1