public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	ACPI mailing list
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Warn user when battery goes critical
Date: Mon, 5 Apr 2004 23:10:32 +0200	[thread overview]
Message-ID: <20040405211032.GA3575@elf.ucw.cz> (raw)

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

             reply	other threads:[~2004-04-05 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-05 21:10 Pavel Machek [this message]
     [not found] ` <20040405211032.GA3575-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-04-06  1:21   ` Warn user when battery goes critical 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040405211032.GA3575@elf.ucw.cz \
    --to=pavel-+zi9xunit7i@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox