Ticket #1027: mythtv-showacpitemperature-revised.patch

File mythtv-showacpitemperature-revised.patch, 1.8 KB (added by arzie@…, 19 years ago)

Revised version

  • mainserver.cpp

     
    38563856    QDomElement mInfo   = pDoc->createElement("MachineInfo");
    38573857    QDomElement storage = pDoc->createElement("Storage"    );
    38583858    QDomElement load    = pDoc->createElement("Load"       );
     3859    QDomElement thermal = pDoc->createElement("Thermal"    );
    38593860    QDomElement guide   = pDoc->createElement("Guide"      );
    38603861
    38613862    root.appendChild (mInfo  );
     
    38843885        load.setAttribute("avg3", rgdAverages[2]);
    38853886    }
    38863887
     3888    // ACPI temperature -----------------
     3889    ifstream inp("/proc/acpi/thermal_zone/THRM/temperature");
     3890    std::string msg, temperature;
     3891
     3892    if(inp) {
     3893        inp >> msg >> temperature;
     3894        if(inp) {
     3895            temperature += " degrees Celsius";
     3896
     3897            // only add element if temperature could be read
     3898            mInfo.appendChild(thermal);
     3899            thermal.setAttribute("temperature", temperature);
     3900        }
     3901    }
     3902       
    38873903    // Guide Data ---------------------
    38883904
    38893905    QDateTime GuideDataThrough;
  • httpstatus.cpp

     
    697697        }
    698698    }
    699699
     700   // ACPI temperature ------------------
     701
     702    node = info.namedItem( "Thermal" );
     703
     704    if (!node.isNull())
     705    {
     706        QDomElement e = node.toElement();
     707
     708        if (!e.isNull())
     709        {
     710            std::string temperature = e.attribute( "temperature" , "0" );
     711
     712            os << "      Current CPU temperature: "
     713               << temperature
     714               << ".<br />\r\n";
     715        }
     716    }
     717       
    700718    // Guide Info ---------------------
    701719
    702720    node = info.namedItem( "Guide" );