linuxmint/cinnamon-spices-applets

batterypower@joka42: Power Consumption Display shows "Status unknown" on Lenovo ThinkPad T470s

DrMacinyasha opened this issue · 2 comments

Applet version/Build date

2024-07-04 19:20:18

Cinnamon version

6.2.9

Distribution

Linux Mint 22 Cinnamon

Graphics hardware and driver used

Intel Skylake GT2 [HD Graphics 520] vendor: Lenovo driver: i915 v: kernel

Applet name and maintainer

batterypower@joka42 @joka42

What happened?

Upon installing the applet and enabling, instead of showing the current charging rate or discharging rate when I unplug my laptop, the applet displays a yellow lightning bolt icon. Hovering the mouse over it shows the "Status unknown..." message.

Screenshot included in additional info.

Other information

Bit of a guess, but my suspicion is that the cause of this behavior is that this laptop model (Lenovo ThinkPad T470s, type 20JTS2BE00) features two separate batteries that are recognized as such both by Windows 11 and Linux Mint 22. Skimming through the code for the applet, and pardon my limited familiarity, it doesn't appear that the applet is designed to be able to process the presence of two BAT# folders from /sys/class/power_supply/ and combine the data collected.

Here's the info from the power_supply folder (screenshot included):

[2024-10-09 11:46:58 MDT] user@Callisto:/sys/class/power_supply$ ll
total 0
lrwxrwxrwx 1 root root 0 2024-10-09 11:03 AC -> ../../devices/pci0000:00/0000:00:1f.0/PNP0C09:00/ACPI0003:00/power_supply/AC/
lrwxrwxrwx 1 root root 0 2024-10-09 11:03 BAT0 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/
lrwxrwxrwx 1 root root 0 2024-10-09 11:03 BAT1 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/PNP0C0A:01/power_supply/BAT1/
lrwxrwxrwx 1 root root 0 2024-10-09 16:16 ucsi-source-psy-USBC000:001 -> ../../devices/platform/USBC000:00/power_supply/ucsi-source-psy-USBC000:001/
[2024-10-09 11:47:07 MDT] user@Callisto:/sys/class/power_supply$ cat */type
Mains
Battery
Battery
USB
[2024-10-09 11:47:10 MDT] user@Callisto:/sys/class/power_supply$ cat BAT*/uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Not charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=97
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12489000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=23540000
POWER_SUPPLY_ENERGY_FULL=19640000
POWER_SUPPLY_ENERGY_NOW=18930000
POWER_SUPPLY_CAPACITY=96
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=00HW023
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 2097

POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=115
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11460000
POWER_SUPPLY_VOLTAGE_NOW=12537000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=26060000
POWER_SUPPLY_ENERGY_FULL=20040000
POWER_SUPPLY_ENERGY_NOW=20040000
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CAPACITY_LEVEL=Full
POWER_SUPPLY_MODEL_NAME=01AV406
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 2849
[2024-10-09 11:47:18 MDT] user@Callisto:/sys/class/power_supply$ 

power_supply

The contents of each directory:

[2024-10-09 12:00:59 MDT] user@Callisto:/sys/class/power_supply$ ll BAT*/
BAT0/:
total 0
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 alarm
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 capacity
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 capacity_level
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_behaviour
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_control_end_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_control_start_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_start_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_stop_threshold
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 cycle_count
lrwxrwxrwx 1 root root    0 2024-10-09 16:16 device -> ../../../PNP0C0A:00/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_full
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_full_design
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_now
drwxr-xr-x 3 root root    0 2024-10-09 11:26 hwmon2/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 manufacturer
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 model_name
drwxr-xr-x 2 root root    0 2024-10-09 11:26 power/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 power_now
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 present
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 serial_number
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 status
lrwxrwxrwx 1 root root    0 2024-10-09 11:03 subsystem -> ../../../../../../../../../class/power_supply/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 technology
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 type
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 uevent
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 voltage_min_design
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 voltage_now

BAT1/:
total 0
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 alarm
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 capacity
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 capacity_level
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_behaviour
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_control_end_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_control_start_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_start_threshold
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 charge_stop_threshold
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 cycle_count
lrwxrwxrwx 1 root root    0 2024-10-09 16:16 device -> ../../../PNP0C0A:01/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_full
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_full_design
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 energy_now
drwxr-xr-x 3 root root    0 2024-10-09 11:26 hwmon3/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 manufacturer
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 model_name
drwxr-xr-x 2 root root    0 2024-10-09 11:26 power/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 power_now
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 present
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 serial_number
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 status
lrwxrwxrwx 1 root root    0 2024-10-09 11:03 subsystem -> ../../../../../../../../../class/power_supply/
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 technology
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 type
-rw-r--r-- 1 root root 4.0K 2024-10-09 11:26 uevent
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 voltage_min_design
-r--r--r-- 1 root root 4.0K 2024-10-09 11:26 voltage_now
[2024-10-09 12:01:03 MDT] user@Callisto:/sys/class/power_supply$ 

@DrMacinyasha yes, you are right. this case is not handled, yet. I will take a look.

@DrMacinyasha #6536 here is the pull request. I'd appreciate it, if you could check if everything works with the applied changes. If you need help on how to test it, let me know - I can guide you.