From 5ad1b8a577dbb183e12039bd0e66b6270697e21d Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Mon, 27 Jul 1998 23:16:37 +0000 Subject: Fix BATT_REMAINING macro so it returns values in minutes (as documented) not seconds --- sys/arch/i386/include/apmvar.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/include/apmvar.h b/sys/arch/i386/include/apmvar.h index bdbd44d12ff..f3829363870 100644 --- a/sys/arch/i386/include/apmvar.h +++ b/sys/arch/i386/include/apmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apmvar.h,v 1.5 1998/07/18 02:40:35 marc Exp $ */ +/* $OpenBSD: apmvar.h,v 1.6 1998/07/27 23:16:36 marc Exp $ */ /* * Copyright (c) 1995 John T. Kohl @@ -131,9 +131,14 @@ #define BATT_FLAGS(regp) (((regp)->cx & 0xff00) >> 8) #define AC_STATE(regp) (((regp)->bx & 0xff00) >> 8) #define BATT_LIFE(regp) ((regp)->cx & 0xff) /* in % */ +/* Return time in minutes. According to the APM 1.2 spec: + DX = Remaining battery life -- time units + Bit 15 = 0 Time units are seconds + = 1 Time units are minutes + Bits 14-0 = Number of seconds or minutes */ #define BATT_REMAINING(regp) (((regp)->dx & 0x8000) ? \ - ((regp)->dx & 0x7fff)*60 : \ - ((regp)->dx & 0x7fff)) + ((regp)->dx & 0x7fff) : \ + ((regp)->dx & 0x7fff)/60) #define BATT_REM_VALID(regp) (((regp)->dx & 0xffff) != 0xffff) #define APM_GET_PM_EVENT 0x530b -- cgit v1.2.3