summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2018-04-19 02:57:48 +0200
committerBastien Nocera <hadess@hadess.net>2018-04-19 03:11:29 +0200
commit33e9039eb058401ad7815a83eaf144459b1ecc32 (patch)
treeb37cde2115bf29e06989244665501030b0635986
parent0840bb266e9aa577f354a3820bbca88e5f168f79 (diff)
downloadupower-33e9039eb058401ad7815a83eaf144459b1ecc32.tar.gz
linux: Add support for "Unknown" capacity level
Rather than leaving the percentage untouched, set the battery level at 50.0 as a "middle-ground". This percentage is supposed to be ignored if a BatteryLevel is set so this is better than showing "0%" which makes it look like a bug. https://bugs.freedesktop.org/show_bug.cgi?id=97484
-rw-r--r--src/linux/up-device-supply.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 11a14e1..f6b4b55 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -493,7 +493,8 @@ sysfs_get_capacity_level (const char *native_path,
{ "High", 70.0, UP_DEVICE_LEVEL_HIGH },
{ "Low", 10.0, UP_DEVICE_LEVEL_LOW },
{ "Critical", 5.0, UP_DEVICE_LEVEL_CRITICAL },
- { "Full", 100.0, UP_DEVICE_LEVEL_FULL }
+ { "Full", 100.0, UP_DEVICE_LEVEL_FULL },
+ { "Unknown", 50.0, UP_DEVICE_LEVEL_UNKNOWN }
};
guint len;