From 74aec4583cac467a5572c0f47320add345ffb21e Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Wed, 14 Nov 2001 22:18:34 +0000 Subject: 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@ --- usr.sbin/apmd/apmd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'usr.sbin/apmd') 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)", -- cgit v1.2.3