summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-plugins/wmacpiload-ac')
-rw-r--r--x11-plugins/wmacpiload-ac/Manifest1
-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
-rw-r--r--x11-plugins/wmacpiload-ac/metadata.xml5
-rw-r--r--x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0-r1.ebuild46
-rw-r--r--x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0.ebuild32
7 files changed, 257 insertions, 0 deletions
diff --git a/x11-plugins/wmacpiload-ac/Manifest b/x11-plugins/wmacpiload-ac/Manifest
new file mode 100644
index 000000000000..49030360dde1
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/Manifest
@@ -0,0 +1 @@
+DIST wmacpiload-0.2.0.tar.bz2 112858 SHA256 c160db05fb968ec4d0f239ed7e35188de5ddce4e5a6ffcd3e3c496c279cd8808 SHA512 f0256ae313ad4ecbaf1604578321b45173912f250ba6fb7abf88edbcf6875dee30f8d2f7547cc207768c9229697dbfd48e77617c590e0ca27113b8c675e32714 WHIRLPOOL 83c2672eb6ef3610228a9d73fe9cb8652ec6278beb2d349eb59448d557563f0fbfadd129667759eeff384873707b18d254536ec0846dd807b55e286fa5c8b29c
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
diff --git a/x11-plugins/wmacpiload-ac/metadata.xml b/x11-plugins/wmacpiload-ac/metadata.xml
new file mode 100644
index 000000000000..b1a9efc4f2f0
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>desktop-dock</herd>
+</pkgmetadata>
diff --git a/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0-r1.ebuild b/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0-r1.ebuild
new file mode 100644
index 000000000000..227ba2fdc462
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0-r1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+
+MY_P=${P/-ac}
+DESCRIPTION="Hacked version of WMACPILoad, a dockapp to monitor CPU temp and battery time on ACPI kernels"
+HOMEPAGE="http://wmacpiload.tuxfamily.org/"
+SRC_URI="http://wmacpiload.tuxfamily.org/download/${MY_P}.tar.bz2"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug"
+
+RDEPEND="x11-libs/libX11
+ x11-libs/libXt
+ x11-libs/libXext
+ x11-libs/libXpm"
+
+DEPEND="${RDEPEND}
+ x11-proto/xextproto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-acpi-segfault.patch" || die "epatch failed"
+ epatch "${FILESDIR}/${PN}-acpi-sys-temp-hwmon.patch" || die "epatch failed"
+ epatch "${FILESDIR}/${PN}-acpi-fix-battery-unit.patch" || die "epatch failed"
+}
+
+src_configure() {
+ econf $(use_enable debug)
+}
+
+src_compile() {
+ emake || die "compile failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "install failed"
+ dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+}
diff --git a/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0.ebuild b/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0.ebuild
new file mode 100644
index 000000000000..8ce61b1fdb1a
--- /dev/null
+++ b/x11-plugins/wmacpiload-ac/wmacpiload-ac-0.2.0.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+MY_P=${P/-ac}
+DESCRIPTION="Hacked version of WMACPILoad, a dockapp to monitor CPU temp and battery time on ACPI kernels"
+HOMEPAGE="http://wmacpiload.tuxfamily.org/"
+SRC_URI="http://wmacpiload.tuxfamily.org/download/${MY_P}.tar.bz2"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 x86"
+IUSE="debug"
+
+RDEPEND="x11-libs/libX11
+ x11-libs/libXt
+ x11-libs/libXext
+ x11-libs/libXpm"
+DEPEND="${RDEPEND}
+ x11-proto/xextproto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_compile() {
+ econf $(use_enable debug)
+ emake || die "compile failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "install failed"
+ dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+}