diff options
author | 2010-11-02 18:49:08 +0530 | |
---|---|---|
committer | 2010-11-02 20:45:41 +0530 | |
commit | 0dcd2963d602b554d815f1c80e9a47514f89d660 (patch) | |
tree | 75a816ae4b14055f7ce8bf882b84ac6789e7a612 | |
parent | Add app-text/tesseract (diff) | |
download | nirbheek-0dcd2963d602b554d815f1c80e9a47514f89d660.tar.gz nirbheek-0dcd2963d602b554d815f1c80e9a47514f89d660.tar.bz2 nirbheek-0dcd2963d602b554d815f1c80e9a47514f89d660.zip |
sys-power/upower: fix bad battery state when fully-charged
* Some Dell laptop batteries set their state as "Discharging" when they finish
charging
* Use the power supply status and the battery level to guess the correct state
* Upstream bug: https://bugs.freedesktop.org/show_bug.cgi?id=31196
-rw-r--r-- | sys-power/upower/Manifest | 6 | ||||
-rw-r--r-- | sys-power/upower/files/upower-0.9.6-introspection-2.patch | 168 | ||||
-rw-r--r-- | sys-power/upower/files/upower-0.9.6-introspection.patch | 30 | ||||
-rw-r--r-- | sys-power/upower/files/upower-dell-samsung-sdi-battery-quirk.patch | 76 | ||||
-rw-r--r-- | sys-power/upower/metadata.xml | 11 | ||||
-rw-r--r-- | sys-power/upower/upower-0.9.6.ebuild | 91 |
6 files changed, 382 insertions, 0 deletions
diff --git a/sys-power/upower/Manifest b/sys-power/upower/Manifest new file mode 100644 index 0000000..30d3404 --- /dev/null +++ b/sys-power/upower/Manifest @@ -0,0 +1,6 @@ +AUX upower-0.9.6-introspection-2.patch 4913 RMD160 8c564657c46ed8fb462ac897662b2f0dff085662 SHA1 4ecce4e42b977bd06d44dc81357019afbcab7359 SHA256 1bbb8272c3eb7fd377857a60804a97fa8f93c1b41ed474eaece4b30118197937 +AUX upower-0.9.6-introspection.patch 1211 RMD160 1c5f68cd72181e7e98b43e847add7054d7372dd2 SHA1 9fbf83d4a6226e9c5eb9059ac4b907043e70c344 SHA256 4325436699554dae5cc5c3ac4768d40a44f4a708f2f4d3e90ee896c341f72dad +AUX upower-dell-samsung-sdi-battery-quirk.patch 2371 RMD160 4f4da397e14a350c2faebca2ad0d70e2d00a9b0a SHA1 070792f533b210eec19e918609e48a970ef91153 SHA256 7e9b6e8a579aaef21715ffe45348d1c63229ed392275b4ce001f86ed3d0d0a50 +DIST upower-0.9.6.tar.bz2 453993 RMD160 f1bf3a2138d41bc7c138fb2df2b99980f64ae000 SHA1 4e21c948ac7eda57f9f0ab1fde734315517fe9ac SHA256 aeff4a0c98a12b8beb56ca92314e1e8a6711f13929a294ae3c0a725125a1db4f +EBUILD upower-0.9.6.ebuild 2382 RMD160 596fd6cb22ce27564351bc5461500fae3d7c4e31 SHA1 596282a1d7d5fc97a600420269194d32c74dd259 SHA256 3186e5b43bdeaa0a3152ad40939075419e0eca90ccafe8a6568dc9179f880ef8 +MISC metadata.xml 363 RMD160 7210445bae10f2ddf76edaa8e7144227a03c5de1 SHA1 76f5af45c1a11584d24878ee65e6773757cfa014 SHA256 b24b22d2e371b3ee7165cd9ae1ca6fac72aee10e107c192a4e94686ba95b9093 diff --git a/sys-power/upower/files/upower-0.9.6-introspection-2.patch b/sys-power/upower/files/upower-0.9.6-introspection-2.patch new file mode 100644 index 0000000..7bdf577 --- /dev/null +++ b/sys-power/upower/files/upower-0.9.6-introspection-2.patch @@ -0,0 +1,168 @@ +From 58f3d9fbdff88173276f05e0d6da2cf864758381 Mon Sep 17 00:00:00 2001 +From: Richard Hughes <richard@hughsie.com> +Date: Tue, 05 Oct 2010 10:13:09 +0000 +Subject: Fix up all the warnings when building with new versions of gobject-introspection + +--- +diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c +index 13d5bf7..01ceeb8 100644 +--- a/libupower-glib/up-client.c ++++ b/libupower-glib/up-client.c +@@ -120,7 +120,7 @@ up_client_get_device (UpClient *client, const gchar *object_path) + * You must have called up_client_enumerate_devices_sync() before calling this + * function. + * +- * Return value: an array of #UpDevice objects, free with g_ptr_array_unref() ++ * Return value: (transfer full): an array of #UpDevice objects, free with g_ptr_array_unref() + * + * Since: 0.9.0 + **/ +diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c +index 41097b2..999f25b 100644 +--- a/libupower-glib/up-device.c ++++ b/libupower-glib/up-device.c +@@ -568,7 +568,7 @@ out: + * + * Gets the device history. + * +- * Return value: an array of #UpHistoryItem's, else #NULL and @error is used ++ * Return value: (transfer full): an array of #UpHistoryItem's, else #NULL and @error is used + * + * Since: 0.9.0 + **/ +@@ -653,7 +653,7 @@ out: + * + * Gets the device current statistics. + * +- * Return value: an array of #UpStatsItem's, else #NULL and @error is used ++ * Return value: (transfer full): an array of #UpStatsItem's, else #NULL and @error is used + * + * Since: 0.9.0 + **/ +diff --git a/libupower-glib/up-wakeup-item.c b/libupower-glib/up-wakeup-item.c +index 776473b..7060a3d 100644 +--- a/libupower-glib/up-wakeup-item.c ++++ b/libupower-glib/up-wakeup-item.c +@@ -66,7 +66,7 @@ G_DEFINE_TYPE (UpWakeupItem, up_wakeup_item, G_TYPE_OBJECT) + + /** + * up_wakeup_item_get_is_userspace: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets if the item is userspace. + * +@@ -83,7 +83,7 @@ up_wakeup_item_get_is_userspace (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_is_userspace: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @is_userspace: the new value + * + * Sets if the item is userspace. +@@ -100,7 +100,7 @@ up_wakeup_item_set_is_userspace (UpWakeupItem *wakeup_item, gboolean is_userspac + + /** + * up_wakeup_item_get_id: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets the item id. + * +@@ -117,7 +117,7 @@ up_wakeup_item_get_id (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_id: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @id: the new value + * + * Sets the item id. +@@ -134,7 +134,7 @@ up_wakeup_item_set_id (UpWakeupItem *wakeup_item, guint id) + + /** + * up_wakeup_item_get_old: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets the item old. + * +@@ -151,7 +151,7 @@ up_wakeup_item_get_old (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_old: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @old: the new value + * + * Sets the item old. +@@ -168,7 +168,7 @@ up_wakeup_item_set_old (UpWakeupItem *wakeup_item, guint old) + + /** + * up_wakeup_item_get_value: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets the item value. + * +@@ -185,7 +185,7 @@ up_wakeup_item_get_value (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_value: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @value: the new value + * + * Sets the item value. +@@ -202,7 +202,7 @@ up_wakeup_item_set_value (UpWakeupItem *wakeup_item, gdouble value) + + /** + * up_wakeup_item_get_cmdline: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets the item cmdline. + * +@@ -219,7 +219,7 @@ up_wakeup_item_get_cmdline (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_cmdline: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @cmdline: the new value + * + * Sets the item cmdline. +@@ -237,7 +237,7 @@ up_wakeup_item_set_cmdline (UpWakeupItem *wakeup_item, const gchar *cmdline) + + /** + * up_wakeup_item_get_details: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * + * Gets the item details. + * +@@ -254,7 +254,7 @@ up_wakeup_item_get_details (UpWakeupItem *wakeup_item) + + /** + * up_wakeup_item_set_details: +- * @history_item: #UpWakeupItem ++ * @wakeup_item: #UpWakeupItem + * @details: the new value + * + * Sets the item details. +diff --git a/libupower-glib/up-wakeups.c b/libupower-glib/up-wakeups.c +index 1388eab..2843891 100644 +--- a/libupower-glib/up-wakeups.c ++++ b/libupower-glib/up-wakeups.c +@@ -95,7 +95,7 @@ up_wakeups_get_total_sync (UpWakeups *wakeups, GCancellable *cancellable, GError + * + * Gets the wakeups data from the daemon. + * +- * Return value: an array of %UpWakeupItem's ++ * Return value: (transfer full): an array of %UpWakeupItem's + * + * Since: 0.9.1 + **/ +-- +cgit v0.8.3-6-g21f6 diff --git a/sys-power/upower/files/upower-0.9.6-introspection.patch b/sys-power/upower/files/upower-0.9.6-introspection.patch new file mode 100644 index 0000000..53dbe03 --- /dev/null +++ b/sys-power/upower/files/upower-0.9.6-introspection.patch @@ -0,0 +1,30 @@ +From cfd3641501b23ae68beb9656489e8c3077c3dad5 Mon Sep 17 00:00:00 2001 +From: Edward Sheldrake <ejsheldrake@gmail.com> +Date: Tue, 05 Oct 2010 10:03:42 +0000 +Subject: Fix building with gobject-introspection 0.9.10 + +--- +diff --git a/libupower-glib/Makefile.am b/libupower-glib/Makefile.am +index 83322c4..652f2de 100644 +--- a/libupower-glib/Makefile.am ++++ b/libupower-glib/Makefile.am +@@ -60,14 +60,15 @@ EXTRA_DIST = \ + CLEANFILES = $(BUILT_SOURCES) + + if HAVE_INTROSPECTION +-introspection_sources = $(libupower_glib_la_SOURCES) ++introspection_sources = $(libupower_glib_include_HEADERS) $(libupower_glib_la_SOURCES) + + UPowerGlib-1.0.gir: libupower-glib.la + UPowerGlib_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 + UPowerGlib_1_0_gir_CFLAGS = $(INCLUDES) +-PackageKitGlib_1_0_gir_SCANNERFLAGS = --identifier-prefix=Up --warn-all --add-include-path=$(srcdir) ++UPowerGlib_1_0_gir_SCANNERFLAGS = --identifier-prefix=Up --symbol-prefix=up_ --warn-all --add-include-path=$(srcdir) + UPowerGlib_1_0_gir_LIBS = libupower-glib.la + UPowerGlib_1_0_gir_FILES = $(introspection_sources) ++UPowerGlib_1_0_gir_NAMESPACE = UPowerGlib + INTROSPECTION_GIRS += UPowerGlib-1.0.gir + + girdir = $(datadir)/gir-1.0 +-- +cgit v0.8.3-6-g21f6 diff --git a/sys-power/upower/files/upower-dell-samsung-sdi-battery-quirk.patch b/sys-power/upower/files/upower-dell-samsung-sdi-battery-quirk.patch new file mode 100644 index 0000000..9781dbf --- /dev/null +++ b/sys-power/upower/files/upower-dell-samsung-sdi-battery-quirk.patch @@ -0,0 +1,76 @@ +Once full, some Dell laptop batteries show battery state as "fully-charged" for +a second, and then set battery state as "Discharging". However, the "on-battery" +status is correct. Try to do some guesswork for this case. + +Was observed with the following battery: + +vendor: SAMSUNG SDI +model: DELL U600P04 +serial: 0000 +technology: lithium-ion + +--- +--- src/linux/up-device-supply.c ++++ src/linux/up-device-supply.c +@@ -405,6 +405,9 @@ + UpDeviceState old_state; + UpDeviceState state; + UpDevice *device = UP_DEVICE (supply); ++ UpDevice *device_tmp; ++ UpDeviceKind type; ++ GPtrArray *devices; + const gchar *native_path; + GUdevDevice *native; + gboolean is_present; +@@ -425,7 +428,9 @@ + const gchar *recall_url = NULL; + UpDaemon *daemon; + gboolean on_battery; ++ gboolean online; + guint battery_count; ++ guint i; + + native = G_UDEV_DEVICE (up_device_get_native (device)); + native_path = g_udev_device_get_sysfs_path (native); +@@ -610,6 +615,41 @@ + state = UP_DEVICE_STATE_FULLY_CHARGED; + } + ++ /* some batteries show themselves as 'discharging' once they're full */ ++ if (state == UP_DEVICE_STATE_DISCHARGING && percentage == 100.0f) { ++ state = UP_DEVICE_STATE_FULLY_CHARGED; ++ daemon = up_device_get_daemon (device); ++ /* get states of AC power supplies */ ++ devices = up_device_list_get_array (up_daemon_get_device_list(daemon)); ++ for (i=0; i<devices->len; i++) { ++ device_tmp = (UpDevice *) g_ptr_array_index (devices, i); ++ g_object_get (device_tmp, ++ "type", &type, ++ NULL); ++ if (type != UP_DEVICE_KIND_LINE_POWER) ++ continue; ++ ret = up_device_supply_get_online (device_tmp, &online); ++ if (!ret) ++ continue; ++ ++ /* print what we're trying */ ++ egg_debug ("guessing battery state using power supply status:%i", ++ online); ++ ++ /* If any of the power supplies is not online, ++ * assume it's discharging, and break */ ++ if (!online) { ++ state = UP_DEVICE_STATE_DISCHARGING; ++ break; ++ } ++ } ++ /* print what we did */ ++ egg_debug ("guessed battery state as '%s' using power supply status", ++ up_device_state_to_string (state)); ++ ++ g_ptr_array_unref (devices); ++ } ++ + /* the battery isn't charging or discharging, it's just + * sitting there half full doing nothing: try to guess a state */ + if (state == UP_DEVICE_STATE_UNKNOWN) { diff --git a/sys-power/upower/metadata.xml b/sys-power/upower/metadata.xml new file mode 100644 index 0000000..1d2462d --- /dev/null +++ b/sys-power/upower/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>freedesktop</herd> + <maintainer> + <email>freedesktop-bugs@gentoo.org</email> + </maintainer> + <use> + <flag name="introspection">Use <pkg>dev-libs/gobject-introspection</pkg> for introspection</flag> + </use> +</pkgmetadata> diff --git a/sys-power/upower/upower-0.9.6.ebuild b/sys-power/upower/upower-0.9.6.ebuild new file mode 100644 index 0000000..ff73350 --- /dev/null +++ b/sys-power/upower/upower-0.9.6.ebuild @@ -0,0 +1,91 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/upower/upower-0.9.6.ebuild,v 1.3 2010/10/18 09:46:48 ssuominen Exp $ + +EAPI=3 +inherit autotools eutils linux-info + +DESCRIPTION="D-Bus abstraction for enumerating power devices and querying history and statistics" +HOMEPAGE="http://upower.freedesktop.org/" +SRC_URI="http://upower.freedesktop.org/releases/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd" +IUSE="debug doc +introspection ipod kernel_FreeBSD kernel_linux" + +COMMON_DEPEND=">=dev-libs/dbus-glib-0.76 + >=dev-libs/glib-2.21.5:2 + >=sys-apps/dbus-1 + >=sys-auth/polkit-0.97 + introspection? ( dev-libs/gobject-introspection ) + kernel_linux? ( >=sys-fs/udev-151[extras] + virtual/libusb:1 + ipod? ( >=app-pda/libimobiledevice-0.9.7 ) ) + !sys-apps/devicekit-power" +RDEPEND="${COMMON_DEPEND} + kernel_linux? ( >=sys-power/pm-utils-1.4.1 )" +DEPEND="${COMMON_DEPEND} + dev-libs/libxslt + app-text/docbook-xsl-stylesheets + >=dev-util/intltool-0.40.0 + dev-util/pkgconfig + doc? ( dev-util/gtk-doc + app-text/docbook-xml-dtd:4.1.2 ) + introspection? ( dev-util/gtk-doc-am )" # eautoreconf + +RESTRICT="test" # error getting system bus + +pkg_setup() { + if use kernel_linux; then + if use amd64 || use x86; then + CONFIG_CHECK="~ACPI_SYSFS_POWER" + linux-info_pkg_setup + fi + fi +} + +src_prepare() { + # Battery weirdness + epatch "${FILESDIR}/${PN}-dell-samsung-sdi-battery-quirk.patch" + + if use introspection; then + sed -i -e '/DISABLE_DEPRECATED/d' configure.ac || die + epatch "${FILESDIR}"/${P}-introspection{,-2}.patch + eautoreconf + else + sed -i -e '/DISABLE_DEPRECATED/d' configure || die + fi +} + +src_configure() { + local backend + + if use kernel_linux; then + backend=linux + elif use kernel_FreeBSD; then + backend=freebsd + else + backend=dummy + fi + + econf \ + --localstatedir="${EPREFIX}/var" \ + $(use_enable introspection) \ + --disable-dependency-tracking \ + --disable-static \ + $(use_enable debug verbose-mode) \ + --enable-man-pages \ + $(use_enable doc gtk-doc) \ + --disable-tests \ + --with-html-dir="${EPREFIX}/usr/share/doc/${PF}/html" \ + --with-backend=${backend} \ + $(use_with ipod idevice) +} + +src_install() { + emake DESTDIR="${D}" install || die + dodoc AUTHORS HACKING NEWS README + + find "${ED}" -name '*.la' -exec rm -f '{}' + +} |