Subject: pkg/30122: wm/icewm taskbar apm monitor does not work on NetBSD (patches included)
To: None <,,>
From: Iain Hibbert <>
List: pkgsrc-bugs
Date: 05/03/2005 20:55:00
>Number:         30122
>Category:       pkg
>Synopsis:       wm/icewm taskbar apm monitor does not work on NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 03 20:55:00 +0000 2005
>Originator:     Iain Hibbert
>Release:        NetBSD 2.0
System: NetBSD galant 2.0 NetBSD 2.0 (GALANT) #13: Fri Apr 29 11:09:37 BST 2005 plunky@galant:/home/plunky/src/sys/arch/i386/compile/GALANT i386
Architecture: i386
Machine: i386
   I'm not sure why but the apm taskbar monitor no longer works on NetBSD with the pkgsrc
   version of icewm.  Looking at the code, it never would have worked so I'm thinking that
   there must have been a patch included to make it work that has been removed since the
   package was updated (Sorry, I looked on cvsweb but couldnt work out how to look at files
   that had been deleted :)
   just build it and run it, you will see..
   Anyway, here are two patches that patch and aapm.h that will make it work on NetBSD.
   I named them ba and bb to avoid any conflicts but suppose that isnt really necessary, they
   could fit into the sequence if required.  unshar them in pkgsrc/wm/icewm and dont forget to
   'make makepatchsum'.

   I will submit these to the IceWM project also.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
# This archive contains:
#	patches/patch-ba
#	patches/patch-bb
echo x - patches/patch-ba
sed 's/^X//' >patches/patch-ba << 'END-of-patches/patch-ba'
Xenable APM support for NetBSD
X+++ src/aapm.h	2005-05-02 11:15:30.000000000 +0100
X@@ -1,5 +1,5 @@
X-#if defined(linux) || (defined (__FreeBSD__) && defined(i386))
X+#if defined(linux) || (defined (__FreeBSD__) && defined(i386)) || defined(__NetBSD__)
X #include "ywindow.h"
X #include "ytimer.h"
echo x - patches/patch-bb
sed 's/^X//' >patches/patch-bb << 'END-of-patches/patch-bb'
Xenable APM support for NetBSD
X+++ src/	2005-05-03 11:08:15.000000000 +0100
X@@ -34,6 +34,13 @@
X #include <machine/apm_bios.h>
X #endif
X+#ifdef __NetBSD__
X+#include <sys/file.h>
X+#include <sys/ioctl.h>
X+#include <sys/types.h>
X+#include <machine/apmvar.h>
X YColor *YApm::apmBg = 0;
X YColor *YApm::apmFg = 0;
X ref<YFont> YApm::apmFont;
X@@ -57,6 +64,8 @@
X void ApmStr(char *s, bool Tool) {
X #ifdef __FreeBSD__
X     struct apm_info ai;
X+#elif defined __NetBSD__
X+    struct apm_power_info ai;
X #else
X     char buf[80];
X #endif
X@@ -96,6 +105,22 @@
X     BATlife = ai.ai_batt_life;
X     BATtime = ai.ai_batt_time == 0 ? -1 : ai.ai_batt_time;
X     strcpy(units, "sec");
X+#elif defined __NetBSD__
X+    memset(&ai, 0, sizeof(ai));
X+    if (ioctl(fd, APM_IOC_GETPOWER, &ai) == -1)
X+    {
X+	perror("Cannot ioctl the apm device");
X+        close(fd);
X+        return;
X+    }
X+    close(fd);
X+    strcpy(apmver, "?.?");
X+    ACstatus = (ai.ac_state == APM_AC_ON) ? 1 : 0;
X+    BATflag = (ai.battery_state == APM_BATT_CHARGING) ? 8 : 0;
X+    BATlife = ai.battery_life;
X+    BATtime = (ai.minutes_left == 0) ? -1 : ai.minutes_left;
X+    strcpy(units, "min");
X #else
X     len = read(fd, buf, sizeof(buf) - 1);
X     close(fd);

 	pkgsrc snapshot of about a week ago, icewm version 1.2.20