aboutsummaryrefslogtreecommitdiff
path: root/src/device-provider-upower.c
diff options
context:
space:
mode:
authorMarius Gripsgard <mariogrip@ubuntu.com>2018-03-25 22:15:43 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-25 22:20:50 +0200
commitcf33215b5030fc9d6708edbfd27332910d3322c8 (patch)
tree83ca1231384ad46f834a00b17d8cc2183618d4c7 /src/device-provider-upower.c
parentcf7ae8a8754c75f93692c79ebecfdd674b52ec69 (diff)
downloadayatana-indicator-power-cf33215b5030fc9d6708edbfd27332910d3322c8.tar.gz
ayatana-indicator-power-cf33215b5030fc9d6708edbfd27332910d3322c8.tar.bz2
ayatana-indicator-power-cf33215b5030fc9d6708edbfd27332910d3322c8.zip
Ignore batt_therm devices.
Ported from UBports power indicator: commit 431114ed4f6d457822655ad57901e7e640f99bca Author: Marius Gripsgard <mariogrip@ubuntu.com> Date: Sun Aug 13 00:08:05 2017 +0200 Ignore "batt_therm" devices (fixes: https://github.com/ubports/ubports-touch/issues/94) This ignores "batt_therm" devices since they do not provide correct values. "batt_therm" is only used for temperature of the battery and seems to appear as a "battery" device in upower Ported-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'src/device-provider-upower.c')
-rw-r--r--src/device-provider-upower.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/device-provider-upower.c b/src/device-provider-upower.c
index bfee80f..f9b5e18 100644
--- a/src/device-provider-upower.c
+++ b/src/device-provider-upower.c
@@ -229,6 +229,9 @@ static void
refresh_device_soon (IndicatorPowerDeviceProviderUPower * self,
const char * object_path)
{
+ // Android: Ignore batt_therm devices since they give wrong values
+ if (g_str_has_suffix(object_path, "batt_therm"))
+ return;
priv_t * p = get_priv(self);
g_hash_table_add (p->queued_paths, g_strdup (object_path));
@@ -266,8 +269,11 @@ on_enumerate_devices_response(GObject * bus,
ao = g_variant_get_child_value(v, 0);
g_variant_iter_init(&iter, ao);
path = NULL;
- while(g_variant_iter_loop(&iter, "o", &path))
- refresh_device_soon (gself, path);
+ while(g_variant_iter_loop(&iter, "o", &path)) {
+ // Android: Ignore batt_therm devices since they give wrong values
+ if (!g_str_has_suffix(path, "batt_therm"))
+ refresh_device_soon (gself, path);
+ }
g_variant_unref(ao);
}
@@ -284,6 +290,9 @@ on_device_properties_changed(GDBusConnection * connection G_GNUC_UNUSED,
GVariant * parameters,
gpointer gself)
{
+ // Android: Ignore batt_therm devices since they give wrong values
+ if (g_str_has_suffix(object_path, "batt_therm"))
+ return;
IndicatorPowerDeviceProviderUPower* self;
priv_t* p;
IndicatorPowerDevice* device;