xfce4 battery plugin gives wrong infomation with linux kernel 2.6.24
Brian J. Tarricone
bjt23 at cornell.edu
Wed Feb 20 08:38:25 CET 2008
Yves-Alexis Perez wrote:
> Yesterday, some people complained in #xfce that battery plugin wasn't
> working (using sysfs patch). He had no /sys/class/power_supply/AC but
> had a /sys/class/power_supply/ACAD. This confused the battery plugin
> (but not the 28% thingy) so I thought it could be a good idea to check
> for ACAD too, but looking on google it seems that it's not really
> frequent (at all). Can people with laptop check
> their /sys/class/power_supply and report if they have AC or ACAD (with
> the output of uname -a)?
No, this is the wrong way to do this. The plugin should open *every*
directory in /sys/class/power_supply, and read the properties files to
determine which of the devices is an AC adapter -- I believe one of the
property files will have a device-type string that can be used to
identify whether it's an AC adapter, battery, etc. I'm running MacOS
atm, so I can't check what this should be, but it should be fairly easy
to figure out for anyone with a laptop.
You can't depend on the device-name-specific directory names to stay the
same across kernel versions or different hardware. In this case
'/sys/class/power_supply/' is a stable interface, and (at least some
subset of) the files in /sys/class/power_supply/*/* are stable, but
'/sys/class/power_supply/foo' is not. At least, that's how I understand it.
Alternatively, the battery plugin should just use HAL, and then it can
work on the BSDs as well without OS-specific code.
-brian
More information about the Xfce
mailing list