Battery status files created on the fly?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi folks,

I've run into a weird problem with monitoring the status of my laptop battery.
Since I assume I'm doing something wrong, I thought I'd ask for feedback here
first before going and filing a bug report.  Here goes:

When my machine boots, /sys/class/power_supply/BAT0 and all the files in it do
not exist:

$ ls /sys/class/power_supply
AC

Since my battery monitor uses this as the source of information, it obviously
fails.

Now, as soon as I query the state of the battery through
/proc/acpi/battery/BAT0, the missing files under /sys/class/power_supply get
created:

$ cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            1265 mA
remaining capacity:      4234 mAh
present voltage:         11340 mV

$ ls /sys/class/power_supply
AC  BAT0

This is not just a timeout issue.  If I don't query
/proc/acpi/battery/BAT0/state, /sys/class/power_supply/BAT0 does not get
created even after a few hours of uptime.

Also, after suspending, the files remain present but cannot be read.  Querying
the battery through the /proc interface once again brings everything back to
normal.

Now what's funny about this is that I read online that the /proc/acpi/battery
interface is deprecated and that the /sys/... interface should be used instead.
Yet, without querying the former, the latter doesn't even exist.

Did anybody run into similar issues?  Does anybody have any ideas how to fix
this "the proper way"?  (My workaround right now is to include "cat
/proc/acpi/battery/BAT0/state > /dev/null" in rc.local, but that's obviously a
hack.)

Thanks for any pointers you may give.

Cheers,
Norbert

PS: Machine is Dell Latitude E6510 running 64-bit ARCH.


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux