From: Horms <horms-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
To: Marco Innocenti
<dot0037-p0aYb1w59bp+nBQpE4LXFjUZDU+1vuVT@public.gmane.org>
Cc: 298766-61a8vm9lEZVf4u+23C9RwQ@public.gmane.org,
Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: gnome-applets: battstat don't show correct values at startup on some hardware
Date: Thu, 10 Nov 2005 11:12:07 +0900 [thread overview]
Message-ID: <20051110021207.GA14216@verge.net.au> (raw)
In-Reply-To: <20050309202119.GA8086-z9AggUaaQxwjA1nC/a+z+WLCm2T5Ec0j@public.gmane.org>
On Wed, Mar 09, 2005 at 09:21:19PM +0100, Marco Innocenti wrote:
> Battstat on my laptop (Toshiba P20-311) don't show the correct value
> of the charge of the battery at startup. I have to wait several
> minutes to get it. I've made some test and discoveded that "cat
> /proc/acpi/battery/BAT1/*" give the wrong value the first few time.
> So I patched battstat_applet.c to get acpiinfo 10 times at startup.
> It works for me and don't think would harm others.
[snip]
Hi Marco,
As discussed breifly on http://bugs.debian.org/298766, this is probably
a problem better solved in the kernel than in user-space. I have CCed
the ACPI maintainers on this message for their consideration, including
your patch, which is below.
--
Horms
diff -r -u gnome-applets-2.8.2.orig/battstat/battstat_applet.c gnome-applets-2.8.2/battstat/battstat_applet.c
--- gnome-applets-2.8.2.orig/battstat/battstat_applet.c 2005-03-09 20:58:00.302510520 +0100
+++ gnome-applets-2.8.2/battstat/battstat_applet.c 2005-03-09 17:24:47.000000000 +0100
@@ -232,7 +232,7 @@
#ifdef __linux__
struct acpi_info acpiinfo;
-gboolean using_acpi;
+gboolean using_acpi, started_now=TRUE;
int acpi_count;
#endif
@@ -310,6 +310,14 @@
* Updated by David Moore <dcm-HInyCGIudOg@public.gmane.org> 5/29/2003 to poll less and
* use ACPI events. */
if (using_acpi && acpiinfo.event_fd >= 0) {
+ /* By Marco Innocenti <m.innocenti-qooieK91W7JeoWH0uzbU5w@public.gmane.org> 09/03/2005
+ * Some hardware need several requests to warm up and give correct results. */
+ if (started_now) {
+ started_now=FALSE;
+ for (acpi_count=1; acpi_count < 10; acpi_count++) {
+ acpi_linux_read(&apminfo, &acpiinfo);
+ }
+ }
if (acpi_count <= 0) {
/* Only call this one out of 30 calls to apm_readinfo() (every 30 seconds)
* since reading the ACPI system takes CPU cycles. */
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
parent reply other threads:[~2005-11-10 2:12 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20050309202119.GA8086-z9AggUaaQxwjA1nC/a+z+WLCm2T5Ec0j@public.gmane.org>]
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=20051110021207.GA14216@verge.net.au \
--to=horms-8fiuurrzop0dnm+yrofe0a@public.gmane.org \
--cc=298766-61a8vm9lEZVf4u+23C9RwQ@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=dot0037-p0aYb1w59bp+nBQpE4LXFjUZDU+1vuVT@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