diff options
author | ume <ume@FreeBSD.org> | 2007-12-25 23:22:21 +0800 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2007-12-25 23:22:21 +0800 |
commit | 1aed465f9533872f508686932f7089b6b8cca5a8 (patch) | |
tree | d6872332f1c4346c1a2d6ef2eb5baab9711b5319 /sysutils | |
parent | 91581c40cb0089bb52107db762b5efe1dffd6ce4 (diff) | |
download | freebsd-ports-gnome-1aed465f9533872f508686932f7089b6b8cca5a8.tar.gz freebsd-ports-gnome-1aed465f9533872f508686932f7089b6b8cca5a8.tar.zst freebsd-ports-gnome-1aed465f9533872f508686932f7089b6b8cca5a8.zip |
- Adds support for the coretemp(4) sensor
- Fixes a bug causing only one instance of a sensor type to be added
PR: ports/118916
Submitted by: Pietro Cerutti <gahr_at_gahr.ch> with modification
Tested by: TAKANO Yuji <takachan_at_icmpv6.org>
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/gkrellm2/Makefile | 2 | ||||
-rw-r--r-- | sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c | 102 |
2 files changed, 103 insertions, 1 deletions
diff --git a/sysutils/gkrellm2/Makefile b/sysutils/gkrellm2/Makefile index 08023115d60d..8e5e2fe04be2 100644 --- a/sysutils/gkrellm2/Makefile +++ b/sysutils/gkrellm2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gkrellm PORTVERSION= 2.3.0 -#PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= sysutils ipv6 MASTER_SITES= http://members.dslextreme.com/users/billw/gkrellm/ \ ${MASTER_SITE_LOCAL} diff --git a/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c new file mode 100644 index 000000000000..546f23af699e --- /dev/null +++ b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c @@ -0,0 +1,102 @@ +Index: src/sysdeps/freebsd.c +diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c +--- src/sysdeps/freebsd.c.orig 2007-07-07 08:53:07.000000000 +0900 ++++ src/sysdeps/freebsd.c 2007-12-24 20:26:19.000000000 +0900 +@@ -1286,6 +1286,7 @@ static VoltDefault voltdefault0[] = + #define INTERFACE_IO 0 + #define INTERFACE_SMB 1 + #define INTERFACE_ACPI 2 ++#define INTERFACE_CORETEMP 3 /* Already in Celsius */ + + /* Addresses to use for /dev/io */ + #define WBIO1 0x295 +@@ -1345,6 +1346,8 @@ gkrellm_sys_sensors_get_temperature(gcha + + { + u_char byte; ++ int value; ++ size_t size; + + if (interface == MBMON_INTERFACE) + { +@@ -1354,15 +1357,24 @@ gkrellm_sys_sensors_get_temperature(gcha + + if (interface == INTERFACE_ACPI) + { +- int value; +- size_t size = sizeof(value); +- ++ size = sizeof(value); + if (sysctlbyname(path, &value, &size, NULL, 0) < 0) + return FALSE; + if (temp) + *temp = (gfloat) TZ_KELVTOC(value); + return TRUE; + } ++ ++ if (interface == INTERFACE_CORETEMP) ++ { ++ size = sizeof(value); ++ if (sysctlbyname(path, &value, &size, NULL, 0) < 0) ++ return FALSE; ++ if (temp) ++ *temp = (gfloat) value; ++ return TRUE; ++ } ++ + if (get_data(iodev, LM78_TEMP, interface, &byte)) + { + if (temp) +@@ -1435,7 +1447,7 @@ gkrellm_sys_sensors_init(void) + gchar mib_name[256], label[8]; + gint interface, id; + int oid_acpi_temp[CTL_MAXNAME + 2]; +- size_t oid_acpi_temp_len = sizeof(oid_acpi_temp); ++ size_t oid_acpi_temp_len; + GList *list; + struct freebsd_sensor *sensor; + +@@ -1443,10 +1455,12 @@ gkrellm_sys_sensors_init(void) + */ + gkrellm_sys_sensors_mbmon_check(TRUE); + +- for (id = 0;;) +- { ++ /* ACPI Thermal */ ++ for (id = 0;; id++) ++ { + snprintf(mib_name, sizeof(mib_name), + "hw.acpi.thermal.tz%d.temperature", id); ++ oid_acpi_temp_len = sizeof(oid_acpi_temp); + if (gk_sysctlnametomib(mib_name, oid_acpi_temp, + &oid_acpi_temp_len) < 0) + break; +@@ -1458,7 +1472,27 @@ gkrellm_sys_sensors_init(void) + gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE, NULL, + mib_name, 0, 0, + interface, 1.0, 0.0, NULL, label); +- } ++ } ++ ++ /* Coretemp */ ++ for (id = 0;; id++) ++ { ++ snprintf(mib_name, sizeof(mib_name), ++ "dev.cpu.%d.temperature", id); ++ oid_acpi_temp_len = sizeof(oid_acpi_temp); ++ if (gk_sysctlnametomib(mib_name, oid_acpi_temp, ++ &oid_acpi_temp_len) < 0) ++ break; ++ interface = INTERFACE_CORETEMP; ++ if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0, ++ interface, NULL)) ++ continue; ++ snprintf(label, sizeof(label), "cpu%d", id); ++ gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE, NULL, ++ mib_name, 0, 0, ++ interface, 1.0, 0.0, NULL, label); ++ } ++ + + if (freebsd_sensor_list) + { |