Hi,
i noticed, that wile discharging the battery, i get a battery event
about every minute, but the battery is polled anyway:
time event
00:00 polling battery, 100%
00:30 ACPI battery event: 99%
01:00 polling battery, 99% "battery should not be polled that often"
01:30 ACPI battery event: 98%
02:00 polling battery, 98% "battery should not be polled that often"
..
you get it. We should not poll, if we had an event before or better: on
every battery polling, we should reset the timeout, regardless if we
polled because of a timeout or because of an event.
This (compile-tested, not runtime) patch could fix this:
Index: daemon/acpi.cpp
===================================================================
RCS file: /cvsroot/powersave/powersave/daemon/acpi.cpp,v
retrieving revision 1.40
diff -u -p -r1.40 acpi.cpp
--- daemon/acpi.cpp 25 Aug 2005 13:07:30 -0000 1.40
+++ daemon/acpi.cpp 26 Aug 2005 11:01:00 -0000
@@ -218,6 +218,7 @@ int ACPI_Interface::handleHWEventRequest
checkACStateChanges();
checkBatteryStateChanges();
+ PM_Interface::msecs_last_battery_read = 0;
// WTF is this good for? -> This is to avoid polling of
battery
// set /proc/acpi/battery/*/alarm and wait for events in
/proc/acpi/event
Index: daemon/powersaved.h
===================================================================
RCS file: /cvsroot/powersave/powersave/daemon/powersaved.h,v
retrieving revision 1.41
diff -u -p -r1.41 powersaved.h
--- daemon/powersaved.h 21 Aug 2005 19:41:08 -0000 1.41
+++ daemon/powersaved.h 26 Aug 2005 11:01:00 -0000
@@ -117,7 +117,7 @@ class PM_Interface{
unsigned long msecs_cpu_idle;
// sum up time battery/temperature was not polled
- unsigned msecs_last_battery_read;
+// unsigned msecs_last_battery_read;
unsigned msecs_last_temperature_read;
/* this is to remember pid of daemon for children
@@ -149,6 +149,7 @@ class PM_Interface{
DBUS_ERROR handleActionMessage( DBusMessage *msg );
protected:
+ unsigned msecs_last_battery_read;
int cooling_mode_supported;
int throttling_supported;
int thermal_trip_points_supported;
I am not sure about the protected/private header stuff, and if it is
enough or if i'd better create an "void touch_battery()"-Function in
class PM_Interface which resets the polling timestamp instead of messing
around with the timestamp directly.
Please comment, this is not very important, but annoying for me ;-)
--
Stefan Seyfried \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, Nürnberg \ -- Leonard Cohen
_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel