summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /x11-plugins/wmacpiload-ac/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'x11-plugins/wmacpiload-ac/files')
-rw-r--r--x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-fix-battery-unit.patch30
-rw-r--r--x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-segfault.patch22
-rw-r--r--x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-sys-temp-hwmon.patch121
3 files changed, 173 insertions, 0 deletions
diff --git a/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-fix-battery-unit.patch b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-fix-battery-unit.patch
new file mode 100644
index 000000000000..6bf6179e7fc6
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-fix-battery-unit.patch
@@ -0,0 +1,30 @@
+--- wmacpiload-0.2.0/src/battery.c 2012-10-18 15:42:04.000000000 +0200
++++ wmacpiload-0.2.0.new/src/battery.c 2012-10-18 15:43:33.000000000 +0200
+@@ -42,7 +42,8 @@
+ ************************************************************************/
+
+ /* used to parse the battery state file */
+-#define CAPACITY_UNIT " mAh"
++#define CAPACITY_UNIT1 " mAh"
++#define CAPACITY_UNIT2 " mWh"
+
+ /************************************************************************
+ * Global constants definitions
+@@ -164,7 +165,7 @@
+ char *endptr;
+
+ capacity = strtoul(buf, &endptr, 10);
+- if (strcmp(endptr, CAPACITY_UNIT) != 0) {
++ if (strcmp(endptr, CAPACITY_UNIT1) != 0 && strcmp(endptr, CAPACITY_UNIT2) != 0) {
+ fprintf(stderr,
+ "%s : Battery %s unplugged or unconsistent data\n",
+ PACKAGE, bat->name);
+@@ -238,7 +239,7 @@
+ char *endptr;
+
+ remain = strtol(buf, &endptr, 10);
+- if (strcmp(endptr, CAPACITY_UNIT) == 0)
++ if (strcmp(endptr, CAPACITY_UNIT1) == 0 || strcmp(endptr, CAPACITY_UNIT2) == 0)
+ bat->percentage = (int) ((remain * 100.0) / bat->capacity);
+ else
+ bat->percentage = -1; \ No newline at end of file
diff --git a/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-segfault.patch b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-segfault.patch
new file mode 100644
index 000000000000..15f8e05579a2
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-segfault.patch
@@ -0,0 +1,22 @@
+diff -ru wmacpiload-0.2.0/include/lib_acpi.h wmacpiload-0.2.0.new//include/lib_acpi.h
+--- wmacpiload-0.2.0/include/lib_acpi.h 2005-07-21 21:33:19.000000000 -0400
++++ wmacpiload-0.2.0.new//include/lib_acpi.h 2011-06-20 19:53:30.458953984 -0400
+@@ -32,7 +32,7 @@
+ * Macros
+ ************************************************************************/
+
+-# define ACPIDEV "/proc/acpi/info"
++# define ACPIDEV "/proc/acpi/battery"
+
+ /* use ? */
+ # ifndef ACPI_32_BIT_SUPPORT
+diff -ru wmacpiload-0.2.0/src/dockapp.c wmacpiload-0.2.0.new//src/dockapp.c
+--- wmacpiload-0.2.0/src/dockapp.c 2005-08-16 18:38:36.000000000 -0400
++++ wmacpiload-0.2.0.new//src/dockapp.c 2011-06-20 19:44:20.022684448 -0400
+@@ -431,5 +431,6 @@
+ void
+ dockapp_cleanup(void)
+ {
++ if (display != NULL)
+ XCloseDisplay(display);
+ } \ No newline at end of file
diff --git a/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-sys-temp-hwmon.patch b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-sys-temp-hwmon.patch
new file mode 100644
index 000000000000..69857717daeb
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/files/wmacpiload-ac-acpi-sys-temp-hwmon.patch
@@ -0,0 +1,121 @@
+diff -ru wmacpiload-0.2.0/src/lib_acpi.c wmacpiload-0.2.0.new//src/lib_acpi.c
+--- wmacpiload-0.2.0/src/lib_acpi.c 2005-07-21 21:41:31.000000000 -0400
++++ wmacpiload-0.2.0.new//src/lib_acpi.c 2011-06-28 23:37:50.148092904 -0400
+@@ -83,7 +83,7 @@
+ if (!k->ac)
+ fprintf(stderr, "%s : no AC adapter detected\n", PACKAGE);
+
+- n = snprintf(dir, FILENAME_MAX + 1, "%s%s", "/proc/acpi",
++ n = snprintf(dir, FILENAME_MAX + 1, "%s%s", "/sys/class",
+ thermal_zone_dir);
+ if (n > FILENAME_MAX) {
+ fprintf(stderr, "%s : file name too long, "
+@@ -322,10 +322,10 @@
+ n = strlen(searched);
+
+ if (dest != NULL && dest_size > 0
+- && n > 0 && n < (sizeof buffer) - 1
++ && n < (sizeof buffer) - 1
+ && file_name != NULL && (fd = fopen(file_name, "r")) != NULL) {
+ while (fgets(buffer, sizeof buffer, fd) != NULL)
+- if (strncmp(buffer, searched, n) == 0) {
++ if (n == 0 || strncmp(buffer, searched, n) == 0) {
+ char *src;
+ char *end;
+ size_t len;
+diff -ru wmacpiload-0.2.0/src/thermal.c wmacpiload-0.2.0.new//src/thermal.c
+--- wmacpiload-0.2.0/src/thermal.c 2005-09-29 19:32:46.000000000 -0400
++++ wmacpiload-0.2.0.new//src/thermal.c 2011-06-29 00:18:24.851904854 -0400
+@@ -30,12 +30,17 @@
+ #endif
+
+ #include <stdio.h>
++#include <errno.h>
++#include <limits.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <dirent.h>
+ #include "lib_acpi.h"
+ #include "wmacpiload.h"
+ #include "thermal.h"
++#include <unistd.h>
++#include <sys/types.h>
++#include <sys/stat.h>
+
+ /************************************************************************
+ * Macro definitions
+@@ -48,8 +53,10 @@
+ * Global constants definitions
+ ************************************************************************/
+
+-const char *const thermal_zone_dir = "/thermal_zone/";
+-const char *const thermal_zone_status_file = "/temperature";
++const char *const thermal_zone_dir = "/hwmon/";
++const char *const thermal_zone_status_file = "/temp1_input";
++const char *const thermal_zone_search[] = { "", "/device" };
++const int thermal_zone_MAX_SEARCH = 2;
+
+ /************************************************************************
+ * Function definitions
+@@ -86,9 +93,24 @@
+ }
+ strcpy(tz->name, fd->d_name);
+
+- tz->tempfile =
+- strcat4("/proc/acpi", thermal_zone_dir, tz->name,
+- thermal_zone_status_file);
++ int i;
++ for (i=0; i < thermal_zone_MAX_SEARCH ; i++) {
++ char device_name[MAXSTRLEN+1];
++ char *tempfile;
++ struct stat tempstat;
++ snprintf(device_name, MAXSTRLEN, "%s%s", tz->name, thermal_zone_search[i]);
++ tempfile =
++ strcat4("/sys/class", thermal_zone_dir, device_name,
++ thermal_zone_status_file);
++ if (stat(tempfile, &tempstat) == -1) {
++ if (verbose)
++ printf("Unable to read thermal zone '%s'\n", tempfile);
++ } else {
++ tz->tempfile = tempfile;
++ break;
++ }
++ }
++
+ if (!tz->tempfile) {
+ fprintf(stderr, "%s : could not allocate memory "
+ "for thermal zone tempfile concerning "
+@@ -127,16 +149,19 @@
+
+ if (tz != NULL) {
+ if (parse_file(tz->tempfile,
+- "temperature:", buf, sizeof buf) != NULL) {
++ "", buf, sizeof buf) != NULL) {
+ char *endptr;
+
+ temp = strtoul(buf, &endptr, 10);
+ /*
+- * The format is "temperature: xx C" where xx is the
+- * temperature in celcius degrees. So we check if we have the
+- * " C" left in the buffer to see if all went well.
++ * The format is "xxxxxx" where xx is the
++ * temperature in celcius degrees times 1000.
+ */
+- if (strcmp(endptr, TEMP_UNIT) != 0) {
++ errno = 0;
++ if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN) ) ||
++ (errno != 0 && temp == 0) ||
++ endptr == buf) {
++ perror("strtol");
+ fprintf(stderr, "%s : Unconsistent temperature "
+ "about thermal zone %s\n", PACKAGE, tz->name);
+ temp = 0;
+@@ -144,7 +169,7 @@
+ } else {
+ temp = 0;
+ }
+- tz->temp = temp;
++ tz->temp = temp / 1000;
+ }
+ }
+ \ No newline at end of file