On Mon 27. Feb - 23:36:23, Danny Kukawka wrote:
> Hi,
>
> this patch fix the user binary and the powerlib to support battery
> information
> on APM machines. Currently powersave only provide information about ACPI
> batteries. I think this is a bug related to the switch to HAL.
>
> Please review the patch. There are maybe sidekicks.
>
> One problem I already found is that HAL poll on APM battery and AC every 2
> seconds - which results in the most cases in a remaining_time property change
> with each poll. This can produce more events than are useful. Through this
> events KPowersave maybe run to often rechecks on APM machines.
>
> Btw. the bug is in HAL, I take a look at this - HAL should only poll AC every
> 2 seconds and the battery maybe only ever 30-60 secs.
>
> Cheers,
>
> Danny
>
> libpower/battery.c | 14 ++++++++------
> user_binary/powersave.cpp | 13 +++++++++++--
> 2 files changed, 19 insertions(+), 8 deletions(-)
> Index: user_binary/powersave.cpp
> ===================================================================
> --- user_binary/powersave.cpp (Revision 1951)
> +++ user_binary/powersave.cpp (Arbeitskopie)
> @@ -377,15 +377,24 @@
> fprintf(stdout, ", %d minutes remaining",
> bg.remaining_minutes);
> }
>
> + if (bg.charging_state & CHARG_STATE_CHARGING) {
> + fprintf(stdout, " charging");
> + }
> + if (bg.charging_state & CHARG_STATE_DISCHARGING) {
> + fprintf(stdout, " discharging");
> + }
> +
> fprintf(stdout, "\n");
> }
>
> if (ac_state == AC_ONLINE)
> fprintf(stdout, "AC is online.\n");
> + else
> + fprintf(stdout, "AC is offline.\n");
> }
> // Test of detailed battery information
> if (ext) {
> - if (checkACPI() == ACPI) {
> + if (checkACPI() == ACPI || checkACPI() == APM) {
>
> for (x = 0; x < numBatteries(); x++) {
>
> int ret = getBatteryInfo(x, &bg);
> @@ -415,7 +424,7 @@
> }
> }
> } else
> - fprintf(stdout, "No acpi system\n");
> + fprintf(stdout, "No acpi or apm system\n");
> }
> return 1;
> }
ACK.
> Index: libpower/battery.c
> ===================================================================
> --- libpower/battery.c (Revision 1951)
> +++ libpower/battery.c (Arbeitskopie)
> @@ -282,7 +287,7 @@
> return -3;
> }
>
> - if (checkACPI() != ACPI) {
> + if (checkACPI() != ACPI && checkACPI() != APM) {
> return NO_ACPI_ERROR;
> }
>
> @@ -290,11 +295,13 @@
> return -2;
> }
>
> - /* check whether module has been loaded and device is available */
> - int res = check_ACPI_dir(ACPI_BATTERY_DIR);
> - if (res < 0)
> - /* returns either NO_DEVICE_ERROR or NO_MODULE_ERROR */
> - return res;
> + if (checkACPI == ACPI) {
> + /* check whether module has been loaded and device is available
> */
> + int res = check_ACPI_dir(ACPI_BATTERY_DIR);
> + if (res < 0)
> + /* returns either NO_DEVICE_ERROR or NO_MODULE_ERROR */
> + return res;
> + }
>
> char **batteries;
> int numBatteries;
ACK.
Will apply both patches. Thanks!
Regards,
Holger
_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel