svn commit: r398899 - in head/x11/i3status: . files
John Baldwin
jhb at FreeBSD.org
Fri Oct 9 02:56:51 UTC 2015
Author: jhb (src,doc committer)
Date: Fri Oct 9 02:56:49 2015
New Revision: 398899
URL: https://svnweb.freebsd.org/changeset/ports/398899
Log:
Properly check for the charging flag in the returned battery status
to determine if the battery is charging.
Reviewed by: bapt (maintainer)
Differential Revision: https://reviews.freebsd.org/D3849
Added:
head/x11/i3status/files/patch-print_battery_info.c (contents, props changed)
Modified:
head/x11/i3status/Makefile
Modified: head/x11/i3status/Makefile
==============================================================================
--- head/x11/i3status/Makefile Thu Oct 8 23:21:52 2015 (r398898)
+++ head/x11/i3status/Makefile Fri Oct 9 02:56:49 2015 (r398899)
@@ -2,7 +2,7 @@
PORTNAME= i3status
PORTVERSION= 2.8
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= x11
MASTER_SITES= http://i3wm.org/i3status/
Added: head/x11/i3status/files/patch-print_battery_info.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/x11/i3status/files/patch-print_battery_info.c Fri Oct 9 02:56:49 2015 (r398899)
@@ -0,0 +1,28 @@
+--- src/print_battery_info.c.orig 2014-01-05 03:34:07.000000000 -0800
++++ src/print_battery_info.c 2015-10-08 13:33:45.452887000 -0700
+@@ -12,6 +12,7 @@
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
++#include <dev/acpica/acpiio.h>
+ #endif
+
+ #if defined(__OpenBSD__)
+@@ -215,7 +216,7 @@ void print_battery_info(yajl_gen json_ge
+ state = sysctl_rslt;
+ if (state == 0 && present_rate == 100)
+ status = CS_FULL;
+- else if (state == 0 && present_rate < 100)
++ else if ((state & ACPI_BATT_STAT_CHARGING) && present_rate < 100)
+ status = CS_CHARGING;
+ else
+ status = CS_DISCHARGING;
+@@ -227,7 +228,7 @@ void print_battery_info(yajl_gen json_ge
+ (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%",
+ present_rate);
+
+- if (state == 1) {
++ if (state == ACPI_BATT_STAT_DISCHARG) {
+ int hours, minutes;
+ minutes = remaining;
+ hours = minutes / 60;
More information about the svn-ports-all
mailing list