-rw-r--r-- | libopie/odevice.cpp | 47 | ||||
-rw-r--r-- | libopie/odevice.h | 2 |
2 files changed, 29 insertions, 20 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 4b5a54e..4c33a0e 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -776,13 +776,12 @@ int ODevice::lightSensorResolution ( ) const | |||
776 | 776 | ||
777 | /** | 777 | /** |
778 | * @return a list with valid CPU frequency | 778 | * @return a list with valid CPU frequency |
779 | */ | 779 | */ |
780 | QStrList &ODevice::cpuFrequencies ( ) const | 780 | QStrList &ODevice::cpuFrequencies ( ) const |
781 | { | 781 | { |
782 | qWarning("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 | ||
786 | 785 | ||
787 | /** | 786 | /** |
788 | * Set desired cpu frequency | 787 | * Set desired cpu frequency |
@@ -794,29 +793,26 @@ bool ODevice::setCpuFrequency(uint index) | |||
794 | if (index >= d->m_cpu_frequencies->count()) | 793 | if (index >= d->m_cpu_frequencies->count()) |
795 | return false; | 794 | return false; |
796 | 795 | ||
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 | 800 | ||
802 | return false; | 801 | if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { |
802 | char writeCommand[50]; | ||
803 | const int count = sprintf(writeCommand, "%s\n", freq); | ||
804 | int res = (::write(fd, writeCommand, count) != -1); | ||
805 | ::close(fd); | ||
806 | return res; | ||
803 | } | 807 | } |
804 | 808 | ||
805 | /** | 809 | return false; |
806 | * Returns current frequency index out of d->m_cpu_frequencies | ||
807 | */ | ||
808 | uint ODevice::cpuFrequency() const | ||
809 | { | ||
810 | // TODO: get freq from /proc/sys/cpu/0/speed and return index | ||
811 | |||
812 | return 0; | ||
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 | */ |
820 | const QValueList <ODeviceButton> &ODevice::buttons ( ) | 816 | const QValueList <ODeviceButton> &ODevice::buttons ( ) |
821 | { | 817 | { |
822 | initButtons ( ); | 818 | initButtons ( ); |
@@ -1989,17 +1985,32 @@ void Ramses::init() | |||
1989 | d->m_sysverstr = ts.readLine(); | 1985 | d->m_sysverstr = ts.readLine(); |
1990 | f.close(); | 1986 | f.close(); |
1991 | } | 1987 | } |
1992 | 1988 | ||
1993 | m_power_timer = 0; | 1989 | m_power_timer = 0; |
1994 | 1990 | ||
1995 | qWarning("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 | ||
2002 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) | 2013 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) |
2003 | { | 2014 | { |
2004 | Q_UNUSED( keycode ); | 2015 | Q_UNUSED( keycode ); |
2005 | Q_UNUSED( modifiers ); | 2016 | Q_UNUSED( modifiers ); |
@@ -2141,14 +2152,12 @@ bool Ramses::setDisplayContrast(int contr) | |||
2141 | qDebug(" %d -> pwm0", contr); | 2152 | qDebug(" %d -> pwm0", contr); |
2142 | char writeCommand[100]; | 2153 | char writeCommand[100]; |
2143 | const int count = sprintf(writeCommand, "%d\n", contr); | 2154 | const int count = sprintf(writeCommand, "%d\n", 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 | } |
2152 | 2161 | ||
2153 | 2162 | ||
2154 | int Ramses::displayContrastResolution() const | 2163 | int Ramses::displayContrastResolution() const |
diff --git a/libopie/odevice.h b/libopie/odevice.h index 7f6f856..18ff5f1 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -197,13 +197,13 @@ public: | |||
197 | virtual bool hasLightSensor ( ) const; | 197 | virtual bool hasLightSensor ( ) const; |
198 | virtual int readLightSensor ( ); | 198 | virtual int readLightSensor ( ); |
199 | virtual int lightSensorResolution ( ) const; | 199 | virtual int lightSensorResolution ( ) const; |
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 |
207 | * of buttons will vary depending on the device. Button numbers will be assigned | 207 | * of buttons will vary depending on the device. Button numbers will be assigned |
208 | * by the device manufacturer and will be from most preferred button to least preffered | 208 | * by the device manufacturer and will be from most preferred button to least preffered |
209 | * button. Note that this list only contains "user mappable" buttons. | 209 | * button. Note that this list only contains "user mappable" buttons. |