[mythtv] Proposed patch to mythfrontend/main.cpp
Jim Brunner
jim.brunner at comcast.net
Mon Feb 16 23:11:25 EST 2004
I wanted temperature info on the status screen (my TiVo does this).
This patch to mythfrontend/main.cpp will check for the existence of
mbmon. If available, it is run and the 1st two temperatures are
assumed to be the case temperature and CPU temperature respectively.
This works great on my machine but may not work the same way with other
motherboards. (I'm not really sure if this is a problem or not.)
This patch should have no impact if mbmon doesn't exist.
It would also be handy to have the status screen indicate if the
backend was up (and possibly its status [recording, idle, etc.]) But I
haven't tried to figure that out.
+++ main.cpp 2004-02-16 21:50:02.000000000 -0600
@@ -347,6 +347,30 @@
Status += QObject::tr("WARNING: is mythfilldatabase running?");
}
+ // Check if /usr/local/bin/mbmon is available for CPU temperature
+ int statrc;
+ struct stat statbuf;
+ statrc = stat("/usr/local/bin/mbmon", &statbuf);
+ if (statrc == 0) {
+ FILE *fd = popen("/usr/local/bin/mbmon -c1 -T4", "r");
+ if (fd != 0) {
+ char temp1[6], temp2[6];
+ fgets(temp1, 6, fd); //fmt= "37.0\n\0"
+ fgets(temp2, 6, fd);
+ pclose(fd);
+ temp1[4] = 0; // write over \n
+ temp2[4] = 0;
+
+ Status += "\n\n";
+ Status += "Case Temp = ";
+ Status += temp1;
+ Status += " ";
+ Status += "CPU Temp = ";
+ Status += temp2;
+ }
+ }
+
+
DialogBox *status_dialog = new
DialogBox(gContext->GetMainWindow(), Status);
status_dialog->AddButton(QObject::tr("OK"));
status_dialog->exec();
------------------------
Jim Brunner
More information about the mythtv-dev
mailing list