diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-07-08 12:43:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-07-08 12:43:49 +0000 |
commit | 961f7db5837e64f4bfffce9bf5f6225d221fee71 (patch) | |
tree | d571268eefc6a3e2976c9c6b2a3d8d536fedc5f2 /sys/arch/sparc | |
parent | 453d6c5e6086ba8133b626629f836ddb273c9620 (diff) |
Do not report the battery status as critical but absent, when the battery
is missing.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/dev/tctrl.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/arch/sparc/dev/tctrl.c b/sys/arch/sparc/dev/tctrl.c index d8a9a2fff72..c9f69372c8e 100644 --- a/sys/arch/sparc/dev/tctrl.c +++ b/sys/arch/sparc/dev/tctrl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tctrl.c,v 1.11 2005/04/11 01:49:50 miod Exp $ */ +/* $OpenBSD: tctrl.c,v 1.12 2005/07/08 12:43:48 miod Exp $ */ /* $NetBSD: tctrl.c,v 1.2 1999/08/11 00:46:06 matt Exp $ */ /*- @@ -1045,18 +1045,20 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) tctrl_request(sc, &req); c = req.rspbuf[0]; - if (c == TS102_CHARGE_UNKNOWN) - c = 0; - power->battery_life = c; - power->minutes_left = (u_int)-1; /* unknown */ - if (power->battery_state != APM_BATT_CHARGING) { - if (c < 0x20) - power->battery_state = APM_BATT_CRITICAL; - else if (c < 0x40) - power->battery_state = APM_BATT_HIGH; - else if (c < 0x66) - power->battery_state = APM_BATT_HIGH; + if (c >= TS102_CHARGE_UNKNOWN) + power->battery_life = 0; + else { + power->battery_life = c; + if (power->battery_state != APM_BATT_CHARGING) { + if (c < 0x20) + power->battery_state = APM_BATT_CRITICAL; + else if (c < 0x40) + power->battery_state = APM_BATT_HIGH; + else if (c < 0x66) + power->battery_state = APM_BATT_HIGH; + } } + power->minutes_left = (u_int)-1; /* unknown */ #if 0 tctrl_read_ext_status(sc); |