public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Warn user when battery goes critical
@ 2004-04-05 21:10 Pavel Machek
       [not found] ` <20040405211032.GA3575-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2004-04-05 21:10 UTC (permalink / raw)
  To: len.brown-ral2JQCrhuEAvxtiuMwx3w, ACPI mailing list

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-13 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-05 21:10 Warn user when battery goes critical Pavel Machek
     [not found] ` <20040405211032.GA3575-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-04-06  1:21   ` Karl Hegbloom
2004-04-08 17:15   ` Stefan Seyfried
     [not found]     ` <20040408171527.GH23710-l0tNAEGuAhhzZ8+rp42Dbp9+tswZ0GTaehPwdyo5hKaELgA04lAiVw@public.gmane.org>
2004-04-12 20:45       ` Sérgio Monteiro Basto
     [not found]         ` <1081802715.3428.40.camel-4/PLUo9XfK8@public.gmane.org>
2004-04-13 20:02           ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox