summaryrefslogtreecommitdiff
path: root/sysutils/xbattbar
diff options
context:
space:
mode:
authormrg <mrg@pkgsrc.org>2003-11-01 04:03:18 +0000
committermrg <mrg@pkgsrc.org>2003-11-01 04:03:18 +0000
commitc1e04ba78b0c6a62670e42d9ea76564aa16f58ec (patch)
tree4fa663d550f5f3f79aa9b186b7a8776b78c3d4ee /sysutils/xbattbar
parentf99dc0179c7620b54333bb3721f0ddcfd26b134a (diff)
downloadpkgsrc-c1e04ba78b0c6a62670e42d9ea76564aa16f58ec.tar.gz
make xbattbar work in the presense of multiple acpibat's. also, note
that we're not on AC power via the acpiacad's 'disconnected' entry, not one of the battery's "discharging" entries, as the latter may be true even while on AC power.
Diffstat (limited to 'sysutils/xbattbar')
-rw-r--r--sysutils/xbattbar/distinfo4
-rw-r--r--sysutils/xbattbar/patches/patch-ab17
2 files changed, 12 insertions, 9 deletions
diff --git a/sysutils/xbattbar/distinfo b/sysutils/xbattbar/distinfo
index e1563a7a051..fbdedcda127 100644
--- a/sysutils/xbattbar/distinfo
+++ b/sysutils/xbattbar/distinfo
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.5 2003/10/19 09:25:02 agc Exp $
+$NetBSD: distinfo,v 1.6 2003/11/01 04:03:18 mrg Exp $
SHA1 (xbattbar_1.4.2.tar.gz) = 14e9aafd62919e4a625d3f84df3b074b9eef8279
Size (xbattbar_1.4.2.tar.gz) = 14079 bytes
SHA1 (patch-aa) = 3bd4b688ccaeebe766335245c1a8c5dde52768c2
-SHA1 (patch-ab) = bdbff422f5f673fabc1fb74625af5fd2c760e137
+SHA1 (patch-ab) = 87b2b93952de2e8b356ee4a8288062a35463b45a
diff --git a/sysutils/xbattbar/patches/patch-ab b/sysutils/xbattbar/patches/patch-ab
index 83f6a5cd4dc..8221c10bbbe 100644
--- a/sysutils/xbattbar/patches/patch-ab
+++ b/sysutils/xbattbar/patches/patch-ab
@@ -1,7 +1,7 @@
-$NetBSD: patch-ab,v 1.2 2003/10/19 09:25:02 agc Exp $
+$NetBSD: patch-ab,v 1.3 2003/11/01 04:03:18 mrg Exp $
---- xbattbar.c.orig 2001-02-02 05:25:29.000000000 +0000
-+++ xbattbar.c 2003-10-17 13:15:51.000000000 +0100
+--- xbattbar.c.orig 2001-02-02 16:25:29.000000000 +1100
++++ xbattbar.c 2003-11-01 14:55:10.000000000 +1100
@@ -27,6 +27,13 @@
#include <sys/types.h>
@@ -16,7 +16,7 @@ $NetBSD: patch-ab,v 1.2 2003/10/19 09:25:02 agc Exp $
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
-@@ -583,46 +590,158 @@
+@@ -583,46 +590,161 @@
#define _PATH_APM_CTLDEV "/dev/apmctl"
#define _PATH_APM_NORMAL "/dev/apm"
@@ -141,19 +141,22 @@ $NetBSD: patch-ab,v 1.2 2003/10/19 09:25:02 agc Exp $
- r = info.battery_life;
- }
+ if (acpi) {
-+ r = 0;
++ int32_t rtot = 0, maxtot = 0;
+ p = APM_AC_ON;
+ for (i = 0 ; i < ns ; i++) {
+ cc = strlen(ebis[i].desc);
+ if (strcmp(&ebis[i].desc[cc - 6], "energy") == 0) {
-+ r = (etds[i].cur.data_s * 100.0) / etds[i].max.data_s;
++ rtot += etds[i].cur.data_s;
++ maxtot += etds[i].max.data_s;
+ }
+ if (ebis[i].units == ENVSYS_INDICATOR &&
+ etds[i].cur.data_s &&
-+ strcmp(&ebis[i].desc[cc - 11], "discharging") == 0) {
++ strncmp(ebis[i].desc, "acpiacad", 8) == 0 &&
++ strcmp(&ebis[i].desc[cc - 12], "disconnected") == 0) {
+ p = APM_AC_OFF;
+ }
+ }
++ r = (rtot * 100.0) / maxtot;
+ if (first || ac_line != p || battery_level != r) {
+ first = 0;
+ ac_line = p;