PKGBUILDs/extra/mythtv/mythtv-0.20.2.20071129-lm_sensors-3-fix.patch
2009-10-09 21:23:22 -05:00

113 lines
4.6 KiB
Diff

diff -urN mythtv/programs/mythbackend/httpstatus.cpp mythtv-fixed/programs/mythbackend/httpstatus.cpp
--- mythtv/programs/mythbackend/httpstatus.cpp 2007-08-23 12:09:51.000000000 -0400
+++ mythtv-fixed/programs/mythbackend/httpstatus.cpp 2007-11-29 23:05:44.000000000 -0500
@@ -4,7 +4,7 @@
// Purpose - Html & XML status HttpServerExtension
//
// Created By : David Blain Created On : Oct. 24, 2005
-// Modified By : Modified On:
+// Modified By : Stephen Lewis Modified On: Nov. 27, 2007
//
//////////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,9 @@
#ifdef HAVE_LMSENSORS
#define LMSENSOR_DEFAULT_CONFIG_FILE "/etc/sensors.conf"
#include <sensors/sensors.h>
+#if ( SENSORS_API_VERSION < 0x400 )
#include <sensors/chips.h>
+#endif
#endif
/////////////////////////////////////////////////////////////////////////////
@@ -428,6 +430,7 @@
}
#ifdef HAVE_LMSENSORS
+#if ( SENSORS_API_VERSION < 0x400 ) // Use old SENSORS_API
m_settingLock.lock();
if (!found_acpi)
@@ -464,6 +467,46 @@
sensors_cleanup();
}
m_settingLock.unlock();
+#else // Use New SENSORS_API
+ m_settingLock.lock();
+
+ if (!found_acpi)
+ {
+ int chip_nr, a, b;
+ char *label = NULL;
+ double value;
+ const sensors_chip_name *chip;
+ const sensors_feature *data;
+ const sensors_subfeature *sdata;
+ char* lmsensorConfigName = LMSENSOR_DEFAULT_CONFIG_FILE;
+ a = b = 0;
+ FILE *lmsensorConfigFile = fopen(lmsensorConfigName, "r");
+ sensors_init(lmsensorConfigFile);
+ fclose(lmsensorConfigFile);
+ for (chip_nr = 0 ; (chip = sensors_get_detected_chips(NULL, &chip_nr)) ; )
+ {
+ while ((data = sensors_get_features(chip, &a)))
+ {
+ if (data->type == SENSORS_FEATURE_TEMP)
+ {
+ while ((sdata = sensors_get_all_subfeatures(chip, data, &b)))
+ {
+ if (sdata->type == SENSORS_SUBFEATURE_TEMP_INPUT)
+ {
+ sensors_get_value(chip, sdata->number, &value);
+ QString temp = QString("%1").arg(value);
+ temp += " &#8451;";
+ mInfo.appendChild(thermal);
+ thermal.setAttribute("temperature", temp);
+ }
+ }
+ }
+ }
+ }
+ sensors_cleanup();
+ }
+ m_settingLock.unlock();
+#endif // ( SENSORS_API_VERSION < 0x400 )
#endif
// Guide Data ---------------------
diff -urN mythtv/programs/mythbackend/mainserver.cpp mythtv-fixed/programs/mythbackend/mainserver.cpp
--- mythtv/programs/mythbackend/mainserver.cpp 2007-08-27 21:22:44.000000000 -0400
+++ mythtv-fixed/programs/mythbackend/mainserver.cpp 2007-11-29 23:09:24.000000000 -0500
@@ -47,8 +47,10 @@
#ifdef HAVE_LMSENSORS
#define LMSENSOR_DEFAULT_CONFIG_FILE "/etc/sensors.conf"
#include <sensors/sensors.h>
+#if ( SENSORS_API_VERSION < 0x400 )
#include <sensors/chips.h>
#endif
+#endif
/** Milliseconds to wait for an existing thread from
diff -urN mythtv/programs/mythbackend/mythxml.cpp mythtv-fixed/programs/mythbackend/mythxml.cpp
--- mythtv/programs/mythbackend/mythxml.cpp 2007-08-23 12:09:51.000000000 -0400
+++ mythtv-fixed/programs/mythbackend/mythxml.cpp 2007-11-29 23:07:07.000000000 -0500
@@ -4,7 +4,7 @@
// Purpose - Html & XML status HttpServerExtension
//
// Created By : David Blain Created On : Oct. 24, 2005
-// Modified By : Modified On:
+// Modified By : Stephen Lewis Modified On: Nov. 27, 2007
//
//////////////////////////////////////////////////////////////////////////////
@@ -25,7 +25,9 @@
#ifdef HAVE_LMSENSORS
#define LMSENSOR_DEFAULT_CONFIG_FILE "/etc/sensors.conf"
#include <sensors/sensors.h>
+#if ( SENSORS_API_VERSION < 0x400 )
#include <sensors/chips.h>
+#endif
#endif
/////////////////////////////////////////////////////////////////////////////