temp/upower: drop (MR 2608)

* The first patch has been droped from PureOS, which currently
  ships stock debian 0.99.11. Therefore the fix must have been
  applied somewhere else, same as it happened with the torch patches.
* The second patch is already merged upstream and present in latest
 0.99.13 release in alpine.
This commit is contained in:
Pablo Correa Gómez 2021-10-15 20:34:25 +02:00 committed by Dylan Van Assche
parent 82fba2bdb2
commit f19dec52d8
No known key found for this signature in database
GPG Key ID: 8642571587897EA1
3 changed files with 0 additions and 252 deletions

View File

@ -1,31 +0,0 @@
From b07b1c6f400741df02d92fd2a8a3021f5799d587 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Wed, 24 Feb 2021 23:44:15 +0000
Subject: [PATCH] Detect USB Type C port controller and other chargers
Based on squashing these two Purism patches:
https://source.puri.sm/Librem5/upower/-/commit/95186bfcb306d04b4383412421942f374217f459.patch
https://source.puri.sm/Librem5/upower/-/commit/29b711f4c1db8b380605696b6e37b843a7571084.patch
---
src/linux/up-device-supply.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index d7e4423..3326c96 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -1066,6 +1066,10 @@ up_device_supply_guess_type (GUdevDevice *native,
/* use a heuristic to find the device type */
if (g_strstr_len (native_path, -1, "wacom_") != NULL) {
type = UP_DEVICE_KIND_TABLET;
+ } else if (g_strstr_len (native_path, -1, "-source-psy-") != NULL) {
+ type = UP_DEVICE_KIND_LINE_POWER;
+ } else if (g_strstr_len (native_path, -1, "-charger") != NULL) {
+ type = UP_DEVICE_KIND_BATTERY;
} else {
g_warning ("did not recognise USB path %s, please report",
native_path);
--
2.30.1

View File

@ -1,160 +0,0 @@
From ae19116af161ba6f053ebe7950b6d9ea46ce2d74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= <ablocorrea@hotmail.com>
Date: Thu, 17 Jun 2021 01:01:32 +0200
Subject: [PATCH] daemon: Sync icon and warning for non-default low level
Before, the low level for changing the battery icon was hardcoded.
However, as the `low_percentage` property is settable by the user using
`PercentageLow` option. That can lead to inconsistencies when PercentageLow
is not the default. For example, if PercentageLow is set higher than 10,
the Low Battery level warning will be sent at the user-set level, but the
battery icon would not be updated to "caution" until the percentage
drops below 10%.
This issue is solved in this commit by using the `low_percentage` property
for the comparison instead of hardcoding the default.
---
src/up-daemon.c | 34 ++++++++++++++++++++++++++++++++++
src/up-daemon.h | 4 ++++
src/up-device.c | 47 ++++++++++-------------------------------------
3 files changed, 48 insertions(+), 37 deletions(-)
diff --git a/src/up-daemon.c b/src/up-daemon.c
index ef2cd6b..70b75dd 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -704,6 +704,40 @@ up_daemon_update_warning_level (UpDaemon *daemon)
up_daemon_set_warning_level (daemon, warning_level);
}
+const gchar *
+up_daemon_get_charge_icon (UpDaemon *daemon,
+ gdouble percentage,
+ UpDeviceLevel battery_level,
+ gboolean charging)
+{
+ if (battery_level == UP_DEVICE_LEVEL_NONE && daemon != NULL) {
+ if (percentage <= daemon->priv->low_percentage)
+ return charging ? "battery-caution-charging-symbolic" : "battery-caution-symbolic";
+ else if (percentage < 30)
+ return charging ? "battery-low-charging-symbolic" : "battery-low-symbolic";
+ else if (percentage < 60)
+ return charging ? "battery-good-charging-symbolic" : "battery-good-symbolic";
+ return charging ? "battery-full-charging-symbolic" : "battery-full-symbolic";
+ } else {
+ switch (battery_level) {
+ case UP_DEVICE_LEVEL_UNKNOWN:
+ /* The lack of symmetry is on purpose */
+ return charging ? "battery-good-charging-symbolic" : "battery-caution-symbolic";
+ case UP_DEVICE_LEVEL_LOW:
+ case UP_DEVICE_LEVEL_CRITICAL:
+ return charging ? "battery-caution-charging-symbolic" : "battery-caution-symbolic";
+ case UP_DEVICE_LEVEL_NORMAL:
+ return charging ? "battery-low-charging-symbolic" : "battery-low-symbolic";
+ case UP_DEVICE_LEVEL_HIGH:
+ return charging ? "battery-good-charging-symbolic" : "battery-good-symbolic";
+ case UP_DEVICE_LEVEL_FULL:
+ return charging ? "battery-full-charging-symbolic" : "battery-full-symbolic";
+ default:
+ g_assert_not_reached ();
+ }
+ }
+}
+
/**
* up_daemon_device_changed_cb:
**/
diff --git a/src/up-daemon.h b/src/up-daemon.h
index 7160e0e..76e7937 100644
--- a/src/up-daemon.h
+++ b/src/up-daemon.h
@@ -82,6 +82,10 @@ UpDeviceLevel up_daemon_compute_warning_level(UpDaemon *daemon,
gboolean power_supply,
gdouble percentage,
gint64 time_to_empty);
+const gchar *up_daemon_get_charge_icon (UpDaemon *daemon,
+ gdouble percentage,
+ UpDeviceLevel battery_level,
+ gboolean charging);
void up_daemon_start_poll (GObject *object,
GSourceFunc callback);
diff --git a/src/up-device.c b/src/up-device.c
index 37ec129..0a56810 100644
--- a/src/up-device.c
+++ b/src/up-device.c
@@ -89,39 +89,6 @@ update_warning_level (UpDevice *device)
up_exported_device_set_warning_level (skeleton, warning_level);
}
-static const gchar *
-get_device_charge_icon (gdouble percentage,
- UpDeviceLevel battery_level,
- gboolean charging)
-{
- if (battery_level == UP_DEVICE_LEVEL_NONE) {
- if (percentage < 10)
- return charging ? "battery-caution-charging-symbolic" : "battery-caution-symbolic";
- else if (percentage < 30)
- return charging ? "battery-low-charging-symbolic" : "battery-low-symbolic";
- else if (percentage < 60)
- return charging ? "battery-good-charging-symbolic" : "battery-good-symbolic";
- return charging ? "battery-full-charging-symbolic" : "battery-full-symbolic";
- } else {
- switch (battery_level) {
- case UP_DEVICE_LEVEL_UNKNOWN:
- /* The lack of symmetry is on purpose */
- return charging ? "battery-good-charging-symbolic" : "battery-caution-symbolic";
- case UP_DEVICE_LEVEL_LOW:
- case UP_DEVICE_LEVEL_CRITICAL:
- return charging ? "battery-caution-charging-symbolic" : "battery-caution-symbolic";
- case UP_DEVICE_LEVEL_NORMAL:
- return charging ? "battery-low-charging-symbolic" : "battery-low-symbolic";
- case UP_DEVICE_LEVEL_HIGH:
- return charging ? "battery-good-charging-symbolic" : "battery-good-symbolic";
- case UP_DEVICE_LEVEL_FULL:
- return charging ? "battery-full-charging-symbolic" : "battery-full-symbolic";
- default:
- g_assert_not_reached ();
- }
- }
-}
-
/* This needs to be called when one of those properties changes:
* type
* state
@@ -134,6 +101,10 @@ update_icon_name (UpDevice *device)
const gchar *icon_name = NULL;
UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device);
+ /* Not finished setting up the object? */
+ if (device->priv->daemon == NULL)
+ return;
+
/* get the icon from some simple rules */
if (up_exported_device_get_type_ (skeleton) == UP_DEVICE_KIND_LINE_POWER) {
icon_name = "ac-adapter-symbolic";
@@ -152,14 +123,16 @@ update_icon_name (UpDevice *device)
break;
case UP_DEVICE_STATE_CHARGING:
case UP_DEVICE_STATE_PENDING_CHARGE:
- icon_name = get_device_charge_icon (up_exported_device_get_percentage (skeleton),
- up_exported_device_get_battery_level (skeleton),
+ icon_name = up_daemon_get_charge_icon (device->priv->daemon,
+ up_exported_device_get_percentage (skeleton),
+ up_exported_device_get_battery_level (skeleton),
TRUE);
break;
case UP_DEVICE_STATE_DISCHARGING:
case UP_DEVICE_STATE_PENDING_DISCHARGE:
- icon_name = get_device_charge_icon (up_exported_device_get_percentage (skeleton),
- up_exported_device_get_battery_level (skeleton),
+ icon_name = up_daemon_get_charge_icon (device->priv->daemon,
+ up_exported_device_get_percentage (skeleton),
+ up_exported_device_get_battery_level (skeleton),
FALSE);
break;
default:
--
2.17.1

View File

@ -1,61 +0,0 @@
# Forked from Alpine to apply Purism's torch patch
pkgname=upower
pkgver=9999
_pkgver=0.99.11
_distver="UPOWER_${_pkgver//./_}"
pkgrel=4
pkgdesc="Power Management Services"
url="https://upower.freedesktop.org"
arch="aarch64 armv7"
license="GPL-2.0-or-later"
subpackages="$pkgname-dev $pkgname-lang"
makedepends="linux-headers gtk+-dev libgudev-dev libusb-dev polkit-elogind-dev gtk-doc
dbus-glib-dev libxslt gobject-introspection-dev docbook-xsl autoconf automake"
checkdepends="py3-dbus py3-gobject3"
options="!check" # need unpackaged umockdev
source="https://gitlab.freedesktop.org/upower/upower/-/archive/$_distver/upower-$_distver.tar.bz2
0001-Detect-USB-Type-C-port-controller-and-other-chargers.patch
0002-daemon-Sync-icon-and-warning-for-non-default-low-level.patch
"
builddir="$srcdir/$pkgname-$_distver"
prepare() {
default_prepare
NOCONFIGURE=1 ./autogen.sh
}
build() {
# pmOS workarounds for qemu hanging:
# --disable-dependency-tracking
# --disable-man-pages
# --disable-tests
# -j1
DATADIRNAME=share ./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/lib/upower \
--disable-static \
--with-udevrulesdir=/lib/udev/rules.d \
--disable-dependency-tracking \
--disable-man-pages \
--disable-tests
make -j1
}
check() {
make check
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
918fdba13df7ba85fd276daae68228554e71df95011b48dc42b006a059cf2996f906ce08e98f6d1da07c8f2a4235bc9622992fa42eaaf05a08f1a3650f4ae4b6 upower-UPOWER_0_99_11.tar.bz2
0673d32e8c3d313e21437e7d431068b4a0c51a4d63acf414fc93430c461ab5acbcc2ae8740d6614ed9487fadb8ae2c685e02fb7ad3623b71a20ccb90c1a0bd28 0001-Detect-USB-Type-C-port-controller-and-other-chargers.patch
77d8ab65118a3e776522665cdb66b7653eb0f9c6db2c82ddac0bf7ef0b25a262a054f38ccc403da3321209081b09ddfdc053fcf432b2e43a14e965aa60ae5c12 0002-daemon-Sync-icon-and-warning-for-non-default-low-level.patch
"