summaryrefslogtreecommitdiff
path: root/desktop/icewm/patches/icewm-1.3.7-thermal.patch
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2014-01-30 20:09:00 -0600
committerRobby Workman <rworkman@slackbuilds.org>2014-01-30 20:09:00 -0600
commit5a1f3c67997f90164a26e9c925a70a5e1e6e2ce9 (patch)
treea225b9ca4932d61983757fdff0d8cb700c40d98b /desktop/icewm/patches/icewm-1.3.7-thermal.patch
parent3eafd205e5a84c8b5ca7668407fa7ee25b77eca7 (diff)
downloadslackbuilds-5a1f3c67997f90164a26e9c925a70a5e1e6e2ce9.tar.gz
desktop/icewm: Included some patches from Fedora and Gentoo
Thanks to Janusz Kuśnierek for the suggestion. Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'desktop/icewm/patches/icewm-1.3.7-thermal.patch')
-rw-r--r--desktop/icewm/patches/icewm-1.3.7-thermal.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/desktop/icewm/patches/icewm-1.3.7-thermal.patch b/desktop/icewm/patches/icewm-1.3.7-thermal.patch
new file mode 100644
index 0000000000..f6b2cf71f0
--- /dev/null
+++ b/desktop/icewm/patches/icewm-1.3.7-thermal.patch
@@ -0,0 +1,41 @@
+diff -uprN a/src/acpustatus.cc b/src/acpustatus.cc
+--- a/src/acpustatus.cc 2010-10-31 15:09:36.000000000 +0100
++++ b/src/acpustatus.cc 2013-01-17 21:12:19.085715083 +0100
+@@ -315,6 +315,37 @@ int CPUStatus::getAcpiTemp(char *tempbuf
+ }
+ closedir(dir);
+ }
++ else if ((dir = opendir("/sys/class/thermal")) != NULL) {
++ struct dirent *de;
++
++ while ((de = readdir(dir)) != NULL) {
++
++ int fd, seglen;
++
++ if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
++ continue;
++
++ sprintf(namebuf, "/sys/class/thermal/%s/temp", de->d_name);
++ fd = open(namebuf, O_RDONLY);
++ if (fd != -1) {
++ int len = read(fd, buf, sizeof(buf) - 1);
++ buf[len - 4] = '\0';
++ seglen = strlen(buf) + 4;
++ if (retbuflen + seglen >= buflen) {
++ retbuflen = -retbuflen;
++ close(fd);
++ closedir(dir);
++ break;
++ }
++ retbuflen += seglen;
++ strcat(tempbuf, " ");
++ strncat(tempbuf, buf, seglen);
++ strcat(tempbuf, " C");
++ close(fd);
++ }
++ }
++ closedir(dir);
++ }
+ return retbuflen;
+ }
+