summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Side-by-side diff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp61
1 files changed, 58 insertions, 3 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index f808960..4b5a54e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -74,2 +74,3 @@ public:
uint m_holdtime;
+ QStrList *m_cpu_frequencies;
};
@@ -425,2 +426,3 @@ ODevice::ODevice ( )
d-> m_buttons = 0;
+ d-> m_cpu_frequencies = new QStrList;
}
@@ -775,2 +777,42 @@ int ODevice::lightSensorResolution ( ) const
/**
+ * @return a list with valid CPU frequency
+ */
+QStrList &ODevice::cpuFrequencies ( ) const
+{
+qWarning("ODevice::cpuFrequencies: m_cpu_frequencies is %d", (int) d->m_cpu_frequencies);
+ return *d->m_cpu_frequencies;
+}
+
+
+/**
+ * Set desired cpu frequency
+ *
+ * @param index index into d->m_cpu_frequencies of the frequency to be set
+ */
+bool ODevice::setCpuFrequency(uint index)
+{
+ if (index >= d->m_cpu_frequencies->count())
+ return false;
+
+ char *freq = d->m_cpu_frequencies->at(index);
+ qWarning("set freq to %s", freq);
+
+ //TODO: do the change in /proc/sys/cpu/0/speed
+
+ return false;
+}
+
+/**
+ * Returns current frequency index out of d->m_cpu_frequencies
+ */
+uint ODevice::cpuFrequency() const
+{
+ // TODO: get freq from /proc/sys/cpu/0/speed and return index
+
+ return 0;
+}
+
+
+
+/**
* @return a list of hardware buttons
@@ -1952,2 +1994,7 @@ void Ramses::init()
+qWarning("adding freq");
+ d->m_cpu_frequencies->append("100");
+ d->m_cpu_frequencies->append("200");
+ d->m_cpu_frequencies->append("300");
+ d->m_cpu_frequencies->append("400");
}
@@ -2012,2 +2059,3 @@ bool Ramses::suspend ( )
qDebug("Ramses::suspend");
+ return false;
}
@@ -2050,4 +2098,13 @@ bool Ramses::setDisplayBrightness(int bright)
bright = 0;
- bright = 500-(bright * 500 / 255);
+ // Turn backlight completely off
+ if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) {
+ char writeCommand[10];
+ const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0);
+ res = (::write(fd, writeCommand, count) != -1);
+ ::close(fd);
+ }
+
+ // scale backlight brightness to hardware
+ bright = 500-(bright * 500 / 255);
if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
@@ -2058,4 +2115,2 @@ bool Ramses::setDisplayBrightness(int bright)
::close(fd);
- } else {
- qWarning("no write");
}