diff --git a/dbus/org.freedesktop.UPower.Device.xml b/dbus/org.freedesktop.UPower.Device.xml
index f286aa7..17781c5 100644
--- a/dbus/org.freedesktop.UPower.Device.xml
+++ b/dbus/org.freedesktop.UPower.Device.xml
@@ -146,7 +146,7 @@ method return sender=:1.386 -> dest=:1.477 reply_serial=2
Refreshes the data collected from the power source.
- Callers need the org.freedesktop.upower.refresh-power-source authorization
+ Callers will need to make sure that the daemon was started in debug mode
if an error occured while refreshing
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c
index db0149f..d8978c4 100644
--- a/libupower-glib/up-device.c
+++ b/libupower-glib/up-device.c
@@ -408,7 +408,8 @@ up_device_to_text (UpDevice *device)
* @error: a #GError, or %NULL.
*
* Refreshes properties on the device.
- * This function is normally not required.
+ * This function is normally not required and will only return without
+ * an error if the daemon was started in debug mode.
*
* Return value: #TRUE for success, else #FALSE and @error is used
*
diff --git a/src/up-device.c b/src/up-device.c
index 74f809f..0bfca03 100644
--- a/src/up-device.c
+++ b/src/up-device.c
@@ -400,6 +400,21 @@ up_device_register_device (UpDevice *device)
return TRUE;
}
+/**
+ * up_device_refresh:
+ *
+ * Return %TRUE on success, %FALSE if we failed to refresh or no data
+ **/
+static gboolean
+up_device_refresh (UpExportedDevice *skeleton,
+ GDBusMethodInvocation *invocation,
+ UpDevice *device)
+{
+ up_device_refresh_internal (device);
+ up_exported_device_complete_refresh (skeleton, invocation);
+ return TRUE;
+}
+
/**
* up_device_coldplug:
*
@@ -416,6 +431,9 @@ up_device_coldplug (UpDevice *device)
g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
native_path = up_native_get_native_path (device->priv->native);
+ if (up_daemon_get_debug (device->priv->daemon))
+ g_signal_connect (device, "handle-refresh",
+ G_CALLBACK (up_device_refresh), device);
up_exported_device_set_native_path (UP_EXPORTED_DEVICE (device), native_path);
/* coldplug source */
@@ -581,21 +599,6 @@ out:
return TRUE;
}
-/**
- * up_device_refresh:
- *
- * Return %TRUE on success, %FALSE if we failed to refresh or no data
- **/
-static gboolean
-up_device_refresh (UpExportedDevice *skeleton,
- GDBusMethodInvocation *invocation,
- UpDevice *device)
-{
- up_device_refresh_internal (device);
- up_exported_device_complete_refresh (skeleton, invocation);
- return TRUE;
-}
-
/**
* up_device_register_display_device:
**/
@@ -685,8 +688,6 @@ up_device_init (UpDevice *device)
G_CALLBACK (up_device_get_history), device);
g_signal_connect (device, "handle-get-statistics",
G_CALLBACK (up_device_get_statistics), device);
- g_signal_connect (device, "handle-refresh",
- G_CALLBACK (up_device_refresh), device);
}
/**