pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/xbattbar make xbattbar work in the presense o...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/634cf791622b
branches:  trunk
changeset: 463195:634cf791622b
user:      mrg <mrg%pkgsrc.org@localhost>
date:      Sat Nov 01 04:03:18 2003 +0000

description:
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:

 sysutils/xbattbar/distinfo         |   4 ++--
 sysutils/xbattbar/patches/patch-ab |  17 ++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 7ac71dc92204 -r 634cf791622b sysutils/xbattbar/distinfo
--- a/sysutils/xbattbar/distinfo        Sat Nov 01 00:52:50 2003 +0000
+++ b/sysutils/xbattbar/distinfo        Sat Nov 01 04:03:18 2003 +0000
@@ -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 -r 7ac71dc92204 -r 634cf791622b sysutils/xbattbar/patches/patch-ab
--- a/sysutils/xbattbar/patches/patch-ab        Sat Nov 01 00:52:50 2003 +0000
+++ b/sysutils/xbattbar/patches/patch-ab        Sat Nov 01 04:03:18 2003 +0000
@@ -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 @@
  #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 @@
 -               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;



Home | Main Index | Thread Index | Old Index