temp/upower: add patch for supporting usb chargers (MR 1986)

This patch is in purism's fork and it removes messages like this when
starting upower on the librem5 by properly detecting/setting the type:

    TI:15:11:12     did not recognise USB path /sys/devices/platform/soc@0/30800000.bus/30a20000.i2c/i2c-0/0-003f/power_supply/tps6598x-source-psy-0-003f, please report
    ...
    TI:15:11:12     did not recognise USB path /sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-006a/power_supply/bq25890-charger, please report
This commit is contained in:
Clayton Craft 2021-02-24 15:49:42 -08:00 committed by Alexey Min
parent acde488d3c
commit 81e374c3c6
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448
2 changed files with 35 additions and 2 deletions

View file

@ -0,0 +1,31 @@
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

@ -4,7 +4,7 @@ pkgname=upower
pkgver=9999
_pkgver=0.99.11
_distver="UPOWER_${_pkgver//./_}"
pkgrel=0
pkgrel=1
pkgdesc="Power Management Services"
url="https://upower.freedesktop.org"
arch="aarch64 armv7"
@ -16,6 +16,7 @@ checkdepends="py3-dbus py3-gobject3"
options="!check" # need unpackaged umockdev
source="https://gitlab.freedesktop.org/upower/upower/-/archive/$_distver/upower-$_distver.tar.bz2
0001-Add-torch-support.patch
0002-Detect-USB-Type-C-port-controller-and-other-chargers.patch
"
builddir="$srcdir/$pkgname-$_distver"
@ -54,4 +55,5 @@ package() {
}
sha512sums="918fdba13df7ba85fd276daae68228554e71df95011b48dc42b006a059cf2996f906ce08e98f6d1da07c8f2a4235bc9622992fa42eaaf05a08f1a3650f4ae4b6 upower-UPOWER_0_99_11.tar.bz2
c6c8a557f8ca650e6e2b8b1f64f70744dc610f86f71d88602014b6c241c96821b5662f48ab63da6a2da9e52017b8d9f7a87655f8f640e87b5d17417577079b0b 0001-Add-torch-support.patch"
c6c8a557f8ca650e6e2b8b1f64f70744dc610f86f71d88602014b6c241c96821b5662f48ab63da6a2da9e52017b8d9f7a87655f8f640e87b5d17417577079b0b 0001-Add-torch-support.patch
0673d32e8c3d313e21437e7d431068b4a0c51a4d63acf414fc93430c461ab5acbcc2ae8740d6614ed9487fadb8ae2c685e02fb7ad3623b71a20ccb90c1a0bd28 0002-Detect-USB-Type-C-port-controller-and-other-chargers.patch"