aboutsummaryrefslogtreecommitdiffstats
path: root/x11
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-10-09 10:56:49 +0800
committerjhb <jhb@FreeBSD.org>2015-10-09 10:56:49 +0800
commitddf3c6005a67632b37c6289c0e060761e9497991 (patch)
treef91c1521e7c9b7db5e08d5057736776a3a8570e0 /x11
parent044be20e47d85b10fe7f9e14d0705e8d7abaac3f (diff)
downloadfreebsd-ports-gnome-ddf3c6005a67632b37c6289c0e060761e9497991.tar.gz
freebsd-ports-gnome-ddf3c6005a67632b37c6289c0e060761e9497991.tar.zst
freebsd-ports-gnome-ddf3c6005a67632b37c6289c0e060761e9497991.zip
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
Diffstat (limited to 'x11')
-rw-r--r--x11/i3status/Makefile2
-rw-r--r--x11/i3status/files/patch-print_battery_info.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/x11/i3status/Makefile b/x11/i3status/Makefile
index e9062607a0fa..4490de5cc859 100644
--- a/x11/i3status/Makefile
+++ b/x11/i3status/Makefile
@@ -2,7 +2,7 @@
PORTNAME= i3status
PORTVERSION= 2.8
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= x11
MASTER_SITES= http://i3wm.org/i3status/
diff --git a/x11/i3status/files/patch-print_battery_info.c b/x11/i3status/files/patch-print_battery_info.c
new file mode 100644
index 000000000000..feaea401a9f7
--- /dev/null
+++ b/x11/i3status/files/patch-print_battery_info.c
@@ -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;