Skip to content

[BUG] battery magic var does not detect battery without capacity #1243

@classabbyamp

Description

@classabbyamp

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

On the Lenovo X13s, the battery does not provide a capacity file in /sys/class/power_supply. According to the kernel docs, this is valid when the firmware does not provide the information and shouldn't be calculated by the kernel.

Can eww calculate this value when not available from the kernel?

Reproducing the issue

  1. Have a computer with a battery that does not provide capacity
  2. read EWW_BATTERY

Expected behaviour

EWW_BATTERY contains a value for the battery

Additional context

$ ls -l /sys/class/power_supply/qcom-battmgr-bat/     
total 0
-r--r--r-- 1 root root 4096 Dec 10 17:26 charge_empty
-r--r--r-- 1 root root 4096 Dec 10 17:26 charge_full
-r--r--r-- 1 root root 4096 Dec 10 17:26 charge_full_design
-r--r--r-- 1 root root 4096 Dec 10 17:26 charge_now
-r--r--r-- 1 root root 4096 Dec 10 17:26 cycle_count
lrwxrwxrwx 1 root root    0 Dec 10 17:26 device -> ../../../pmic_glink.power-supply.0
-r--r--r-- 1 root root 4096 Dec 10 17:26 energy_empty
-r--r--r-- 1 root root 4096 Dec 10 17:26 energy_full
-r--r--r-- 1 root root 4096 Dec 10 17:26 energy_full_design
-r--r--r-- 1 root root 4096 Dec 10 17:26 energy_now
drwxr-xr-x 3 root root    0 Dec 10 17:26 hwmon0
-r--r--r-- 1 root root 4096 Dec 10 17:26 manufacture_day
-r--r--r-- 1 root root 4096 Dec 10 17:26 manufacture_month
-r--r--r-- 1 root root 4096 Dec 10 17:26 manufacture_year
-r--r--r-- 1 root root 4096 Dec 10 17:26 manufacturer
-r--r--r-- 1 root root 4096 Dec 10 17:26 model_name
lrwxrwxrwx 1 root root    0 Dec 10 17:26 of_node -> ../../../../../../firmware/devicetree/base/pmic-glink
drwxr-xr-x 2 root root    0 Dec 10 17:26 power
-r--r--r-- 1 root root 4096 Dec 10 17:26 power_now
-r--r--r-- 1 root root 4096 Dec 10 17:26 present
-r--r--r-- 1 root root 4096 Dec 10 17:26 serial_number
-r--r--r-- 1 root root 4096 Dec 10 17:26 status
lrwxrwxrwx 1 root root    0 Dec 10 17:26 subsystem -> ../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Dec 10 17:26 technology
-r--r--r-- 1 root root 4096 Dec 10 17:26 temp
-r--r--r-- 1 root root 4096 Dec 10 17:26 type
-rw-r--r-- 1 root root 4096 Dec 10 17:26 uevent
-r--r--r-- 1 root root 4096 Dec 10 17:26 voltage_max_design
-r--r--r-- 1 root root 4096 Dec 10 17:26 voltage_now
drwxr-xr-x 2 root root    0 Dec 10 17:26 wakeup2

Platform and environment

Void Linux, eww 0.6.0, X11

Linux 6.12.1_1 #1 SMP PREEMPT_DYNAMIC Sun Nov 24 23:14:58 UTC 2024 aarch64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions