Hi Gerald, Le Tuesday 05 May 2015 à 16:20 +0200, Gerald Pfeifer a écrit :
I have a hunc "this is a feature, not a bug" ;-), but with the update to kernel 4.0, /proc/acpi/battery/BAT* is gone.
Is there a way (config option we could enable) to get this back?
It was removed on purpose by: commit 9eb6ba436281fa55e9eb5442d69d09a388b47706 Author: Jeff Mahoney <jeffm@suse.com> Date: Mon Mar 23 11:02:52 2015 -0400 config: disable CONFIG_ACPI_PROCFS_POWER (i386/x86_64) (boo#917728) CONFIG_ACPI_PROCFS_POWER is deprecated and should be disabled. Of course, re-enabling it would temporarily solve your problem, but we really want to get rid of it in the long run, so the best option is to update your custom script to use the "new" sysfs interface instead. You should be able to find under /sys/class/power_supply/BAT* almost everything you used to see in /proc/acpi/battery/BAT*.
If not, how can I best re-implement something like the little script below (which works for more than one battery in case you are wondering about the complexity):
#!/bin/bash
sum() { s=0; while read l; do i=`echo $l | cut -d' ' -f1` printf "%5s " "$i" s=$(($s+$i)) done printf " = %s\n" "$s" }
for v in "design capacity" "last full capacity" "remaining capacity" "rate"; do printf "%18s = " "$v" cat /proc/acpi/battery/BAT*/* | grep "$v:" | cut -d: -f2 | sum done
The following should work except for the "rate" which isn't mentioned in the sysfs interface. I seem to understand that this isn't considered a property of the battery so you have to derive it yourself from the the other numbers over an arbitrary period. #!/bin/bash sum() { s=0; while read l; do i=`echo $l | cut -d' ' -f1` i=$(($i/1000)) printf "%5s " "$i" s=$(($s+$i)) done printf " = %s\n" "$s" } for v in "energy_full_design" "energy_full" "energy_now"; do printf "%18s = " "$v" cat /sys/class/power_supply/BAT*/$v | sum done Hope that helps, -- Jean Delvare SUSE L3 Support -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org