pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/xbattbar Make charging detection use discharg...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ae066505140a
branches:  trunk
changeset: 537127:ae066505140a
user:      pooka <pooka%pkgsrc.org@localhost>
date:      Fri Jan 04 01:43:58 2008 +0000

description:
Make charging detection use discharge rate instead of charge rate,
since a fully charged battery would sometimes drop the charge rate
to 0.  This happens at least on the submitter's and my laptops.

patch from ymous anonimo

diffstat:

 sysutils/xbattbar/Makefile         |   4 ++--
 sysutils/xbattbar/distinfo         |   4 ++--
 sysutils/xbattbar/patches/patch-ab |  22 ++++++++++++----------
 3 files changed, 16 insertions(+), 14 deletions(-)

diffs (93 lines):

diff -r 060a414b8017 -r ae066505140a sysutils/xbattbar/Makefile
--- a/sysutils/xbattbar/Makefile        Fri Jan 04 01:43:56 2008 +0000
+++ b/sysutils/xbattbar/Makefile        Fri Jan 04 01:43:58 2008 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.31 2007/11/28 22:33:17 jnemeth Exp $
+# $NetBSD: Makefile,v 1.32 2008/01/04 01:43:58 pooka Exp $
 
 DISTNAME=      xbattbar_1.4.2
 PKGNAME=       ${DISTNAME:S/_/-/}
-PKGREVISION=   8
+PKGREVISION=   9
 CATEGORIES=    sysutils x11
 MASTER_SITES=  http://iplab.aist-nara.ac.jp/member/suguru/
 
diff -r 060a414b8017 -r ae066505140a sysutils/xbattbar/distinfo
--- a/sysutils/xbattbar/distinfo        Fri Jan 04 01:43:56 2008 +0000
+++ b/sysutils/xbattbar/distinfo        Fri Jan 04 01:43:58 2008 +0000
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.13 2007/11/28 22:33:17 jnemeth Exp $
+$NetBSD: distinfo,v 1.14 2008/01/04 01:43:58 pooka Exp $
 
 SHA1 (xbattbar_1.4.2.tar.gz) = 14e9aafd62919e4a625d3f84df3b074b9eef8279
 RMD160 (xbattbar_1.4.2.tar.gz) = f28a273a1865a0919e32144bbb5b16b3c0340061
 Size (xbattbar_1.4.2.tar.gz) = 14079 bytes
 SHA1 (patch-aa) = 3bd4b688ccaeebe766335245c1a8c5dde52768c2
-SHA1 (patch-ab) = f9ad127d4d3f9c4d5c6c01b9d476f74faf665fdb
+SHA1 (patch-ab) = 17def14cb44ef4374aaa0e67e5bef3f1eeb042f7
 SHA1 (patch-ac) = 507cdf9b4e79dc577d020963142e262d04536527
diff -r 060a414b8017 -r ae066505140a sysutils/xbattbar/patches/patch-ab
--- a/sysutils/xbattbar/patches/patch-ab        Fri Jan 04 01:43:56 2008 +0000
+++ b/sysutils/xbattbar/patches/patch-ab        Fri Jan 04 01:43:58 2008 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-ab,v 1.8 2007/11/28 22:33:18 jnemeth Exp $
+$NetBSD: patch-ab,v 1.9 2008/01/04 01:43:58 pooka Exp $
 
---- xbattbar.c.orig    2001-02-02 00:25:29.000000000 -0500
-+++ xbattbar.c 2007-11-27 20:56:25.000000000 -0500
-@@ -27,6 +27,14 @@
+--- xbattbar.c.orig    2001-02-02 07:25:29.000000000 +0200
++++ xbattbar.c 2008-01-04 03:32:10.000000000 +0200
+@@ -27,6 +27,16 @@
  
  #include <sys/types.h>
  #include <sys/time.h>
@@ -12,12 +12,14 @@
 +#include <sys/param.h>
 +#include <sys/envsys.h>
 +#include <paths.h>
++#include <stdlib.h>
++#include <string.h>
 +#endif /* __NetBSD__ */
 +
  #include <signal.h>
  #include <stdio.h>
  #include <unistd.h>
-@@ -577,33 +585,177 @@
+@@ -577,33 +587,177 @@
  
  #ifdef __NetBSD__
  
@@ -162,7 +164,7 @@
 +       if (acpi) {
 +#ifdef HAVE_NETBSD_ACPI
 +              int32_t rtot = 0, maxtot = 0;
-+              p = APM_AC_OFF;
++              p = APM_AC_ON;
 +              for (i = 0 ; i < ns ; i++) {
 +                      if ((etds[i].validflags & ENVSYS_FCURVALID) == 0)
 +                              continue;
@@ -183,11 +185,11 @@
 +                       * "discharging" and vice versa, but this is the best
 +                       * compromise.
 +                       */
-+                      if (ebis[i].units == ENVSYS_INDICATOR &&
++                      if ((ebis[i].units == ENVSYS_SWATTS || ebis[i].units == ENVSYS_SAMPS) &&
 +                          etds[i].cur.data_s &&
 +                          strncmp(ebis[i].desc, "acpibat", 7) == 0 &&
-+                          strcmp(&ebis[i].desc[cc - 8], "charging") == 0) {
-+                              p = APM_AC_ON;
++                          strcmp(&ebis[i].desc[cc - 14], "discharge rate") == 0) {
++                              p = APM_AC_OFF;
 +                      }
 +              }
 +              r = (rtot * 100.0) / maxtot;
@@ -198,7 +200,7 @@
         if (info.battery_life > 100) {
                 /* some APM BIOSes return values slightly > 100 */
                 r = 100;
-@@ -617,6 +769,8 @@
+@@ -617,6 +771,8 @@
         } else {
                 p = APM_AC_OFF;
         }



Home | Main Index | Thread Index | Old Index