From 20ab02eecb6786c6aafa78afd46161353ae876eb Mon Sep 17 00:00:00 2001 From: landry Date: Fri, 17 Jun 2011 15:08:36 +0000 Subject: [PATCH] Fix history in upower : - don't try to fetch from dev/apm if the fd isn't available yet (to be discussed with upstream) - use var/db/upower to store history files Fixes graphs in gnome-power-statistics... --- sysutils/upower/Makefile | 4 +-- .../patches/patch-src_openbsd_up-backend_c | 25 +++++++++++++++++++ .../upower/patches/patch-src_up-history_c | 13 ++++++++++ sysutils/upower/pkg/PLIST | 3 ++- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 sysutils/upower/patches/patch-src_openbsd_up-backend_c create mode 100644 sysutils/upower/patches/patch-src_up-history_c diff --git a/sysutils/upower/Makefile b/sysutils/upower/Makefile index 316f871bed1..5e7c9103915 100644 --- a/sysutils/upower/Makefile +++ b/sysutils/upower/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2011/06/02 17:09:32 kili Exp $ +# $OpenBSD: Makefile,v 1.7 2011/06/17 15:08:36 landry Exp $ ONLY_FOR_ARCHS =${APM_ARCHS} @@ -8,7 +8,7 @@ DISTNAME = upower-0.9.11 CATEGORIES = sysutils SHARED_LIBS += upower-glib 0.0 # 1.1 -REVISION = 0 +REVISION = 1 HOMEPAGE = http://upower.freedesktop.org/ MASTER_SITES = ${HOMEPAGE}/releases/ diff --git a/sysutils/upower/patches/patch-src_openbsd_up-backend_c b/sysutils/upower/patches/patch-src_openbsd_up-backend_c new file mode 100644 index 00000000000..20b83d1846f --- /dev/null +++ b/sysutils/upower/patches/patch-src_openbsd_up-backend_c @@ -0,0 +1,25 @@ +$OpenBSD: patch-src_openbsd_up-backend_c,v 1.1 2011/06/17 15:08:36 landry 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 +@@ -62,7 +62,7 @@ enum { + + static guint signals [SIGNAL_LAST] = { 0 }; + +-int apm_fd; /* ugly global.. needs to move to a device native object */ ++int apm_fd = 0; /* ugly global.. needs to move to a device native object */ + + G_DEFINE_TYPE (UpBackend, up_backend, G_TYPE_OBJECT) + +@@ -423,6 +423,11 @@ up_apm_device_refresh(UpDevice* device) + UpDeviceKind type; + 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); + diff --git a/sysutils/upower/patches/patch-src_up-history_c b/sysutils/upower/patches/patch-src_up-history_c new file mode 100644 index 00000000000..d90654781b9 --- /dev/null +++ b/sysutils/upower/patches/patch-src_up-history_c @@ -0,0 +1,13 @@ +$OpenBSD: patch-src_up-history_c,v 1.1 2011/06/17 15:08:36 landry Exp $ +Set var/db/upower as dir for history files +--- src/up-history.c.orig Mon Jun 13 16:28:21 2011 ++++ src/up-history.c Mon Jun 13 16:28:29 2011 +@@ -888,7 +888,7 @@ up_history_init (UpHistory *history) + history->priv->data_time_empty = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); + history->priv->save_id = 0; + history->priv->max_data_age = UP_HISTORY_DEFAULT_MAX_DATA_AGE; +- history->priv->dir = g_build_filename (PACKAGE_LOCALSTATE_DIR, "lib", "upower", NULL); ++ history->priv->dir = g_build_filename ("/var", "db", "upower", NULL); + } + + /** diff --git a/sysutils/upower/pkg/PLIST b/sysutils/upower/pkg/PLIST index 6591528ab6c..d6f5085ba32 100644 --- a/sysutils/upower/pkg/PLIST +++ b/sysutils/upower/pkg/PLIST @@ -1,4 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.2 2011/05/24 16:02:39 ajacoutot Exp $ +@comment $OpenBSD: PLIST,v 1.3 2011/06/17 15:08:36 landry Exp $ %%SHARED%% @bin bin/upower include/libupower-glib/ @@ -33,6 +33,7 @@ share/dbus-1/system-services/ share/dbus-1/system-services/org.freedesktop.UPower.service share/doc/pkg-readmes/${FULLPKGNAME} share/examples/upower/ +@sample /var/db/upower/ share/examples/upower/UPower/ @sample ${SYSCONFDIR}/UPower/ share/examples/upower/UPower/UPower.conf