aboutsummaryrefslogtreecommitdiffstats
path: root/main/xfce4-battery-plugin
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-03-25 12:01:37 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-25 12:01:37 +0000
commit7a810e0c59b55de4c567bef455cbf77847b56633 (patch)
tree541d81464c97c4a482b0a8771890f807d999c33f /main/xfce4-battery-plugin
parenta0d95b152a855b10a3460c173106a140807da254 (diff)
downloadaports-7a810e0c59b55de4c567bef455cbf77847b56633.tar.bz2
aports-7a810e0c59b55de4c567bef455cbf77847b56633.tar.xz
main/xfce4-battery-plugin: add missing patch for prev commit
Diffstat (limited to 'main/xfce4-battery-plugin')
-rw-r--r--main/xfce4-battery-plugin/sysfs-temp.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/main/xfce4-battery-plugin/sysfs-temp.patch b/main/xfce4-battery-plugin/sysfs-temp.patch
new file mode 100644
index 0000000000..d20680ed8d
--- /dev/null
+++ b/main/xfce4-battery-plugin/sysfs-temp.patch
@@ -0,0 +1,66 @@
+From e33899de3205edfc0b2c330f43da6a4bc8141b85 Mon Sep 17 00:00:00 2001
+From: Florian Rivoal <frivoal@xfce.org>
+Date: Sat, 26 Feb 2011 13:53:09 +0000
+Subject: Add support for getting the temperature from sysfs
+
+Up to the linux kernel version 2.6.37, this information was available in
+the proc file system, but after that, it is only available from the sys
+file system.
+
+This fixes bug #7339.
+---
+diff --git a/panel-plugin/libacpi.c b/panel-plugin/libacpi.c
+index 838a760..0e368f4 100644
+--- a/panel-plugin/libacpi.c
++++ b/panel-plugin/libacpi.c
+@@ -1002,18 +1002,36 @@ const char *get_temperature(void)
+ #ifdef __linux__
+ FILE *fp;
+ char *proc_temperature="/proc/acpi/thermal_zone/*/temperature";
+- static char *p,line[256];
+-
+- if ( (fp=fopen_glob(proc_temperature, "r")) == NULL) return NULL;
+- fgets(line,255,fp);
+- fclose(fp);
+- p=strtok(line," ");
+- if (!p) return NULL;
+- p=p+strlen(p)+1;
+- while (p && *p ==' ') p++;
+- if (*p==0) return NULL;
+- if (strchr(p,'\n')) p=strtok(p,"\n");
+- return (const char *)p;
++ char *sys_temperature="/sys/class/thermal/thermal_zone*/temp";
++ static char *p,*p2,line[256];
++
++ if ( (fp=fopen_glob(proc_temperature, "r")) != NULL )
++ {
++ fgets(line,255,fp);
++ fclose(fp);
++ p=strtok(line," ");
++ if (!p) return NULL;
++ p=p+strlen(p)+1;
++ while (p && *p ==' ') p++;
++ if (*p==0) return NULL;
++ if (strchr(p,'\n')) p=strtok(p,"\n");
++ return (const char *)p;
++ }
++ else if ( (fp=fopen_glob(sys_temperature, "r")) != NULL )
++ {
++ fgets(line,255,fp);
++ fclose(fp);
++ p = line;
++ if (strchr(p,'\n')) *strchr(p,'\n') = 0;
++ if (strlen(p) <= 3) return NULL;
++ p2 = p + strlen(p) - 3;
++ strcpy(p2, " C");
++ return (const char *)p;
++ }
++ else
++ {
++ return NULL;
++ }
+ #else
+ #ifdef HAVE_SYSCTL
+ static char buf[BUFSIZ];
+--
+cgit v0.8.3.4