summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/i386/i386/apm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 86dde60358e..90f9753966a 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.55 2002/12/18 22:53:06 mickey Exp $ */
+/* $OpenBSD: apm.c,v 1.56 2002/12/22 17:12:44 mickey Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -146,6 +146,7 @@ u_char apm_majver;
u_char apm_minver;
int apm_dobusy = 1;
int apm_doidle = 1;
+int apm_bebatt = 0;
struct {
u_int32_t entry;
@@ -307,7 +308,7 @@ apm_power_print (sc, regs)
printf(", charging");
if (BATT_REM_VALID(regs)) {
int life = BATT_REMAINING(regs);
- if (apm_flags & APM_BEBATT)
+ if (apm_bebatt)
life = swap16(life);
printf(", estimated %d:%02d hours",
life / 60, life % 60);
@@ -801,6 +802,8 @@ apmattach(parent, self, aux)
extern int apm_cli; /* from apmcall.S */
apm_cli = 0;
}
+ if (sc->sc_dev.dv_cfdata->cf_flags & APM_BEBATT)
+ apm_bebatt = 1;
apm_ep.seg = GSEL(GAPM32CODE_SEL,SEL_KPL);
apm_ep.entry = ap->apm_entry;
cbase = min(ap->apm_code32_base, ap->apm_code16_base);
@@ -1086,7 +1089,7 @@ apmioctl(dev, cmd, data, flag, p)
powerp->battery_state = APM_BATT_UNKNOWN;
if (BATT_REM_VALID(&regs)) {
powerp->minutes_left = BATT_REMAINING(&regs);
- if (apm_flags & APM_BEBATT)
+ if (apm_bebatt)
powerp->minutes_left =
swap16(powerp->minutes_left);
}