summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorhubertf <hubertf@pkgsrc.org>1999-11-02 21:54:47 +0000
committerhubertf <hubertf@pkgsrc.org>1999-11-02 21:54:47 +0000
commit100744163a088833f3b64c5d82cd12228cd6a787 (patch)
treef3011073587728761e0db4400978e07f3d147c5a /sysutils
parentd611dbc64debf3af1a2d1f655bd265ee2099b706 (diff)
downloadpkgsrc-100744163a088833f3b64c5d82cd12228cd6a787.tar.gz
KDE-based APM utility (battery monitor).
Whacked heavily to work on NetBSD.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/kapm/Makefile16
-rw-r--r--sysutils/kapm/files/md53
-rw-r--r--sysutils/kapm/files/patch-sum5
-rw-r--r--sysutils/kapm/patches/patch-aa121
-rw-r--r--sysutils/kapm/patches/patch-ab30
-rw-r--r--sysutils/kapm/patches/patch-ac29
-rw-r--r--sysutils/kapm/pkg/COMMENT1
-rw-r--r--sysutils/kapm/pkg/DESCR12
-rw-r--r--sysutils/kapm/pkg/PLIST21
9 files changed, 238 insertions, 0 deletions
diff --git a/sysutils/kapm/Makefile b/sysutils/kapm/Makefile
new file mode 100644
index 00000000000..ad1f3a6858a
--- /dev/null
+++ b/sysutils/kapm/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+#
+
+DISTNAME= kapm-0.3.1
+CATEGORIES= sysutils x11 kde
+MASTER_SITES= ftp://bodnar42.dhs.org/pub/kapm/
+
+MAINTAINER= hubertf@netbsd.org
+HOMEPAGE= http://bodnar42.dhs.org/kapm/
+
+USE_X11BASE= YES # to get things near KDE
+GNU_CONFIGURE= YES
+CONFIGURE_ARGS+=--with-qt-includes=${X11BASE}/include/qt \
+ --with-qt-libraries=${X11BASE}/lib
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/kapm/files/md5 b/sysutils/kapm/files/md5
new file mode 100644
index 00000000000..640de7942ea
--- /dev/null
+++ b/sysutils/kapm/files/md5
@@ -0,0 +1,3 @@
+$NetBSD: md5,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+
+MD5 (kapm-0.3.1.tar.gz) = ab3ebdc461641b79d862024ea38db74e
diff --git a/sysutils/kapm/files/patch-sum b/sysutils/kapm/files/patch-sum
new file mode 100644
index 00000000000..65cd38ebd15
--- /dev/null
+++ b/sysutils/kapm/files/patch-sum
@@ -0,0 +1,5 @@
+$NetBSD: patch-sum,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+
+MD5 (patch-aa) = be687ef1066d5f26b452d24c0c872de0
+MD5 (patch-ab) = 54a1bd5334886e4e107a6b57715680b2
+MD5 (patch-ac) = 994e2c0d1f01a0d01a9b11ac786749e7
diff --git a/sysutils/kapm/patches/patch-aa b/sysutils/kapm/patches/patch-aa
new file mode 100644
index 00000000000..dd2366a15dc
--- /dev/null
+++ b/sysutils/kapm/patches/patch-aa
@@ -0,0 +1,121 @@
+$NetBSD: patch-aa,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+
+--- kapm/apm.cpp.orig Tue Nov 2 06:27:01 1999
++++ kapm/apm.cpp Tue Nov 2 06:27:49 1999
+@@ -10,6 +10,13 @@
+ 6) Its packaged as an object
+ */
+
++#ifdef __NetBSD__
++# include <assert.h>
++# include <fcntl.h>
++# include <sys/ioctl.h>
++# include <machine/apmvar.h>
++# include <unistd.h>
++#endif /* __NetBSD__ */
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "apm.h"
+@@ -29,6 +36,7 @@
+
+ int apm::check() {
+ #ifndef DEBUG
++#if defined(Linux)
+ FILE *str;
+
+ if (!(str = fopen( APM_PROC, "r" )))
+@@ -43,6 +51,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 +79,7 @@
+ void apm::read()
+ {
+ #ifndef DEBUG
++#ifdef Linux
+ FILE *str;
+ char buffer[64];
+
+@@ -71,21 +89,59 @@
+
+ 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);
++ rc = ioctl(fd, APM_IOC_GETPOWER, &apm_pi);
++ assert(rc != -1);
++ close(fd);
++
++ i.driver_version = "NetBSD\0\0\0"; /* can't they document what's
++ expected here ?!? */
++ 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;
+
diff --git a/sysutils/kapm/patches/patch-ab b/sysutils/kapm/patches/patch-ab
new file mode 100644
index 00000000000..0bb3334a43a
--- /dev/null
+++ b/sysutils/kapm/patches/patch-ab
@@ -0,0 +1,30 @@
+$NetBSD: patch-ab,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+
+--- kapm/apm.h.orig Tue Nov 2 06:27:22 1999
++++ kapm/apm.h Tue Nov 2 06:31:39 1999
+@@ -1,6 +1,7 @@
+ /* apm.h -- Header file for sample APM interface routines
+ * Created: Mon Jan 8 11:40:50 1996 by r.faith@ieee.org
+ * Revised: Mon Aug 2 23:57:43 1999 by bodnar42@bodnar42.dhs.org
++ * NetBSD: Tue Nov 2 06:30:40 1999 by hubertf@netbsd.org
+ * Copyright 1996 Rickard E. Faith (r.faith@ieee.org)
+ *
+ * This library is free software; you can redistribute it and/or modify it
+@@ -22,10 +23,14 @@
+ #ifndef APM_H
+ #define APM_H
+
+-#define APM_PROC "/proc/apm"
+-#define APM_DEVICE "/dev/apm_bios"
++#if defined(Linux)
++# define APM_PROC "/proc/apm"
++# define APM_DEVICE "/dev/apm_bios"
+
+-#define APM_32_BIT_SUPPORT 0x0002
++# define APM_32_BIT_SUPPORT 0x0002
++#elif defined(__NetBSD__)
++# define APM_PROC "/dev/apm"
++#endif /* Linux/__NetBSD__ */
+
+ typedef struct apm_info {
+ char driver_version[10];
diff --git a/sysutils/kapm/patches/patch-ac b/sysutils/kapm/patches/patch-ac
new file mode 100644
index 00000000000..84e7a2c3c08
--- /dev/null
+++ b/sysutils/kapm/patches/patch-ac
@@ -0,0 +1,29 @@
+$NetBSD: patch-ac,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+
+--- kapm/kapm.cpp.orig Tue Nov 2 06:26:59 1999
++++ kapm/kapm.cpp Tue Nov 2 06:27:36 1999
+@@ -85,15 +85,23 @@
+ }
+
+ void Kapm::slotSuspend() {
++#ifdef __NetBSD__
++ suApp("apm -z", i18n("suspend"));
++#else /* !__NetBSD__ */
+ suApp("apm -s", i18n("suspend"));
++#endif /* __NetBSD__ */
+ }
+
+ void Kapm::slotStandby() {
+- suApp("apm -S", i18n("standby"));
++ suApp("apm -S", i18n("standby")); /* -S is for NetBSD and Linux */
+ }
+
+ void Kapm::slotPowerOff() {
++#ifdef __NetBSD__
++ suApp("halt -p", i18n("power off"), true);
++#else /* !__NetBSD__ */
+ suApp("poweroff", i18n("power off"), true);
++#endif /* __NetBSD__ */
+ }
+
+ void Kapm::slotAPMStatus() {
diff --git a/sysutils/kapm/pkg/COMMENT b/sysutils/kapm/pkg/COMMENT
new file mode 100644
index 00000000000..dc4c0057b2b
--- /dev/null
+++ b/sysutils/kapm/pkg/COMMENT
@@ -0,0 +1 @@
+Monitor a laptop's battery status and perform other APM tasks
diff --git a/sysutils/kapm/pkg/DESCR b/sysutils/kapm/pkg/DESCR
new file mode 100644
index 00000000000..964bd040fcc
--- /dev/null
+++ b/sysutils/kapm/pkg/DESCR
@@ -0,0 +1,12 @@
+KAPM is a docking KDE utility that allows you to monitor your laptop's
+battery status and perform other APM (advanced power management)
+tasks.
+
+ o Panel Docking KAPM displays a small bar on your panel depicting the
+ status of your battery
+
+ o Status Notification KAPM can optionally tell you when your battery
+ is done charging or running low
+
+ o Power Managment KAPM can suspend, standby, or power off your
+ computer
diff --git a/sysutils/kapm/pkg/PLIST b/sysutils/kapm/pkg/PLIST
new file mode 100644
index 00000000000..8832f1c6168
--- /dev/null
+++ b/sysutils/kapm/pkg/PLIST
@@ -0,0 +1,21 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 1999/11/02 21:54:47 hubertf Exp $
+bin/kapm
+share/doc/kde/HTML/en/kapm/index-1.html
+share/doc/kde/HTML/en/kapm/index-2.html
+share/doc/kde/HTML/en/kapm/index-3.html
+share/doc/kde/HTML/en/kapm/index-4.html
+share/doc/kde/HTML/en/kapm/index.html
+share/doc/kde/HTML/en/kapm/index-5.html
+share/doc/kde/HTML/en/kapm/logotp3.gif
+share/doc/kde/HTML/en/kapm/index-6.html
+share/kde/applnk/System/kapm.kdelnk
+share/kde/icons/kapm.xpm
+share/kde/icons/mini/kapm.xpm
+share/kde/icons/kapm_critical.xpm
+share/kde/icons/kapm_high.xpm
+share/kde/icons/kapm_low.xpm
+share/kde/icons/kapm_unknown.xpm
+share/kde/icons/kapm_charging.gif
+share/kde/locale/de/LC_MESSAGES/kapm.mo
+share/kde/locale/ja/LC_MESSAGES/kapm.mo
+@dirrm share/doc/kde/HTML/en/kapm