diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-14 22:18:34 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-14 22:18:34 +0000 |
commit | 74aec4583cac467a5572c0f47320add345ffb21e (patch) | |
tree | 1f2bed82dccf9fecb80be3f0bb091301458cffc0 /usr.sbin/apmd | |
parent | 1988785ad23b0f3388c4bd36215e8a2ea7b4e047 (diff) |
On macppc, when the battery is charging, the life time estimatation is in fact
the recharge time estimation.
So there is no need to annoy the user if this value is <= 10 minute, since
no surprise powerdown is about to happen.
ok drahn@ mickey@
Diffstat (limited to 'usr.sbin/apmd')
-rw-r--r-- | usr.sbin/apmd/apmd.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c index bdcaf6411a1..bf23a2c7f4e 100644 --- a/usr.sbin/apmd/apmd.c +++ b/usr.sbin/apmd/apmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apmd.c,v 1.18 2001/11/14 20:11:22 deraadt Exp $ */ +/* $OpenBSD: apmd.c,v 1.19 2001/11/14 22:18:33 miod Exp $ */ /* * Copyright (c) 1995, 1996 John T. Kohl @@ -114,7 +114,19 @@ power_status(int fd, int force, struct apm_power_info *pinfo) bstate.battery_state != last.battery_state || (bstate.minutes_left && bstate.minutes_left < 15) || abs(bstate.battery_life - last.battery_life) > 20) { +#ifdef __powerpc__ + /* + * When the battery is charging, the estimated life + * time is in fact the estimated remaining charge time + * on Apple machines, so lie in the stats. + * We still want an useful message if the battery or + * ac status changes, however. + */ + if (bstate.minutes_left != 0 && + bstate.battery_state != APM_BATT_CHARGING) +#else if (bstate.minutes_left) +#endif syslog(LOG_NOTICE, "battery status: %s. " "external power status: %s. " "estimated battery life %d%% (%u minutes)", |