summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp49
-rw-r--r--libopie/odevice.h2
2 files changed, 30 insertions, 21 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 4b5a54e..4c33a0e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -779,7 +779,6 @@ int ODevice::lightSensorResolution ( ) const
779 */ 779 */
780QStrList &ODevice::cpuFrequencies ( ) const 780QStrList &ODevice::cpuFrequencies ( ) const
781{ 781{
782qWarning("ODevice::cpuFrequencies: m_cpu_frequencies is %d", (int) d->m_cpu_frequencies);
783 return *d->m_cpu_frequencies; 782 return *d->m_cpu_frequencies;
784} 783}
785 784
@@ -797,23 +796,20 @@ bool ODevice::setCpuFrequency(uint index)
797 char *freq = d->m_cpu_frequencies->at(index); 796 char *freq = d->m_cpu_frequencies->at(index);
798 qWarning("set freq to %s", freq); 797 qWarning("set freq to %s", freq);
799 798
800 //TODO: do the change in /proc/sys/cpu/0/speed 799 int fd;
801
802 return false;
803}
804 800
805/** 801 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
806 * Returns current frequency index out of d->m_cpu_frequencies 802 char writeCommand[50];
807 */ 803 const int count = sprintf(writeCommand, "%s\n", freq);
808uint ODevice::cpuFrequency() const 804 int res = (::write(fd, writeCommand, count) != -1);
809{ 805 ::close(fd);
810 // TODO: get freq from /proc/sys/cpu/0/speed and return index 806 return res;
807 }
811 808
812 return 0; 809 return false;
813} 810}
814 811
815 812
816
817/** 813/**
818 * @return a list of hardware buttons 814 * @return a list of hardware buttons
819 */ 815 */
@@ -1992,11 +1988,26 @@ void Ramses::init()
1992 1988
1993 m_power_timer = 0; 1989 m_power_timer = 0;
1994 1990
1995qWarning("adding freq"); 1991#ifdef QT_QWS_ALLOW_OVERCLOCK
1996 d->m_cpu_frequencies->append("100"); 1992#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
1997 d->m_cpu_frequencies->append("200"); 1993#define OC(x...) x
1998 d->m_cpu_frequencies->append("300"); 1994#else
1999 d->m_cpu_frequencies->append("400"); 1995#define OC(x...)
1996#endif
1997
1998
1999 // This table is true for a Intel XScale PXA 255
2000
2001 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
2002 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
2003 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
2004 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
2005 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
2006 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
2007 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
2008 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
2009 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
2010
2000} 2011}
2001 2012
2002bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) 2013bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat)
@@ -2144,8 +2155,6 @@ bool Ramses::setDisplayContrast(int contr)
2144 res = (::write(fd, writeCommand, count) != -1); 2155 res = (::write(fd, writeCommand, count) != -1);
2145 res = true; 2156 res = true;
2146 ::close(fd); 2157 ::close(fd);
2147 } else {
2148 qWarning("no write");
2149 } 2158 }
2150 return res; 2159 return res;
2151} 2160}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 7f6f856..18ff5f1 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -200,7 +200,7 @@ public:
200 200
201 QStrList &cpuFrequencies() const; 201 QStrList &cpuFrequencies() const;
202 bool setCpuFrequency(uint index); 202 bool setCpuFrequency(uint index);
203 uint cpuFrequency() const; 203 int cpuFrequency() const;
204 204
205 /** 205 /**
206 * Returns the available buttons on this device. The number and location 206 * Returns the available buttons on this device. The number and location