Hey there,

Just completed installing and configuring MythTV. It's a great program!

I installed MythWeb and noticed the 'Backend status' menuitem. I created a 
small addition, to show the ACPI CPU temperature 
("/proc/acpi/thermal_zone/THRM/temperature") under 'Machine information'.

The attached patch is against mythtv-0.18.1 (the last version included in 
Gentoo), but should be easily appliable to other versions.

It'd be nice to see it included in the main distribution. Thanks in advance!
-- 
A Dieu,
 Robert Zwerus - WWW: http://zwering.adsl.utwente.nl
 ICQ UIN: 3943443 - MSN: [EMAIL PROTECTED]
 Currently playing: Elliott Smith - Independence Day
diff -uprN mythtv-0.18.1/programs/mythbackend/httpstatus.cpp mythtv-0.18.1-temperature/programs/mythbackend/httpstatus.cpp
--- mythtv-0.18.1/programs/mythbackend/httpstatus.cpp	2005-04-20 08:35:54.000000000 +0200
+++ mythtv-0.18.1-temperature/programs/mythbackend/httpstatus.cpp	2006-01-14 01:18:05.000000000 +0100
@@ -702,6 +702,24 @@ int HttpStatus::PrintMachineInfo( QTextS
                << "    </div>\r\n";    
         }
     }
+    
+    // ACPI temperature ---------------------
+
+    node = info.namedItem( "Thermal" );
+
+    if (!node.isNull())
+    {    
+        QDomElement e = node.toElement();
+
+        if (!e.isNull())
+        {
+		std::string temperature = e.attribute( "temperature" , "0" );
+
+            os << "      Current CPU temperature: " 
+	       << temperature
+               << ".<br />\r\n";
+        }
+    }
 
     // Guide Info ---------------------
 
diff -uprN mythtv-0.18.1/programs/mythbackend/mainserver.cpp mythtv-0.18.1-temperature/programs/mythbackend/mainserver.cpp
--- mythtv-0.18.1/programs/mythbackend/mainserver.cpp	2005-04-13 23:04:28.000000000 +0200
+++ mythtv-0.18.1-temperature/programs/mythbackend/mainserver.cpp	2006-01-14 01:13:57.000000000 +0100
@@ -16,6 +16,7 @@
 
 #include <list>
 #include <iostream>
+#include <fstream>
 using namespace std;
 
 #include <sys/stat.h>
@@ -3380,11 +3381,13 @@ void MainServer::FillStatusXML( QDomDocu
     QDomElement mInfo   = pDoc->createElement("MachineInfo");
     QDomElement storage = pDoc->createElement("Storage"    );
     QDomElement load    = pDoc->createElement("Load"       );
+    QDomElement thermal = pDoc->createElement("Thermal"    );
     QDomElement guide   = pDoc->createElement("Guide"      );
 
     root.appendChild (mInfo  );
     mInfo.appendChild(storage);
     mInfo.appendChild(load   );
+    mInfo.appendChild(thermal);
     mInfo.appendChild(guide  );
 
     // drive space   ---------------------
@@ -3408,6 +3411,19 @@ void MainServer::FillStatusXML( QDomDocu
         load.setAttribute("avg3", rgdAverages[2]);
     }
 
+    // ACPI temperature ---------------------
+    ifstream inp("/proc/acpi/thermal_zone/THRM/temperature");
+    std::string msg, temperature;
+
+    if(inp) {
+        inp >> msg >> temperature;
+	temperature += " degrees Celsius";
+    }
+    else
+        temperature = "unknown";
+
+    thermal.setAttribute("temperature", temperature);
+
     // Guide Data ---------------------
 
     QDateTime GuideDataThrough;
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to