diff options
author | tron <tron> | 1999-11-14 20:45:08 +0000 |
---|---|---|
committer | tron <tron> | 1999-11-14 20:45:08 +0000 |
commit | 75ddc9d820173ac83be789494db8d6a57fc8c655 (patch) | |
tree | e282c726741b694ca3003a768b0009e3e6f22aec /x11 | |
parent | 538cb6662dbce943f489ca5ebca20c9c25262148 (diff) | |
download | pkgsrc-75ddc9d820173ac83be789494db8d6a57fc8c655.tar.gz |
Complete APM support cleanup.
Diffstat (limited to 'x11')
-rw-r--r-- | x11/gnome-core/files/patch-sum | 4 | ||||
-rw-r--r-- | x11/gnome-core/patches/patch-ah | 69 |
2 files changed, 58 insertions, 15 deletions
diff --git a/x11/gnome-core/files/patch-sum b/x11/gnome-core/files/patch-sum index 6d071abb05e..c944156ded2 100644 --- a/x11/gnome-core/files/patch-sum +++ b/x11/gnome-core/files/patch-sum @@ -1,9 +1,9 @@ -$NetBSD: patch-sum,v 1.11 1999/11/14 19:00:01 tron Exp $ +$NetBSD: patch-sum,v 1.12 1999/11/14 20:45:08 tron Exp $ MD5 (patch-aa) = bbfda5e5e72f45c645356340cbec72a0 MD5 (patch-ab) = da663b71d7c71c707258fa57ed9af4a9 MD5 (patch-ac) = 4aab1f4ff482e45020ba26ef0a969cdd MD5 (patch-af) = a18ee68f6e295f5b4607f7b3fb6f3032 MD5 (patch-ag) = ba94f4a23817dd700fb47da5d802174b -MD5 (patch-ah) = 5cce80b3eabd1a604cfebe3e9b5cc256 +MD5 (patch-ah) = 9ccf562222e0b94a0508a0574ba578f8 MD5 (patch-ai) = d5def5f3e883160814f0a3d7d901b1f4 diff --git a/x11/gnome-core/patches/patch-ah b/x11/gnome-core/patches/patch-ah index d5820d85381..313628bd34d 100644 --- a/x11/gnome-core/patches/patch-ah +++ b/x11/gnome-core/patches/patch-ah @@ -1,16 +1,59 @@ -$NetBSD: patch-ah,v 1.3 1999/08/15 14:58:59 tron Exp $ +$NetBSD: patch-ah,v 1.4 1999/11/14 20:45:09 tron Exp $ ---- 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 <fcntl.h> - #include <machine/apm_bios.h> - #define APMDEV "/dev/apm" +--- 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__) -+#include <sys/ioctl.h> -+#include <machine/apmvar.h> -+#include <fcntl.h> -+#define APMDEV "/dev/apm" - #endif ++ ++ 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__ ) */ - /* Prototypes */ + /* Assume always connected to power. */ + *ac_online = 1; |