[Pkg-xfce-devel] Bug#466058: I fixed the sysfs patch

Daniel Gibson metalcaedes at gmail.com
Sun Apr 6 01:47:15 UTC 2008


I fixed the sysfs-patch, at least for my system (lenny i386 with
standard kernel on a samsung x20), but it should be so generic that it
works on any system.
There were several problems and I'll describe shortly my way to fix them:
- The AC adapter is not always listed in /sys/class/power_supply/AC/.
Now it checks in any directory in /sys/class/power_supply if the file
"type" exists and contains "Mains". I hope that AC adapters always
have the type "Mains", otherwise the other possibilities should also
be considered. Only one AC adapter (are there systems with more than
one?) is used.
- In 2.6.24 the charge status is in
/sys/class/power_supply/$battery/charge_full, charge_full_design and
charge_now. It seems like it was energy_* before. now both
possibilities are taken care of.
- The monitor showed random values for the remaining capacity -
probably because the struct that saves acpi status was not initialised
(because of charge_* vs energy_*) and only allocated with malloc.
using calloc should give more deterministic values.

I also changed some code that didn't make sense to me.
I noticed that after unplugging the power cord the monitor show the
new status quite quick, but it takes about 30 seconds until the
displayed time left makes sense. I don't know if this is normal or
connected to my patch.

- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use-sysfs-fixed.patch
Type: text/x-diff
Size: 8837 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-xfce-devel/attachments/20080406/8f690b7e/attachment-0001.patch 

More information about the Pkg-xfce-devel mailing list