Update to upower-0.9.12 plus fixes.
Discussed with and OK landry@, ajacoutot@
This commit is contained in:
parent
63daa32aaa
commit
35708a7e9c
@ -1,15 +1,14 @@
|
||||
# $OpenBSD: Makefile,v 1.8 2011/07/04 17:44:27 dcoppa Exp $
|
||||
# $OpenBSD: Makefile,v 1.9 2011/07/07 19:02:43 dcoppa Exp $
|
||||
|
||||
ONLY_FOR_ARCHS =${APM_ARCHS}
|
||||
|
||||
COMMENT = userland power management interface
|
||||
|
||||
DISTNAME = upower-0.9.11
|
||||
DISTNAME = upower-0.9.12
|
||||
EXTRACT_SUFX = .tar.xz
|
||||
CATEGORIES = sysutils
|
||||
SHARED_LIBS += upower-glib 0.0 # 1.1
|
||||
|
||||
REVISION = 1
|
||||
|
||||
HOMEPAGE = http://upower.freedesktop.org/
|
||||
MASTER_SITES = ${HOMEPAGE}/releases/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
MD5 (upower-0.9.11.tar.gz) = jnvLM1cNGk7cXDsNrz/lrg==
|
||||
RMD160 (upower-0.9.11.tar.gz) = rSQx4Op5HaMHaE5rV2B+HldXOQk=
|
||||
SHA1 (upower-0.9.11.tar.gz) = 3c9xFBchv52j1kVQpXjHOar+16M=
|
||||
SHA256 (upower-0.9.11.tar.gz) = XCzSJFJ9jTKiPYAoZLmtgMQHAooH50MpwF2jbepBBOo=
|
||||
SIZE (upower-0.9.11.tar.gz) = 634855
|
||||
MD5 (upower-0.9.12.tar.xz) = 1SoTwA8GqIzHxlQWEAdkag==
|
||||
RMD160 (upower-0.9.12.tar.xz) = Lz3hwTrZ+u7wFKZ/o3iIiRDGgFU=
|
||||
SHA1 (upower-0.9.12.tar.xz) = 2JgwQjR7T4+E4nAA1k0UGFk6e2U=
|
||||
SHA256 (upower-0.9.12.tar.xz) = Bue7MjyTqON3o8xQALjer90iyS89Lz738aH3TY4TS7A=
|
||||
SIZE (upower-0.9.12.tar.xz) = 389372
|
||||
|
@ -1,7 +1,7 @@
|
||||
$OpenBSD: patch-configure,v 1.2 2011/05/30 07:48:53 landry Exp $
|
||||
--- configure.orig Wed May 4 18:50:00 2011
|
||||
+++ configure Mon May 30 09:43:16 2011
|
||||
@@ -14131,10 +14131,6 @@ else
|
||||
$OpenBSD: patch-configure,v 1.3 2011/07/07 19:02:43 dcoppa Exp $
|
||||
--- configure.orig Mon Jul 4 17:45:17 2011
|
||||
+++ configure Tue Jul 5 08:58:37 2011
|
||||
@@ -14244,10 +14244,6 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-src_openbsd_up-apm-native_h,v 1.1 2011/05/30 07:48:53 landry Exp $
|
||||
--- src/openbsd/up-apm-native.h.orig Mon May 30 09:43:40 2011
|
||||
+++ src/openbsd/up-apm-native.h Mon May 30 09:44:03 2011
|
||||
@@ -25,6 +25,8 @@
|
||||
/* os-specific headers */
|
||||
#include <errno.h> /* errno */
|
||||
#include <fcntl.h> /* open() */
|
||||
+#include <unistd.h> /* close() */
|
||||
+#include <string.h> /* strcmp() */
|
||||
/* kevent() */
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
@ -1,7 +1,17 @@
|
||||
$OpenBSD: patch-src_openbsd_up-backend_c,v 1.1 2011/06/17 15:08:36 landry Exp $
|
||||
$OpenBSD: patch-src_openbsd_up-backend_c,v 1.2 2011/07/07 19:02:43 dcoppa Exp $
|
||||
|
||||
Return true if apm_fd wasn't initialized yet - fixes history
|
||||
--- src/openbsd/up-backend.c.orig Thu Jun 16 09:19:40 2011
|
||||
+++ src/openbsd/up-backend.c Thu Jun 16 09:20:38 2011
|
||||
|
||||
XXX Sometimes apm(4) is not fast enough in calculating the right
|
||||
time-to-empty value and 'minutes_left' is left as -1, causing
|
||||
gnome-power-manager to show something like "1193046 hours 27 minutes
|
||||
of battery power remaining". So, check for minutes_left to be
|
||||
non-negative and zero out new_time_to_empty if it is XXX
|
||||
|
||||
Properly initialize update-time when creating devices
|
||||
|
||||
--- src/openbsd/up-backend.c.orig Tue May 31 12:07:03 2011
|
||||
+++ src/openbsd/up-backend.c Thu Jul 7 19:24:21 2011
|
||||
@@ -62,7 +62,7 @@ enum {
|
||||
|
||||
static guint signals [SIGNAL_LAST] = { 0 };
|
||||
@ -11,15 +21,59 @@ Return true if apm_fd wasn't initialized yet - fixes history
|
||||
|
||||
G_DEFINE_TYPE (UpBackend, up_backend, G_TYPE_OBJECT)
|
||||
|
||||
@@ -423,6 +423,11 @@ up_apm_device_refresh(UpDevice* device)
|
||||
UpDeviceKind type;
|
||||
@@ -324,8 +324,11 @@ up_backend_update_battery_state(UpDevice* device)
|
||||
if (a.ac_state == APM_AC_ON)
|
||||
new_state = UP_DEVICE_STATE_CHARGING;
|
||||
|
||||
- // zero out new_time_to empty if we're not discharging
|
||||
- new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING ? a.minutes_left : 0);
|
||||
+ // zero out new_time_to_empty if we're not discharging, if minutes_left has a negative value
|
||||
+ if (new_state == UP_DEVICE_STATE_DISCHARGING && (int)a.minutes_left >= 0)
|
||||
+ new_time_to_empty = a.minutes_left;
|
||||
+ else
|
||||
+ new_time_to_empty = 0;
|
||||
|
||||
if (cur_state != new_state ||
|
||||
percentage != (gdouble) a.battery_life ||
|
||||
@@ -424,6 +427,11 @@ up_apm_device_refresh(UpDevice* device)
|
||||
GTimeVal timeval;
|
||||
gboolean ret;
|
||||
+
|
||||
|
||||
+ if (apm_fd == 0) {
|
||||
+ g_debug("refresh callback called but apm_fd is not initialized yet");
|
||||
+ return TRUE;
|
||||
+ }
|
||||
|
||||
+
|
||||
g_object_get (device, "type", &type, NULL);
|
||||
|
||||
switch (type) {
|
||||
@@ -544,6 +552,7 @@ static void
|
||||
up_backend_init (UpBackend *backend)
|
||||
{
|
||||
GError *err = NULL;
|
||||
+ GTimeVal timeval;
|
||||
UpDeviceClass *device_class;
|
||||
|
||||
backend->priv = UP_BACKEND_GET_PRIVATE (backend);
|
||||
@@ -573,6 +582,7 @@ up_backend_init (UpBackend *backend)
|
||||
}
|
||||
|
||||
/* setup dummy */
|
||||
+ g_get_current_time (&timeval);
|
||||
g_object_set (backend->priv->battery,
|
||||
"type", UP_DEVICE_KIND_BATTERY,
|
||||
"power-supply", TRUE,
|
||||
@@ -582,11 +592,13 @@ up_backend_init (UpBackend *backend)
|
||||
"state", UP_DEVICE_STATE_UNKNOWN,
|
||||
"percentage", 0.0f,
|
||||
"time-to-empty", (gint64) 0,
|
||||
+ "update-time", (guint64) timeval.tv_sec,
|
||||
(void*) NULL);
|
||||
g_object_set (backend->priv->ac,
|
||||
"type", UP_DEVICE_KIND_LINE_POWER,
|
||||
"online", TRUE,
|
||||
"power-supply", TRUE,
|
||||
+ "update-time", (guint64) timeval.tv_sec,
|
||||
(void*) NULL);
|
||||
} else {
|
||||
backend->priv->ac = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user