head 1.5; access; symbols pkgsrc-2013Q2:1.5.0.54 pkgsrc-2013Q2-base:1.5 pkgsrc-2012Q4:1.5.0.52 pkgsrc-2012Q4-base:1.5 pkgsrc-2011Q4:1.5.0.50 pkgsrc-2011Q4-base:1.5 pkgsrc-2011Q2:1.5.0.48 pkgsrc-2011Q2-base:1.5 pkgsrc-2009Q4:1.5.0.46 pkgsrc-2009Q4-base:1.5 pkgsrc-2008Q4:1.5.0.44 pkgsrc-2008Q4-base:1.5 pkgsrc-2008Q3:1.5.0.42 pkgsrc-2008Q3-base:1.5 cube-native-xorg:1.5.0.40 cube-native-xorg-base:1.5 pkgsrc-2008Q2:1.5.0.38 pkgsrc-2008Q2-base:1.5 pkgsrc-2008Q1:1.5.0.36 pkgsrc-2008Q1-base:1.5 pkgsrc-2007Q4:1.5.0.34 pkgsrc-2007Q4-base:1.5 pkgsrc-2007Q3:1.5.0.32 pkgsrc-2007Q3-base:1.5 pkgsrc-2007Q2:1.5.0.30 pkgsrc-2007Q2-base:1.5 pkgsrc-2007Q1:1.5.0.28 pkgsrc-2007Q1-base:1.5 pkgsrc-2006Q4:1.5.0.26 pkgsrc-2006Q4-base:1.5 pkgsrc-2006Q3:1.5.0.24 pkgsrc-2006Q3-base:1.5 pkgsrc-2006Q2:1.5.0.22 pkgsrc-2006Q2-base:1.5 pkgsrc-2006Q1:1.5.0.20 pkgsrc-2006Q1-base:1.5 pkgsrc-2005Q4:1.5.0.18 pkgsrc-2005Q4-base:1.5 pkgsrc-2005Q3:1.5.0.16 pkgsrc-2005Q3-base:1.5 pkgsrc-2005Q2:1.5.0.14 pkgsrc-2005Q2-base:1.5 pkgsrc-2005Q1:1.5.0.12 pkgsrc-2005Q1-base:1.5 pkgsrc-2004Q4:1.5.0.10 pkgsrc-2004Q4-base:1.5 pkgsrc-2004Q3:1.5.0.8 pkgsrc-2004Q3-base:1.5 pkgsrc-2004Q2:1.5.0.6 pkgsrc-2004Q2-base:1.5 pkgsrc-2004Q1:1.5.0.4 pkgsrc-2004Q1-base:1.5 pkgsrc-2003Q4:1.5.0.2 pkgsrc-2003Q4-base:1.5 buildlink2-base:1.5 netbsd-1-4-PATCH002:1.4 comdex-fall-1999:1.3 netbsd-1-4-PATCH001:1.2; locks; strict; comment @# @; 1.5 date 2000.05.31.16.20.40; author rh; state dead; branches; next 1.4; 1.4 date 99.11.14.20.45.09; author tron; state Exp; branches; next 1.3; 1.3 date 99.08.15.14.58.59; author tron; state Exp; branches; next 1.2; 1.2 date 99.07.15.18.09.26; author chopps; state Exp; branches; next 1.1; 1.1 date 99.07.15.17.53.57; author chopps; state Exp; branches; next ; desc @@ 1.5 log @Remove obsoleted patches (that were not applied anyway, because they were no longer present in files/patch-sum) @ text @$NetBSD: patch-ah,v 1.4 1999/11/14 20:45:09 tron Exp $ --- applets/battery/read-battery.c.orig Tue Aug 24 21:41:15 1999 +++ applets/battery/read-battery.c Sun Nov 14 21:24:09 1999 @@@@ -185,7 +185,7 @@@@ close(fd); return TRUE; -#elif defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__NetBSD_APM__) || defined(__OpenBSD__) struct apm_power_info aip; int fd; @@@@ -221,7 +221,44 @@@@ close(fd); return TRUE; -#else /* ! ( __linux__ || __FreeBSD__) */ +#elif defined(__NetBSD_APM__) + + struct apm_power_info aip; + int fd; + + fd = open(APMDEV, O_RDONLY); + if (fd == -1) + { + g_error (_("Cannot open /dev/apm; can't get data.")); + return FALSE; + } + + if (ioctl(fd, APM_IOC_GETPOWER, &aip) == -1) { + g_error(_("ioctl failed on /dev/apm.")); + return FALSE; + } + + *hours_remaining = aip.minutes_left / 60; + aip.minutes_left %= 60; + *minutes_remaining = aip.minutes_left; + + /* if APM is not turned on */ + if (aip.battery_state == APM_BATT_UNKNOWN) + { + g_error(_("APM battery state unknown! Cannot read battery charge information.")); + } + if (aip.ac_state == APM_AC_UNKNOWN) + { + g_error(_("APM ac state is unknown! Cannot read battery charge information.")); + } + + *ac_online = aip.ac_state == APM_AC_ON; + *percentage = aip.battery_life; + + close(fd); + return TRUE; + +#else /* ! ( __linux__ || __FreeBSD__ || __NetBSD_APM__ ) */ /* Assume always connected to power. */ *ac_online = 1; @ 1.4 log @Complete APM support cleanup. @ text @d1 1 a1 1 $NetBSD$ @ 1.3 log @Use APM only on ports which really support it. @ text @d1 1 a1 1 $NetBSD: patch-ah,v 1.2 1999/07/15 18:09:26 chopps Exp $ d3 16 a18 6 --- applets/battery/read-battery.h.orig Thu Jul 15 13:59:25 1999 +++ applets/battery/read-battery.h Thu Jul 15 14:41:22 1999 @@@@ -18,6 +18,11 @@@@ #include #include #define APMDEV "/dev/apm" d20 37 a56 5 +#include +#include +#include +#define APMDEV "/dev/apm" #endif d58 2 a59 1 /* Prototypes */ @ 1.2 log @add netbsd rcs ids @ text @d1 1 a1 1 $NetBSD$ d9 1 a9 1 +#elif defined(__NetBSD__) @ 1.1 log @add patches for battery applet @ text @d1 2 @