pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/xbattbar Properly report battery and AC info ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a3bc1184dfa0
branches:  trunk
changeset: 379865:a3bc1184dfa0
user:      jmcneill <jmcneill%pkgsrc.org@localhost>
date:      Sun May 06 14:32:06 2018 +0000

description:
Properly report battery and AC info from axppmic sensors.

diffstat:

 sysutils/xbattbar/Makefile         |   4 ++--
 sysutils/xbattbar/distinfo         |   4 ++--
 sysutils/xbattbar/patches/patch-ab |  27 ++++++++++++++++++++-------
 3 files changed, 24 insertions(+), 11 deletions(-)

diffs (93 lines):

diff -r 0aea0d6e896a -r a3bc1184dfa0 sysutils/xbattbar/Makefile
--- a/sysutils/xbattbar/Makefile        Sun May 06 13:21:46 2018 +0000
+++ b/sysutils/xbattbar/Makefile        Sun May 06 14:32:06 2018 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.35 2017/09/06 10:40:33 wiz Exp $
+# $NetBSD: Makefile,v 1.36 2018/05/06 14:32:06 jmcneill Exp $
 
 DISTNAME=      xbattbar_1.4.2
 PKGNAME=       ${DISTNAME:S/_/-/}
-PKGREVISION=   9
+PKGREVISION=   10
 CATEGORIES=    sysutils x11
 MASTER_SITES=  http://iplab.aist-nara.ac.jp/member/suguru/
 
diff -r 0aea0d6e896a -r a3bc1184dfa0 sysutils/xbattbar/distinfo
--- a/sysutils/xbattbar/distinfo        Sun May 06 13:21:46 2018 +0000
+++ b/sysutils/xbattbar/distinfo        Sun May 06 14:32:06 2018 +0000
@@ -1,9 +1,9 @@
-$NetBSD: distinfo,v 1.16 2015/11/04 01:32:39 agc Exp $
+$NetBSD: distinfo,v 1.17 2018/05/06 14:32:06 jmcneill Exp $
 
 SHA1 (xbattbar_1.4.2.tar.gz) = 14e9aafd62919e4a625d3f84df3b074b9eef8279
 RMD160 (xbattbar_1.4.2.tar.gz) = f28a273a1865a0919e32144bbb5b16b3c0340061
 SHA512 (xbattbar_1.4.2.tar.gz) = d06aca5c70d0d7feac48f791f676b465d713ca941fbfaa9e8effa80c896873b9cc3f18f1122793cfd096804767e69f1f38dbeeec06a2fe1f82386d53f56372bf
 Size (xbattbar_1.4.2.tar.gz) = 14079 bytes
 SHA1 (patch-aa) = cef5072e9fa9dd8beeceff41e6f2d1c1a45196eb
-SHA1 (patch-ab) = 17def14cb44ef4374aaa0e67e5bef3f1eeb042f7
+SHA1 (patch-ab) = 1d329ca83f6a3ad71c101c7f5fa07ee4fe98b833
 SHA1 (patch-ac) = 507cdf9b4e79dc577d020963142e262d04536527
diff -r 0aea0d6e896a -r a3bc1184dfa0 sysutils/xbattbar/patches/patch-ab
--- a/sysutils/xbattbar/patches/patch-ab        Sun May 06 13:21:46 2018 +0000
+++ b/sysutils/xbattbar/patches/patch-ab        Sun May 06 14:32:06 2018 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-ab,v 1.9 2008/01/04 01:43:58 pooka Exp $
+$NetBSD: patch-ab,v 1.10 2018/05/06 14:32:06 jmcneill Exp $
 
---- 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 @@
+--- xbattbar.c.orig    2001-02-02 05:25:29.000000000 +0000
++++ xbattbar.c
+@@ -27,6 +27,16 @@ static char *ReleaseVersion="1.4.2";
  
  #include <sys/types.h>
  #include <sys/time.h>
@@ -19,7 +19,7 @@
  #include <signal.h>
  #include <stdio.h>
  #include <unistd.h>
-@@ -577,33 +587,177 @@
+@@ -577,33 +587,190 @@ void battery_check(void)
  
  #ifdef __NetBSD__
  
@@ -164,6 +164,7 @@
 +       if (acpi) {
 +#ifdef HAVE_NETBSD_ACPI
 +              int32_t rtot = 0, maxtot = 0;
++              int have_pct = 0;
 +              p = APM_AC_ON;
 +              for (i = 0 ; i < ns ; i++) {
 +                      if ((etds[i].validflags & ENVSYS_FCURVALID) == 0)
@@ -191,8 +192,20 @@
 +                          strcmp(&ebis[i].desc[cc - 14], "discharge rate") == 0) {
 +                              p = APM_AC_OFF;
 +                      }
++
++                      if (ebis[i].units == ENVSYS_INTEGER &&
++                          strcmp(ebis[i].desc, "battery percent") == 0) {
++                              have_pct = 1;
++                              r = etds[i].cur.data_s;
++                      }
++                      if (ebis[i].units == ENVSYS_INDICATOR &&
++                          strcmp(ebis[i].desc, "ACIN present") == 0 &&
++                          etds[i].cur.data_s == 0) {
++                              p = APM_AC_OFF;
++                      }
 +              }
-+              r = (rtot * 100.0) / maxtot;
++              if (!have_pct)
++                      r = (rtot * 100.0) / maxtot;
 +#endif
 +#ifndef _NO_APM
 +       } else {
@@ -200,7 +213,7 @@
         if (info.battery_life > 100) {
                 /* some APM BIOSes return values slightly > 100 */
                 r = 100;
-@@ -617,6 +771,8 @@
+@@ -617,6 +784,8 @@ void battery_check(void)
         } else {
                 p = APM_AC_OFF;
         }



Home | Main Index | Thread Index | Old Index