summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-04 01:18:27 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-04 01:18:27 -0500
commit10070eb92e8247688779852d7214771b9dcdda13 (patch)
tree88a2dfe4153ea7e9f64762a855d38e85605b1d4c
parent7fd6a1177d23500eabdf1ea077b2b29b8e9c85bc (diff)
downloadtdelibs-10070eb92e8247688779852d7214771b9dcdda13.tar.gz
tdelibs-10070eb92e8247688779852d7214771b9dcdda13.zip
Detect CPU information when cpufreq only partially implemented
Classify additional SPI devices
-rw-r--r--tdecore/tdehardwaredevices.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index bfb6b694d..2e6ebf68d 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -2059,6 +2059,7 @@ void TDEHardwareDevices::processModifiedCPUs() {
TDECPUDevice *cdevice;
cdevice = 0;
bool modified = false;
+ bool have_frequency = false;
TQString curline;
int processorNumber = 0;
@@ -2091,6 +2092,7 @@ void TDEHardwareDevices::processModifiedCPUs() {
if (cdevice) {
if (cdevice->frequency() != curline.toDouble()) modified = true;
cdevice->internalSetFrequency(curline.toDouble());
+ have_frequency = true;
}
}
if (curline.startsWith("vendor_id")) {
@@ -2234,6 +2236,43 @@ void TDEHardwareDevices::processModifiedCPUs() {
governorlist = TQStringList::split(" ", stream.readLine());
availgvrnsfile.close();
}
+
+ if (!have_frequency) {
+ nodename = cpufreq_dir.path();
+ nodename.append("/cpuinfo_cur_freq");
+ TQFile cpufreqfile(nodename);
+ if (cpufreqfile.open(IO_ReadOnly)) {
+ TQTextStream stream( &cpufreqfile );
+ if (cdevice) cdevice->internalSetFrequency(stream.readLine().toDouble()/1000.0);
+ cpufreqfile.close();
+ have_frequency = true;
+ }
+ }
+
+ bool frequencyFound;
+ TQStringList::Iterator freqit;
+ frequencyFound = false;
+ for ( freqit = frequencylist.begin(); freqit != frequencylist.end(); ++freqit ) {
+ double thisfrequency = (*freqit).toDouble()/1000.0;
+ if (thisfrequency == minfrequency) {
+ frequencyFound = true;
+ }
+ }
+ if (!frequencyFound) {
+ int minFrequencyInt = (minfrequency*1000.0);
+ frequencylist.prepend(TQString("%1").arg(minFrequencyInt));
+ }
+ frequencyFound = false;
+ for ( freqit = frequencylist.begin(); freqit != frequencylist.end(); ++freqit ) {
+ double thisfrequency = (*freqit).toDouble()/1000.0;
+ if (thisfrequency == maxfrequency) {
+ frequencyFound = true;
+ }
+ }
+ if (!frequencyFound) {
+ int maxfrequencyInt = (maxfrequency*1000.0);
+ frequencylist.append(TQString("%1").arg(maxfrequencyInt));
+ }
}
// Update CPU information structure
@@ -3196,6 +3235,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|| (devicesubsystem == "spidev")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Serial);
}
+ else if (devicesubsystem == "spi") {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
+ }
else if (devicesubsystem == "thermal") {
// FIXME
// Figure out a way to differentiate between ThermalControl (fans and coolers) and ThermalSensor types