head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.52 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.50 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.48 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.46 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.44 pkgsrc-2009Q4-base:1.4 pkgsrc-2008Q4:1.4.0.42 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.40 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.38 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.36 pkgsrc-2008Q2-base:1.4 pkgsrc-2008Q1:1.4.0.34 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.32 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.30 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.28 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.26 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.24 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.4.0.22 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.4.0.20 pkgsrc-2006Q2-base:1.4 pkgsrc-2006Q1:1.4.0.18 pkgsrc-2006Q1-base:1.4 pkgsrc-2005Q4:1.4.0.16 pkgsrc-2005Q4-base:1.4 pkgsrc-2005Q3:1.4.0.14 pkgsrc-2005Q3-base:1.4 pkgsrc-2005Q2:1.4.0.12 pkgsrc-2005Q2-base:1.4 pkgsrc-2005Q1:1.4.0.10 pkgsrc-2005Q1-base:1.4 pkgsrc-2004Q4:1.4.0.8 pkgsrc-2004Q4-base:1.4 pkgsrc-2004Q3:1.4.0.6 pkgsrc-2004Q3-base:1.4 pkgsrc-2004Q2:1.4.0.4 pkgsrc-2004Q2-base:1.4 pkgsrc-2004Q1:1.4.0.2 pkgsrc-2004Q1-base:1.4 pkgsrc-2003Q4:1.3.0.8 pkgsrc-2003Q4-base:1.3 netbsd-1-6-1:1.3.0.4 netbsd-1-6-1-base:1.3 netbsd-1-6:1.3.0.6 netbsd-1-6-RELEASE-base:1.3 pkgviews:1.3.0.2 pkgviews-base:1.3 buildlink2:1.2.0.2 buildlink2-base:1.2 netbsd-1-5-PATCH003:1.2 netbsd-1-5-PATCH001:1.1.1.1 netbsd-1-5-RELEASE:1.1.1.1 netbsd-1-4-PATCH003:1.1.1.1 netbsd-1-4-PATCH002:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.4 date 2004.01.14.15.03.54; author wiz; state dead; branches; next 1.3; 1.3 date 2002.07.18.12.48.51; author agc; state Exp; branches; next 1.2; 1.2 date 2001.11.26.23.09.30; author hubertf; state Exp; branches; next 1.1; 1.1 date 99.11.02.21.54.47; author hubertf; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.11.02.21.54.47; author hubertf; state Exp; branches; next ; desc @@ 1.4 log @Remove some more (not yet even buildlinked) KDE1 packages, since KDE1 has been removed. Noted by agc. @ text @$NetBSD: patch-aa,v 1.3 2002/07/18 12:48:51 agc Exp $ --- kapm/apm.cpp.orig Wed Oct 20 06:19:57 1999 +++ kapm/apm.cpp @@@@ -10,6 +10,14 @@@@ 6) Its packaged as an object */ +#ifdef __NetBSD__ +# include +# include +# include +# include +# include +# include +#endif /* __NetBSD__ */ #include #include #include "apm.h" @@@@ -29,6 +37,7 @@@@ int apm::check() { #ifndef DEBUG +#if defined(Linux) FILE *str; if (!(str = fopen( APM_PROC, "r" ))) @@@@ -43,6 +52,15 @@@@ if (!(i.apm_flags & APM_32_BIT_SUPPORT)) return 3; +#elif defined(__NetBSD__) + int fd; + + fd = open(APM_PROC, O_RDONLY); + if (fd == -1) + return 1; + + return 0; +#endif /* Linux/__NetBSD__ */ #else // Do initial kernel support emulation setup @@@@ -62,6 +80,7 @@@@ void apm::read() { #ifndef DEBUG +#ifdef Linux FILE *str; char buffer[64]; @@@@ -71,21 +90,61 @@@@ sscanf( buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n", (char *)i.driver_version, - &i.apm_version_major, - &i.apm_version_minor, - &i.apm_flags, - &i.ac_line_status, - (unsigned int*)(&i.battery_status), - &i.battery_flags, - (int*)(&i.battery_percentage), - &i.battery_time, - buffer ); // Scribble on our own buffer so save memories - i.using_minutes = (buffer[0] == *"m"); + &i.apm_version_major, /* HF: unused */ + &i.apm_version_minor, /* HF: unused */ + &i.apm_flags, /* HF: ? */ + &i.ac_line_status, /* HF: ac_state */ + (unsigned int*)(&i.battery_status), /* HF: battery_state */ + &i.battery_flags, /* HF: ? */ + (int*)(&i.battery_percentage), /* HF: battery_life */ + &i.battery_time, /* HF: minutes_left? */ + buffer ); // Scribble on our own buffer so save memories + i.using_minutes = (buffer[0] == *"m"); /* HF: 1 */ // Emulate a percentage if none is given if ((i.battery_percentage == -1) && (i.battery_status != -1)) i.battery_percentage = (3 - i.battery_status) * 25; - + +#elif defined(__NetBSD__) + + int fd, rc; + struct apm_power_info apm_pi; + + fd = open(APM_PROC, O_RDONLY); + assert(fd != -1); + memset(&apm_pi, 0, sizeof(apm_pi)); + rc = ioctl(fd, APM_IOC_GETPOWER, &apm_pi); + assert(rc != -1); + close(fd); + + (void) memset(i.driver_version, 0, sizeof(i.driver_version)); + (void) strcpy(i.driver_version, "NetBSD"); + + i.apm_version_major = 1; + i.apm_version_minor = 1; /* May be 0 with APM_V10_ONLY + - how to find out ? */ + i.apm_flags = 0; /* what's that? */ + i.ac_line_status = apm_pi.ac_state; /* one of APM_AC_OFF, APM_AC_ON, + APM_AC_BACKUP, or + APM_AC_UNKNOWN */ + i.battery_status = apm_pi.battery_state; /* one of APM_BATT_HIGH, + APM_BATT_LOW, + APM_BATT_CRITICAL, + APM_BATT_CHARGING, or + APM_BATT_UNKNOWN */ + i.battery_flags = 0; /* what's that? */ + i.battery_percentage = apm_pi.battery_life; /* percentage estimated + remaining normal + battery life (or 0 if + the BIOS cannot provide + an estimate) */ + i.battery_time = apm_pi.minutes_left; /* estimated remaining lifetime + (or 0 if the BIOS cannot + provide an estimate) */ + i.using_minutes = 1; + +#endif /* Linux, __NetBSD__ */ + #else static char percent = 0; @ 1.3 log @Make this compile - fixes a problem in the bulk build. @ text @d1 1 a1 1 $NetBSD: patch-aa,v 1.2 2001/11/26 23:09:30 hubertf Exp $ @ 1.2 log @Update to 0.3.1nb1: Adjust to new apm scheme Hinted at by Love in PR 14555. @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 @@@@ -10,6 +10,13 @@@@ d14 1 d20 1 a20 1 @@@@ -29,6 +36,7 @@@@ d28 1 a28 1 @@@@ -43,6 +51,15 @@@@ d44 1 a44 1 @@@@ -62,6 +79,7 @@@@ d52 1 a52 1 @@@@ -71,21 +89,60 @@@@ d94 3 a96 2 + i.driver_version = "NetBSD\0\0\0"; /* can't they document what's + expected here ?!? */ @ 1.1 log @Initial revision @ text @d3 2 a4 2 --- kapm/apm.cpp.orig Tue Nov 2 06:27:01 1999 +++ kapm/apm.cpp Tue Nov 2 06:27:49 1999 d51 1 a51 1 @@@@ -71,21 +89,59 @@@@ d88 1 @ 1.1.1.1 log @KDE-based APM utility (battery monitor). Whacked heavily to work on NetBSD. @ text @@