[Pkg-wmaker-commits] [wmbattery] 221/241: wmbattery: upower - don't exit after suspend/hibernation wakup
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:38:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbattery.
commit d95ac505453902d6fbeb4af5c2ea49cb29e1866f
Author: Christoph Fritz <chf.fritz at googlemail.com>
Date: Wed May 13 23:38:51 2015 -0500
wmbattery: upower - don't exit after suspend/hibernation wakup
Immediately after suspend/hibernation wakup cycle, up_client_get_devices()
can fail:
libupower-glib-WARNING **: up_client_get_devices failed: Timeout was reached
Since we do not interpret the UPower signals, just don't exit wmbattery after
first up_client_get_devices() failure.
---
upower.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/upower.c b/upower.c
index 75ba874..6db4fd1 100644
--- a/upower.c
+++ b/upower.c
@@ -9,6 +9,8 @@
#include <upower.h>
#include "apm.h"
+#define MAX_RETRIES 3
+
static UpClient * up;
struct context {
@@ -74,6 +76,7 @@ int upower_supported(void)
int upower_read(int battery, apm_info *info)
{
GPtrArray *devices = NULL;
+ static int retries = 0;
up = up_client_new();
@@ -87,9 +90,15 @@ int upower_read(int battery, apm_info *info)
devices = up_client_get_devices(up);
- if (!devices)
- return -1;
+ if (!devices) {
+ retries++;
+ if (retries < MAX_RETRIES)
+ return 0; /* fine immediately after hibernation */
+ else
+ return -1;
+ }
+ retries = 0;
info->battery_flags = 0;
info->using_minutes = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbattery.git
More information about the Pkg-wmaker-commits
mailing list