summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Bogorodskiy <novel@FreeBSD.org>2005-07-13 05:30:29 +0000
committerRoman Bogorodskiy <novel@FreeBSD.org>2005-07-13 05:30:29 +0000
commit8c42f2da582c6257b5767df5de6e284d0d1cefea (patch)
tree70d68abf60ea17f5c01ec399c768a652e0de93b6
parent- Update to 3.7. (diff)
Improve battery support.
Submitted by: Nick Hibma <nick@cope.nl>
Notes
Notes: svn path=/head/; revision=139028
-rw-r--r--sysutils/torsmo/files/patch-freebsd.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sysutils/torsmo/files/patch-freebsd.c b/sysutils/torsmo/files/patch-freebsd.c
index 109d6bfb13c2..7319d68f3536 100644
--- a/sysutils/torsmo/files/patch-freebsd.c
+++ b/sysutils/torsmo/files/patch-freebsd.c
@@ -1,5 +1,5 @@
---- freebsd.c.orig Wed Aug 25 20:24:24 2004
-+++ freebsd.c Sun Jan 2 08:49:26 2005
+--- freebsd.c.dist Wed Jul 13 09:34:20 2005
++++ freebsd.c Wed Jul 13 09:34:26 2005
@@ -4,14 +4,12 @@
#include <stdio.h>
#include <stdlib.h>
@@ -86,7 +86,30 @@
if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
(void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
-@@ -344,4 +381,38 @@
+@@ -303,15 +340,19 @@
+ }
+
+ void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
+- int battime;
++ int battime, batlife, state;
+
+ if (GETSYSCTL("hw.acpi.battery.time", battime))
+ (void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.time\"\n");
++ if (GETSYSCTL("hw.acpi.battery.life", batlife))
++ (void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.life\"\n");
++ if (GETSYSCTL("hw.acpi.acline", state))
++ (void)fprintf(stderr, "Cannot read sysctl \"hw.acpi.acline\"\n");
+
+ if (battime != -1)
+- snprintf(buf, n, "Discharging, remaining %d:%2.2d", battime / 60, battime % 60);
++ snprintf(buf, n, "%d:%2.2d%s", battime / 60, battime % 60, (state? " (charging)":""));
+ else
+- snprintf(buf, n, "Battery is charging");
++ snprintf(buf, n, "%d%%%s", batlife, (state? " (charging)":""));
+ }
+
+ int open_i2c_sensor(const char *dev, const char *type, int n, int *div)
+@@ -344,4 +385,38 @@
char* get_acpi_fan() {
return "";