greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.87k stars 472 forks source link

Battery reading incorrect? #1906

Closed masroof-maindak closed 1 year ago

masroof-maindak commented 1 year ago

2023-05-21-215611_2560x1600_scrot

MaxVerevkin commented 1 year ago

The percentage is read from /sys/class/power_supply/<bat name>/capacity. Does it match with acpi? If it doesn't, which value is the most accurate?

masroof-maindak commented 1 year ago

The percentage is read from /sys/class/power_supply/<bat name>/capacity. Does it match with acpi? If it doesn't, which value is the most accurate?

The output of acpi -b does not match with that in the provided path, no. I3status' value is accurate according to the path it's supposed to be checking but I have no idea which value to refer to as the end user.

Edit: Even though the path's value is 83, and acpi's is 99, my charger's light is green, implying that my laptop is full. I therefore have reason to believe that acpi's output is correct and something's wrong with /sys/class/power_supply/<bat name>/capacity but I have no idea how that's even possible.

masroof-maindak commented 1 year ago

Quite frankly, I'm at a loss for words. If it matters, I'm using a 2014 Macbook Pro on EndeavourOS so it MIGHT be a faulty battery issue?

2023-05-22-002932_2560x1600_scrot

MaxVerevkin commented 1 year ago

Apparently this was reported in #1410, but wasn't really resolved. This can be easily solved with a simple option to ignore capacity and force-calculate the percentage from charge_now/charge_full or energy_now/energy_full (it might make sense to make it the default, after all acpi and upower do that). In the mean time you can use the upower driver, which seems to account for that.

masroof-maindak commented 1 year ago

Apparently this was reported in #1410, but wasn't really resolved. This can be easily solved with a simple option to ignore capacity and force-calculate the percentage from charge_now/charge_full or energy_now/energy_full (it might make sense to make it the default, after all acpi and upower do that). In the mean time you can use the upower driver, which seems to account for that.

Well that certainly makes sense. Thanks for the explanation. Just not quite sure what you meant by the 'upower driver' though. I have it installed already but I'm not sure how to 'link' it with i3status-rs if that's what you were insinuating.

MaxVerevkin commented 1 year ago

I mean you can make the battery block use upower instead of sysfs:

[[block]]
block = "battery"
driver = "upower"
masroof-maindak commented 1 year ago

This is exactly what I was wondering, thanks a ton.

MaxVerevkin commented 1 year ago

Fixed in 8f7e76c