}
+/**
+ * Returns the name of the current CPU frequency scaling governor
+ *
+ * \return name of governor
+ */
QString MainWindow::getScalingGovernor()
{
return readSysFile( "devices/system/cpu/cpu0/cpufreq/scaling_governor" );
}
+
/**
* Returns the amount of available scaling steps.
*/
return 1;
}
+
+/**
+ * Returns the SmartReflex(tm) state
+ *
+ * \return 0|1
+ */
+int MainWindow::getSmartReflexState()
+{
+//SmartReflex is only supprted on Maemo5
+#if defined(Q_WS_MAEMO_5)
+ QString tmp1 = readSysFile( "power/sr_vdd1_autocomp" );
+ QString tmp2 = readSysFile( "power/sr_vdd2_autocomp" );
+
+ if ( tmp1 == "1" && tmp2 == "1" )
+ return 1;
+ else
+ return 0;
+#else
+ return 0;
+#endif
+}
+
+
+/**
+ * Reads any file in /sys/
+ *
+ * \param sys_file : full path to sys file - omit "/sys/"
+ * \return content of sys file
+ */
QString MainWindow::readSysFile(QString sys_file)
{
QFile file( "/sys/"+sys_file );
//display the current governor
ui->freq_governor->setText( getScalingGovernor() );
- //display.setNum( getScalingFreq(1) );
- //ui->freq_max->setText( display );
+ //smart reflex button
+ if ( getSmartReflexState() == 1 ) {
+ ui->sr_btn->setDown( true );
+ ui->sr_btn->setText( tr( "Enabled" ) );
+ } else {
+ ui->sr_btn->setDown( false );
+ ui->sr_btn->setText( tr( "Disabled" ) );
+ }
+
+
+ //display frequency slider
ui->freq_adjust->setMinimum( 1 );
ui->freq_adjust->setMaximum( getScalingSteps() );
ui->freq_adjust->setInvertedAppearance( true );
QString getScalingGovernor();
int getScalingStep( int freq );
int getScalingSteps();
+ int getSmartReflexState();
QString readSysFile( QString sys_file );
//! the QGraphicsScene will contain the large chip icon displayed in the UI
QGraphicsScene *scene;
<property name="windowTitle">
<string>QCPUFreq</string>
</property>
+ <property name="windowIcon">
+ <iconset>
+ <normaloff>data/64x64/qcpufreq.png</normaloff>data/64x64/qcpufreq.png</iconset>
+ </property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>