From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Warn user when battery goes critical Date: Mon, 5 Apr 2004 23:10:32 +0200 Sender: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Message-ID: <20040405211032.GA3575@elf.ucw.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline Errors-To: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, ACPI mailing list List-Id: linux-acpi@vger.kernel.org Hi! When battery is going critical, perhaps user should know? It already helped me when power was turned off at expansion cord... Pavel Index: linux/drivers/acpi/battery.c =================================================================== --- linux.orig/drivers/acpi/battery.c 2004-04-05 22:47:33.000000000 +0200 +++ linux/drivers/acpi/battery.c 2004-02-20 12:39:11.000000000 +0100 @@ -332,6 +332,13 @@ battery->flags.present = device->status.battery_present; + { + struct acpi_battery_status *bst = NULL; + int res = acpi_battery_get_status(battery, &bst); + + if (!res && (bst->state & 0x04)) + printk(KERN_CRIT "Battery status: critical\n"); + } return_VALUE(result); } -- When do you have a heart between your knees? [Johanka's followup: and *two* hearts?] ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click