summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDX372019-04-07 16:36:04 +0700
committerDX372019-04-07 16:36:04 +0700
commitdc759365f88a8677225e36f158844f5c9034cdff (patch)
tree9239e55a590f4d959aa40bafde0ef672bc2d1d4d
parent2405f85af2e99177f124c6c174d6ba3690d6d52f (diff)
downloadaur-dc759365f88a8677225e36f158844f5c9034cdff.tar.gz
changes
- exclude i686, x86_64 targets - use of thermal_zone0 value instead of vcgencmd measure_temp output
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD8
-rw-r--r--htop-temperature-rpi.patch99
3 files changed, 51 insertions, 68 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ca55e17d749c..16b7f9009297 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,11 @@
pkgbase = htop-temperature-rpi
- pkgdesc = Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from vcgencmd
+ pkgdesc = Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from thermal_zone0
pkgver = 2.2.0
- pkgrel = 4
+ pkgrel = 5
url = http://hisham.hm/htop/
- arch = i686
- arch = x86_64
- arch = aarch64
- arch = armv7h
arch = armv6h
+ arch = armv7h
+ arch = aarch64
license = GPL
makedepends = python
depends = ncurses
@@ -21,7 +19,7 @@ pkgbase = htop-temperature-rpi
source = htop-temperature-rpi.patch
source = 0001-fix-option-string.patch
sha256sums = d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57
- sha256sums = 626f85b975a58aef9c6878f59fc7381824702bc4fafe4d3bffccd80b1ceb5a6a
+ sha256sums = 543ac03c0d8c33659dc06b18a5341ced4071a4f49e6e7430ba2c3e0112de0ef6
sha256sums = 343cfd8e01f2d47e54b38f725bb05a9825511b502acdb6803507e5fa4d52bed7
pkgname = htop-temperature-rpi
diff --git a/PKGBUILD b/PKGBUILD
index 666307046369..05ecc533f376 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,9 +3,9 @@
_pkgname=htop
pkgname=htop-temperature-rpi
pkgver=2.2.0
-pkgrel=4
-pkgdesc="Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from vcgencmd"
-arch=('i686' 'x86_64' 'aarch64' 'armv7h' 'armv6h')
+pkgrel=5
+pkgdesc="Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from thermal_zone0"
+arch=('armv6h' 'armv7h' 'aarch64')
url="http://hisham.hm/htop/"
license=('GPL')
depends=('ncurses' 'libnl')
@@ -19,7 +19,7 @@ source=("http://hisham.hm/$_pkgname/releases/$pkgver/$_pkgname-$pkgver.tar.gz"
"htop-temperature-rpi.patch"
"0001-fix-option-string.patch")
sha256sums=('d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57'
- '626f85b975a58aef9c6878f59fc7381824702bc4fafe4d3bffccd80b1ceb5a6a'
+ '543ac03c0d8c33659dc06b18a5341ced4071a4f49e6e7430ba2c3e0112de0ef6'
'343cfd8e01f2d47e54b38f725bb05a9825511b502acdb6803507e5fa4d52bed7')
prepare() {
diff --git a/htop-temperature-rpi.patch b/htop-temperature-rpi.patch
index 960cdca8c451..5bbd55c60719 100644
--- a/htop-temperature-rpi.patch
+++ b/htop-temperature-rpi.patch
@@ -1,8 +1,8 @@
diff --git a/CRT.c b/CRT.c
-index 0d51698..4eab74d 100644
+index ca9a10d..c4f1e50 100644
--- a/CRT.c
+++ b/CRT.c
-@@ -78,6 +78,9 @@ typedef enum ColorElements_ {
+@@ -88,6 +88,9 @@ typedef enum ColorElements_ {
UPTIME,
BATTERY,
TASKS_RUNNING,
@@ -12,7 +12,7 @@ index 0d51698..4eab74d 100644
SWAP,
PROCESS,
PROCESS_SHADOW,
-@@ -182,6 +185,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -192,6 +195,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
@@ -20,9 +20,9 @@ index 0d51698..4eab74d 100644
+ [TEMPERATURE_MEDIUM] = A_NORMAL | ColorPair(Yellow,Black),
+ [TEMPERATURE_HOT] = A_BOLD | ColorPair(Red,Black),
[PROCESS] = A_NORMAL,
- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black),
+ [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
-@@ -241,6 +247,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -251,6 +257,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = A_BOLD,
[LED_COLOR] = A_NORMAL,
[TASKS_RUNNING] = A_BOLD,
@@ -32,7 +32,7 @@ index 0d51698..4eab74d 100644
[PROCESS] = A_NORMAL,
[PROCESS_SHADOW] = A_DIM,
[PROCESS_TAG] = A_BOLD,
-@@ -300,6 +309,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -310,6 +319,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = ColorPair(Black,White),
[LED_COLOR] = ColorPair(Green,White),
[TASKS_RUNNING] = ColorPair(Green,White),
@@ -42,7 +42,7 @@ index 0d51698..4eab74d 100644
[PROCESS] = ColorPair(Black,White),
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White),
[PROCESS_TAG] = ColorPair(White,Blue),
-@@ -359,6 +371,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -369,6 +381,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = ColorPair(Black,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = ColorPair(Green,Black),
@@ -50,9 +50,9 @@ index 0d51698..4eab74d 100644
+ [TEMPERATURE_MEDIUM] = ColorPair(Yellow,Black),
+ [TEMPERATURE_HOT] = ColorPair(Red,Black),
[PROCESS] = ColorPair(Black,Black),
- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black),
+ [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
[PROCESS_TAG] = ColorPair(White,Blue),
-@@ -418,6 +433,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -428,6 +443,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue),
[LED_COLOR] = ColorPair(Green,Blue),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue),
@@ -62,7 +62,7 @@ index 0d51698..4eab74d 100644
[PROCESS] = ColorPair(White,Blue),
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Blue),
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Blue),
-@@ -477,6 +495,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
+@@ -487,6 +505,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE] = ColorPair(Green,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
@@ -70,13 +70,13 @@ index 0d51698..4eab74d 100644
+ [TEMPERATURE_MEDIUM] = A_NORMAL | ColorPair(Yellow,Black),
+ [TEMPERATURE_HOT] = A_BOLD | ColorPair(Red,Black),
[PROCESS] = ColorPair(Cyan,Black),
- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black),
+ [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
diff --git a/CRT.h b/CRT.h
-index fb82413..bda5318 100644
+index 933fe06..29ea885 100644
--- a/CRT.h
+++ b/CRT.h
-@@ -68,6 +68,9 @@ typedef enum ColorElements_ {
+@@ -76,6 +76,9 @@ typedef enum ColorElements_ {
UPTIME,
BATTERY,
TASKS_RUNNING,
@@ -86,12 +86,34 @@ index fb82413..bda5318 100644
SWAP,
PROCESS,
PROCESS_SHADOW,
+diff --git a/Makefile.am b/Makefile.am
+index 7d19600..faeb318 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -48,14 +48,15 @@ linux_platform_headers = \
+ linux/LinuxProcess.h \
+ linux/LinuxProcessList.h \
+ linux/LinuxCRT.h \
+- linux/Battery.h
++ linux/Battery.h \
++ TemperatureMeter.h
+
+ all_platform_headers += $(linux_platform_headers)
+
+ if HTOP_LINUX
+ AM_CFLAGS += -rdynamic
+ myhtopplatsources = linux/Platform.c linux/IOPriorityPanel.c linux/IOPriority.c \
+-linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c
++linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c TemperatureMeter.c
+
+ myhtopplatheaders = $(linux_platform_headers)
+ endif
diff --git a/TemperatureMeter.c b/TemperatureMeter.c
new file mode 100644
-index 0000000..9ee9185
+index 0000000..872b92c
--- /dev/null
+++ b/TemperatureMeter.c
-@@ -0,0 +1,100 @@
+@@ -0,0 +1,85 @@
+/*
+htop - TemperatureMeter.c
+(C) 2013 Ralf Stemmer
@@ -129,7 +151,7 @@ index 0000000..9ee9185
+
+static void TemperatureMeter_display(Object* cast, RichString* out) {
+ FILE *p;
-+ p = popen("/opt/vc/bin/vcgencmd measure_temp", "r");
++ p = popen("/usr/bin/cat /sys/class/thermal/thermal_zone0/temp", "r");
+ if(p == NULL) return 1;
+
+ int textColor = CRT_colors[METER_TEXT];
@@ -139,27 +161,12 @@ index 0000000..9ee9185
+
+ size_t read, len;
+ char *line = NULL;
-+ char *entry = NULL;
-+ char *tstart = NULL, *tend = NULL;
+ int temperature;
+ while ((read = getline(&line, &len, p)) != -1) {
-+ // contains this line a core-temperature?
-+ entry = strstr(line, "temp");
-+ if (entry == NULL) continue;
-+
-+ // find the begin of the temperature value
-+ tstart = strchr(entry, '='); // no negative temperatures expected :)
-+ if (tstart == NULL) continue;
-+ tstart++; // jump over the '+'
-+
-+ // find the end of the temperature. Remember, it can be above 99°C ;)
-+ tend = strchr(tstart, '.'); // just the integer
-+ if (tend == NULL) continue;
-+
+ // convert the string into an integer, this is necessary for further steps
-+ temperature = strtol(tstart, &tend, 10);
++ temperature = strtol(line, NULL, 10);
+ if (temperature == LONG_MAX || temperature == LONG_MIN) continue;
-+ if (tstart == tend) continue;
++ temperature /= 1000;
+
+ // choose the color for the temperature
+ int tempColor;
@@ -218,7 +225,7 @@ index 0000000..b86ddd8
+
+#endif
diff --git a/linux/Platform.c b/linux/Platform.c
-index de7bb84..a8e8a6f 100644
+index ab90ca7..c52ed3e 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -22,6 +22,7 @@ in the source distribution for its full text.
@@ -226,7 +233,7 @@ index de7bb84..a8e8a6f 100644
#include "HostnameMeter.h"
#include "LinuxProcess.h"
+#include "TemperatureMeter.h"
-
+
#include <math.h>
#include <assert.h>
@@ -116,6 +117,7 @@ MeterClass* Platform_meterTypes[] = {
@@ -237,25 +244,3 @@ index de7bb84..a8e8a6f 100644
&UptimeMeter_class,
&BatteryMeter_class,
&HostnameMeter_class,
-diff --git a/Makefile.am b/Makefile.am
-index cd5209c..c700e34 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -48,14 +48,15 @@ linux_platform_headers = \
- linux/LinuxProcess.h \
- linux/LinuxProcessList.h \
- linux/LinuxCRT.h \
-- linux/Battery.h
-+ linux/Battery.h \
-+ TemperatureMeter.h
-
- all_platform_headers += $(linux_platform_headers)
-
- if HTOP_LINUX
- AM_CFLAGS += -rdynamic
- myhtopplatsources = linux/Platform.c linux/IOPriorityPanel.c linux/IOPriority.c \
--linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c
-+linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c TemperatureMeter.c
-
- myhtopplatheaders = $(linux_platform_headers)
- endif