From 49459b6b725a0c9980bc60f05eceb215ac010bd8 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Tue, 5 Jun 2018 00:19:59 +0300 Subject: [PATCH] Battery: fix the battery status when some battery devices are not valid It happens that some devices are considered as batteries, even if they cannot be charged or used as a power supply for the laptop. The ELAN device deals with the touchpad and is a "battery". When looking at the udev info, it appears that there is no technology present as well as the basic battery info (energy levels). P: /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-ELAN24CC:00/0018:04F3:24CC.0003/power_supply/hid-0018:04F3:24CC.0003-battery E: DEVPATH=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-ELAN24CC:00/0018:04F3:24CC.0003/power_supply/hid-0018:04F3:24CC.0003-battery E: POWER_SUPPLY_CAPACITY=1 E: POWER_SUPPLY_MODEL_NAME=ELAN24CC:00 04F3:24CC E: POWER_SUPPLY_NAME=hid-0018:04F3:24CC.0003-battery E: POWER_SUPPLY_ONLINE=1 E: POWER_SUPPLY_PRESENT=1 E: POWER_SUPPLY_SCOPE=Device E: POWER_SUPPLY_STATUS=Discharging E: SUBSYSTEM=power_supply The issue with that kind of devices is that it confuses the battery gadget. Since two batteries are present, the total capacity is divided by 2, resulting in the gadget displaying only 50% when the battery is fully charged. To avoid this, we check that the battery technology is known. @fix --- src/modules/battery/e_mod_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index 24af2d8bc..691889cda 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c @@ -299,7 +299,7 @@ _battery_device_update(void) EINA_LIST_FOREACH(device_batteries, l, bat) { - if (!bat->got_prop) + if ((!bat->got_prop) || (!bat->technology)) continue; have_battery = 1; batnum++;