pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/sysutils/xbattbar
Module Name: pkgsrc
Committed By: tsutsui
Date: Sat Aug 30 02:49:34 UTC 2025
Modified Files:
pkgsrc/sysutils/xbattbar: Makefile distinfo
Added Files:
pkgsrc/sysutils/xbattbar/patches: patch-Imakefile patch-xbattbar.c
patch-xbattbar.man
Removed Files:
pkgsrc/sysutils/xbattbar/patches: patch-aa patch-ab patch-ac
Log Message:
xbattbar: rename patches for maintainability, and misc cleanup.
- add a valid MASTER_SITES
- refer web.archive.org page for the latest HOMEPAGE
- add LICENSE per COPYING file to appease pkglint
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 pkgsrc/sysutils/xbattbar/Makefile
cvs rdiff -u -r1.19 -r1.20 pkgsrc/sysutils/xbattbar/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xbattbar/patches/patch-Imakefile \
pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.c \
pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.man
cvs rdiff -u -r1.3 -r0 pkgsrc/sysutils/xbattbar/patches/patch-aa
cvs rdiff -u -r1.10 -r0 pkgsrc/sysutils/xbattbar/patches/patch-ab
cvs rdiff -u -r1.1 -r0 pkgsrc/sysutils/xbattbar/patches/patch-ac
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/sysutils/xbattbar/Makefile
diff -u pkgsrc/sysutils/xbattbar/Makefile:1.38 pkgsrc/sysutils/xbattbar/Makefile:1.39
--- pkgsrc/sysutils/xbattbar/Makefile:1.38 Thu Oct 10 17:25:57 2024
+++ pkgsrc/sysutils/xbattbar/Makefile Sat Aug 30 02:49:33 2025
@@ -1,14 +1,16 @@
-# $NetBSD: Makefile,v 1.38 2024/10/10 17:25:57 nia Exp $
+# $NetBSD: Makefile,v 1.39 2025/08/30 02:49:33 tsutsui Exp $
DISTNAME= xbattbar_1.4.2
PKGNAME= ${DISTNAME:S/_/-/}
PKGREVISION= 10
CATEGORIES= sysutils x11
-MASTER_SITES= http://iplab.aist-nara.ac.jp/member/suguru/
+#MASTER_SITES= http://iplab.aist-nara.ac.jp/member/suguru/
+MASTER_SITES= https://www.minix3.org/distfiles-backup/
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
-#HOMEPAGE= http://iplab.aist-nara.ac.jp/member/suguru/xbattbar.html
+HOMEPAGE= https://web.archive.org/web/20160729024814/http://iplab.naist.jp/member/suguru/xbattbar.html
COMMENT= X11 battery graph for laptops
+LICENSE= gnu-gpl-v2
ONLY_FOR_PLATFORM= FreeBSD-*-*
ONLY_FOR_PLATFORM+= NetBSD-*-*
Index: pkgsrc/sysutils/xbattbar/distinfo
diff -u pkgsrc/sysutils/xbattbar/distinfo:1.19 pkgsrc/sysutils/xbattbar/distinfo:1.20
--- pkgsrc/sysutils/xbattbar/distinfo:1.19 Tue Oct 26 11:20:24 2021
+++ pkgsrc/sysutils/xbattbar/distinfo Sat Aug 30 02:49:33 2025
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.19 2021/10/26 11:20:24 nia Exp $
+$NetBSD: distinfo,v 1.20 2025/08/30 02:49:33 tsutsui Exp $
BLAKE2s (xbattbar_1.4.2.tar.gz) = d181c68da609a5666aa64e6c86ffbed6ac589cbd3bd293fea31745449fadbd4c
SHA512 (xbattbar_1.4.2.tar.gz) = d06aca5c70d0d7feac48f791f676b465d713ca941fbfaa9e8effa80c896873b9cc3f18f1122793cfd096804767e69f1f38dbeeec06a2fe1f82386d53f56372bf
Size (xbattbar_1.4.2.tar.gz) = 14079 bytes
-SHA1 (patch-aa) = cef5072e9fa9dd8beeceff41e6f2d1c1a45196eb
-SHA1 (patch-ab) = 1d329ca83f6a3ad71c101c7f5fa07ee4fe98b833
-SHA1 (patch-ac) = 507cdf9b4e79dc577d020963142e262d04536527
+SHA1 (patch-Imakefile) = e47df3f84a274d916db1520b639c55547921f9f5
+SHA1 (patch-xbattbar.c) = a609d7ccb605d88bec82e6fba1ea917b8d59eab5
+SHA1 (patch-xbattbar.man) = b889e7f566ab217dcc90a92f30942c4e2653c093
Added files:
Index: pkgsrc/sysutils/xbattbar/patches/patch-Imakefile
diff -u /dev/null pkgsrc/sysutils/xbattbar/patches/patch-Imakefile:1.1
--- /dev/null Sat Aug 30 02:49:34 2025
+++ pkgsrc/sysutils/xbattbar/patches/patch-Imakefile Sat Aug 30 02:49:33 2025
@@ -0,0 +1,17 @@
+$NetBSD: patch-Imakefile,v 1.1 2025/08/30 02:49:33 tsutsui Exp $
+
+- use ${PREFIX} and proper man page path
+
+--- Imakefile.orig 2001-02-02 05:25:28.000000000 +0000
++++ Imakefile
+@@ -17,8 +17,8 @@ XCOMM License along with this program; i
+ XCOMM Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ XCOMM
+
+-BINDIR = /usr/local/bin
+-MANDIR = /usr/local/man/cat1
++BINDIR = ${PREFIX}/bin
++MANDIR = ${PREFIX}/man/man1
+
+ LOCAL_LIBRARIES = $(XLIB)
+
Index: pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.c
diff -u /dev/null pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.c:1.1
--- /dev/null Sat Aug 30 02:49:34 2025
+++ pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.c Sat Aug 30 02:49:33 2025
@@ -0,0 +1,227 @@
+$NetBSD: patch-xbattbar.c,v 1.1 2025/08/30 02:49:33 tsutsui Exp $
+
+- misc support and fixes for NetBSD using apm(4), acpi(4), and envsys(4)
+- properly report battery and AC info from axppmic(4) found on Pinebook
+
+--- 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>
++
++#ifdef __NetBSD__
++#define ENVSYSUNITNAMES
++#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 +587,190 @@ void battery_check(void)
+
+ #ifdef __NetBSD__
+
++#ifndef _NO_APM
+ #include <machine/apmvar.h>
++#else
++#define APM_AC_OFF 0x00
++#define APM_AC_ON 0x01
++#endif
+
+ #define _PATH_APM_SOCKET "/var/run/apmdev"
+ #define _PATH_APM_CTLDEV "/dev/apmctl"
+ #define _PATH_APM_NORMAL "/dev/apm"
+
++/*
++ * pre: fd contains a valid file descriptor of an envsys(4) supporting device
++ * && ns is the number of sensors
++ * && etds and ebis are arrays of sufficient size
++ * post: returns 0 and etds and ebis arrays are filled with sensor info
++ * or returns -1 on failure
++ */
++static int
++fillsensors(int fd, envsys_tre_data_t *etds, envsys_basic_info_t *ebis,
++ size_t ns)
++{
++ int i;
++
++ for (i = 0; i < ns; ++i) {
++ ebis[i].sensor = i;
++ if (ioctl(fd, ENVSYS_GTREINFO, &ebis[i]) == -1) {
++ warn("Can't get sensor info for sensor %d", i);
++ return 0;
++ }
++
++ etds[i].sensor = i;
++ if (ioctl(fd, ENVSYS_GTREDATA, &etds[i]) == -1) {
++ warn("Can't get sensor data for sensor %d", i);
++ return 0;
++ }
++ }
++ return 1;
++}
++
++/*
++ * pre: fd contains a valid file descriptor of an envsys(4) supporting device
++ * post: returns the number of valid sensors provided by the device
++ * or -1 on error
++ */
++static size_t
++numsensors(int fd)
++{
++ int count = 0, valid = 1;
++ envsys_tre_data_t etd;
++ etd.sensor = 0;
++
++ while (valid) {
++ if (ioctl(fd, ENVSYS_GTREDATA, &etd) == -1)
++ err(1, "Can't get sensor data");
++
++ valid = etd.validflags & ENVSYS_FVALID;
++ if (valid)
++ ++count;
++
++ ++etd.sensor;
++ }
++
++ return count;
++}
++
++static envsys_tre_data_t *etds;
++static envsys_basic_info_t *ebis;
++static int *cetds;
++
++#if defined(_PATH_SYSMON) && __NetBSD_Version__ >= 106110000
++#define HAVE_NETBSD_ACPI
++#endif
++
+ int first = 1;
+ void battery_check(void)
+ {
+ int fd, r, p;
++#ifndef _NO_APM
+ struct apm_power_info info;
++#endif
++ int acpi;
++ size_t ns;
++ size_t cc;
++ char *apmdev;
++ int i;
++
++ acpi = 0;
++ apmdev = _PATH_APM_NORMAL;
++ if ((fd = open(apmdev, O_RDONLY)) == -1) {
++#ifdef HAVE_NETBSD_ACPI
++ apmdev = _PATH_SYSMON;
++ fd = open(apmdev, O_RDONLY);
++ acpi = 1;
++#endif
++ }
++ if (fd < 0) {
++ fprintf(stderr, "xbattbar: cannot open %s device\n", apmdev);
++ exit(1);
++ }
+
+- if ((fd = open(_PATH_APM_NORMAL, O_RDONLY)) == -1) {
+- fprintf(stderr, "xbattbar: cannot open apm device\n");
++ if (acpi) {
++#ifdef HAVE_NETBSD_ACPI
++ if ((ns = numsensors(fd)) == 0) {
++ fprintf(stderr, "xbattbar: no sensors found\n");
+ exit(1);
+ }
++ if (first) {
++ cetds = (int *)malloc(ns * sizeof(int));
++ etds = (envsys_tre_data_t *)malloc(ns * sizeof(envsys_tre_data_t));
++ ebis = (envsys_basic_info_t *)malloc(ns * sizeof(envsys_basic_info_t));
++
++ if ((cetds == NULL) || (etds == NULL) || (ebis == NULL)) {
++ err(1, "Out of memory");
++ }
++ }
++
++ fillsensors(fd, etds, ebis, ns);
++
++#endif
++#ifndef _NO_APM
++ } else {
+
++ memset(&info, 0, sizeof(info));
+ if (ioctl(fd, APM_IOC_GETPOWER, &info) != 0) {
+ fprintf(stderr, "xbattbar: ioctl APM_IOC_GETPOWER failed\n");
+ exit(1);
+ }
++#endif
++ }
+
+ close(fd);
+
+ ++elapsed_time;
+
+- /* get current remoain */
++ 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)
++ continue;
++ cc = strlen(ebis[i].desc);
++ if (strncmp(ebis[i].desc, "acpibat", 7) == 0 &&
++ (strcmp(&ebis[i].desc[cc - 7], " charge") == 0 ||
++ strcmp(&ebis[i].desc[cc - 7], " energy") == 0)) {
++ rtot += etds[i].cur.data_s;
++ maxtot += etds[i].max.data_s;
++ }
++ /*
++ * XXX: We should use acpiacad driver and look for
++ * " connected", but that's broken on some machines
++ * and we want this to work everywhere. With this
++ * we will occasionally catch a machine conditioning
++ * a battery while connected, while other machines take
++ * 10-15 seconds to switch from "charging" to
++ * "discharging" and vice versa, but this is the best
++ * compromise.
++ */
++ 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 - 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;
++ }
++ }
++ if (!have_pct)
++ r = (rtot * 100.0) / maxtot;
++#endif
++#ifndef _NO_APM
++ } else {
++ /* get current remain */
+ if (info.battery_life > 100) {
+ /* some APM BIOSes return values slightly > 100 */
+ r = 100;
+@@ -617,6 +784,8 @@ void battery_check(void)
+ } else {
+ p = APM_AC_OFF;
+ }
++#endif
++ }
+
+ if (first || ac_line != p || battery_level != r) {
+ first = 0;
Index: pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.man
diff -u /dev/null pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.man:1.1
--- /dev/null Sat Aug 30 02:49:34 2025
+++ pkgsrc/sysutils/xbattbar/patches/patch-xbattbar.man Sat Aug 30 02:49:34 2025
@@ -0,0 +1,69 @@
+$NetBSD: patch-xbattbar.man,v 1.1 2025/08/30 02:49:34 tsutsui Exp $
+
+- mention about ACPI support
+- imporove misc wording
+
+--- xbattbar.man.orig 2001-02-02 05:25:29.000000000 +0000
++++ xbattbar.man
+@@ -36,8 +36,8 @@
+ .Sh DESCRIPTION
+ .Nm xbattbar
+ shows the current (laptop) battery status in the X window environment.
+-Battery status is obtained through the APM kernel module.
+-The APM kernel module depends on your UNIX platform,
++Battery status is obtained through the APM or ACPI kernel module.
++The APM and ACPI kernels module depends on your UNIX platform,
+ therefore, consult your documentation for its detail.
+ .Pp
+ .Nm xbattbar
+@@ -48,7 +48,7 @@ The thickness of the indicator is 3 pixe
+ you can set the thickness as a parameter of
+ .Nm -t
+ option.
+-This indicator is appeared in the bottom of the display, as its default.
++This indicator appears in the bottom of the display (by default).
+ The option
+ .Nm top,
+ .Nm left,
+@@ -57,12 +57,12 @@ or
+ forces the status indicator to be at the top, left, and right of the
+ display,
+ respectively.
+-Though it's a default, you can also use
+-.Nm buttom
++Though it's the default, you can also use
++.Nm bottom
+ as the option.
+ .Pp
+-In the case the AC line is on-line (plugged in),
+-its color of the bar indicator consists of "green" and "olive drab"
++When the AC line is on-line (plugged in),
++the color of the bar indicator consists of "green" and "olive drab"
+ portions.
+ The "green" portion shows its battery charging level.
+ These colors can be changed by
+@@ -71,19 +71,20 @@ and
+ .Nm -O
+ options.
+ In the other case (AC line is off-line),
++the color of the bar indicator consists of "blue" and "red";
+ the "blue" portion of the bar indicator shows the percentage of
+ its remaining battery level.
+-The color conbination for the AC off-line case can be changed by
++The color combination for the AC off-line case can be changed by
+ .Nm -i
+ and
+ .Nm -o
+ options.
+ .Pp
+ .Nm xbattbar
+-trys to know its battery status in every 10 seconds in default.
+-This is achived by APM polling.
++trys to know the battery status in every 10 seconds.
++This is achieved by APM or ACPI polling.
+ .Nm -p
+-option sets the polling interval in second.
++option changes the polling interval (in seconds).
+ .Pp
+ If the mouse cursor enters in the status indicator,
+ the diagnosis window appears in the center of the display,
Home |
Main Index |
Thread Index |
Old Index