commit:     052c810f21548e913e83f9e6d335ec5047a0eba0
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 16 10:03:58 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Jul 16 11:23:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=052c810f

sys-power/upower: 0.99.12 version bump

- EAPI-8 bump
- Raise app-pda/libplist minimum version to >=2
- Drop virtual/libusb dependency
- Add notice about dropped support for old devices

Reported-by: Joakim Tjernlund <joakim.tjernlund <AT> infinera.com>
Closes: https://bugs.gentoo.org/796896
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 sys-power/upower/Manifest                          |   1 +
 ....99.12-fix-power_now-energy_rate-readings.patch |  43 +++++++++
 sys-power/upower/upower-0.99.12.ebuild             | 102 +++++++++++++++++++++
 3 files changed, 146 insertions(+)

diff --git a/sys-power/upower/Manifest b/sys-power/upower/Manifest
index 1a8569d7b78..5c19d802df7 100644
--- a/sys-power/upower/Manifest
+++ b/sys-power/upower/Manifest
@@ -1,2 +1,3 @@
 DIST upower-0.99.11.tar.xz 430128 BLAKE2B 
77604d02a69de98e4c7b268d11d189aa42ace2d62b982fda9bc41131ce383ede32953ada31eae0bbfd1121600af5863924d48c636e60a28f505a6998dcac227c
 SHA512 
67219a0beb98c97ac4512e4fe8ba83fc80a1035d1edb5367dda6911da50c672b047051f2f528e8703be29ab47547d92b6c71a7ef695226a1bdb5bc33e6d18803
+DIST upower-0.99.12.tar.xz 423640 BLAKE2B 
4c5c6357f0a2f8d721ebae9736912b1871a898c7ce65708626f9a9465cde87036ba6ab8050d97f5b9074d92e2700d8ed1e71b67f43cd6305eb4e89336f1b628f
 SHA512 
9858a0e5f65271522cc5f36b0cd8722a5fb3effba37dbc5b22f08606701d4242ee54329d07460768004a24dc42705a84140ac6d9691afb7f09584b2e61fe3413
 DIST upower-0.99.9.tar.xz 448408 BLAKE2B 
5fa2436f33c94cffb736d8e3fad433acf58954cf06ccd403a0361214be5afc45d79ea279f3c5c48dcd58b92ccaf995777c95987d1749fd8c8c8958317e439570
 SHA512 
45eb587b0e5ffcce88bad8c56bc5efa30559748913016a55d58313280f5159378e5fbb4a9842c3a6409257bb97822d235f96b03704268b8471455c93eb05fe2f

diff --git 
a/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch
 
b/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch
new file mode 100644
index 00000000000..c3dd864a6b1
--- /dev/null
+++ 
b/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch
@@ -0,0 +1,43 @@
+From 2949136b152e94aa3b57da5130bcb9022724debe Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.za...@pengutronix.de>
+Date: Thu, 17 Jun 2021 18:14:53 +0200
+Subject: [PATCH] linux: Fix < 0.01 W energy-rate readings from power_now sysfs
+ property
+
+Currently, if a power supplies' power_now sysfs file reports discharge
+rates < 0.01 W, the code will try to calculate the discharge rate from
+the legacy sysfs files. On new kernels where those don't exist, this
+produces wrong results.
+
+For example, on a dual-battery Thinkpad T450s, while the external
+battery is discharging, the internal battery reports power_now = 0,
+but the corresponding upower energy-rate field incorrectly reads
+about 2.3 W.
+
+This patch fixes the issue by falling back to the legacy code only if
+the legacy current_now sysfs file exists.
+
+Closes: #7, #44
+---
+ src/linux/up-device-supply.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
+index 3ebbd88..4236ce4 100644
+--- a/src/linux/up-device-supply.c
++++ b/src/linux/up-device-supply.c
+@@ -682,8 +682,9 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
+       state = up_device_supply_get_state (native);
+ 
+       /* this is the new value in uW */
+-      energy_rate = fabs (g_udev_device_get_sysfs_attr_as_double_uncached 
(native, "power_now") / 1000000.0);
+-      if (energy_rate < 0.01) {
++      if (g_udev_device_has_sysfs_attr (native, "power_now")) {
++              energy_rate = fabs 
(g_udev_device_get_sysfs_attr_as_double_uncached (native, "power_now") / 
1000000.0);
++      } else {
+               gdouble charge_full;
+ 
+               /* convert charge to energy */
+-- 
+GitLab
+

diff --git a/sys-power/upower/upower-0.99.12.ebuild 
b/sys-power/upower/upower-0.99.12.ebuild
new file mode 100644
index 00000000000..7701fb98f1c
--- /dev/null
+++ b/sys-power/upower/upower-0.99.12.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd xdg-utils
+
+DESCRIPTION="D-Bus abstraction for enumerating power devices, querying history 
and statistics"
+HOMEPAGE="https://upower.freedesktop.org/";
+COMMIT="244f5966c58773bbd3b4c507c549560f"
+SRC_URI="https://gitlab.freedesktop.org/upower/upower/uploads/${COMMIT}/${P}.tar.xz";
+# No tarball released at the usual location
+#SRC_URI="https://${PN}.freedesktop.org/releases/${P}.tar.xz";
+
+LICENSE="GPL-2"
+SLOT="0/3" # based on SONAME of libupower-glib.so
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+
+# gtk-doc files are not available as prebuilt in the tarball
+IUSE="doc +introspection ios kernel_FreeBSD kernel_linux selinux"
+
+DEPEND="
+       >=dev-libs/glib-2.38:2
+       sys-apps/dbus:=
+       introspection? ( dev-libs/gobject-introspection:= )
+       kernel_linux? (
+               dev-libs/libgudev:=
+               virtual/udev
+               ios? (
+                       >=app-pda/libimobiledevice-1:=
+                       >=app-pda/libplist-2:=
+               )
+       )
+"
+RDEPEND="${DEPEND}
+       selinux? ( sec-policy/selinux-devicekit )
+"
+BDEPEND="
+       app-text/docbook-xsl-stylesheets
+       dev-libs/libxslt
+       >=sys-devel/gettext-0.19.8
+       virtual/pkgconfig
+       doc? ( dev-util/gtk-doc )
+"
+
+QA_MULTILIB_PATHS="usr/lib/${PN}/.*"
+
+DOCS=( AUTHORS HACKING NEWS README )
+
+PATCHES=( "${FILESDIR}/${P}-fix-power_now-energy_rate-readings.patch" ) # bug 
796896
+
+src_prepare() {
+       default
+       xdg_environment_reset
+       sed -i -e '/DISABLE_DEPRECATED/d' configure || die
+}
+
+src_configure() {
+       local backend
+
+       if use kernel_linux ; then
+               backend=linux
+       elif use kernel_FreeBSD ; then
+               backend=freebsd
+       else
+               backend=dummy
+       fi
+
+       local myeconfargs=(
+               --disable-tests
+               --enable-man-pages
+               --libexecdir="${EPREFIX}"/usr/lib/${PN}
+               --localstatedir="${EPREFIX}"/var
+               --with-backend=${backend}
+               --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+               --with-systemdutildir="$(systemd_get_utildir)"
+               $(use_enable doc gtk-doc)
+               $(use_enable introspection)
+               $(use_with ios idevice)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+       find "${ED}" -type f -name '*.la' -delete || die
+       keepdir /var/lib/upower #383091
+}
+
+pkg_postinst() {
+       if [[ ${REPLACING_VERSIONS} ]] && ver_test ${REPLACING_VERSIONS} -lt 
0.99.12; then
+               elog "Support for Logitech Unifying Receiver battery state 
readout was"
+               elog "removed in version 0.99.12, these devices have been 
directly"
+               elog "supported by the Linux kernel since version >=3.2."
+               elog
+               elog "Support for CSR devices battery state was removed from 
udev rules"
+               elog "in version 0.99.12. This concerns the following Logitech 
products"
+               elog "from the mid 2000s:"
+               elog "Mouse/Dual/Keyboard+Mouse Receiver, Freedom Optical, 
Elite Duo,"
+               elog "MX700/MX1000, Optical TrackMan, Click! Mouse, Presenter."
+       fi
+}

Reply via email to