From: Olaf Hering <olh@suse.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Andrew Morton <akpm@osdl.org>
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH] AC Power handling broken for desktops
Date: Mon, 10 Oct 2005 19:08:57 +0200 [thread overview]
Message-ID: <20051010170857.GB9928@suse.de> (raw)
In-Reply-To: <1127090662.4502.12.camel@gaston>
Currently, AC Power is 0 on a desktop G4.
No batteries present should mean AC Power == 1.
Signed-off-by: Olaf Hering <olh@suse.de>
drivers/macintosh/apm_emu.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6.13-rc7-ac-power/drivers/macintosh/apm_emu.c
===================================================================
--- linux-2.6.13-rc7-ac-power.orig/drivers/macintosh/apm_emu.c
+++ linux-2.6.13-rc7-ac-power/drivers/macintosh/apm_emu.c
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, c
-1: Unknown
8) min = minutes; sec = seconds */
- unsigned short ac_line_status = 0xff;
- unsigned short battery_status = 0xff;
+ unsigned short ac_line_status;
+ unsigned short battery_status = 0;
unsigned short battery_flag = 0xff;
int percentage = -1;
int time_units = -1;
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, c
ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);
for (i=0; i<pmu_battery_count; i++) {
if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {
+ battery_status++;
if (percentage < 0)
percentage = 0;
if (charge < 0)
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, c
charging++;
}
}
+ if (0 == battery_status)
+ ac_line_status = 1;
+ battery_status = 0xff;
if (real_count) {
if (amperage < 0) {
if (btype == PMU_BATT_TYPE_SMART)
--
short story of a lazy sysadmin:
alias appserv=wotan
next prev parent reply other threads:[~2005-10-10 17:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-24 11:54 AC Power handling broken for desktops Olaf Hering
2005-08-24 22:32 ` Benjamin Herrenschmidt
2005-08-25 4:51 ` Olaf Hering
2005-08-25 5:08 ` Benjamin Herrenschmidt
2005-08-25 5:15 ` Olaf Hering
2005-08-25 5:34 ` Benjamin Herrenschmidt
2005-08-26 11:38 ` Olaf Hering
2005-09-19 0:44 ` Benjamin Herrenschmidt
2005-10-10 17:08 ` Olaf Hering [this message]
2005-08-25 15:10 ` Segher Boessenkool
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=20051010170857.GB9928@suse.de \
--to=olh@suse.de \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.