author | schurig <schurig> | 2004-09-09 10:19:13 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-09 10:19:13 (UTC) |
commit | b3259d2dcf3599828a4eaa0d8de8148ca1839aef (patch) (unidiff) | |
tree | 5a5395da0f2476e6fec73abd1d4a953517d4e1d9 /libopie2/opiecore/device/odevice_ramses.cpp | |
parent | 57549dc20fdaf0c5d7784d2adbbbdc8dfebb70fa (diff) | |
download | opie-b3259d2dcf3599828a4eaa0d8de8148ca1839aef.zip opie-b3259d2dcf3599828a4eaa0d8de8148ca1839aef.tar.gz opie-b3259d2dcf3599828a4eaa0d8de8148ca1839aef.tar.bz2 |
updates to MNCI
Diffstat (limited to 'libopie2/opiecore/device/odevice_ramses.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.cpp | 158 |
1 files changed, 31 insertions, 127 deletions
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index 7db2af1..0cddf85 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp | |||
@@ -57,16 +57,4 @@ using namespace Opie::Core; | |||
57 | using namespace Opie::Core::Internal; | 57 | using namespace Opie::Core::Internal; |
58 | 58 | ||
59 | struct r_button ramses_buttons [] = { | ||
60 | { Model_Ramses_MNCI, | ||
61 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
62 | "devicebuttons/z_menu", | ||
63 | "QPE/TaskBar", "toggleMenu()", | ||
64 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
65 | { Model_Ramses_MNCI, | ||
66 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
67 | "devicebuttons/ipaq_home", | ||
68 | "QPE/Launcher", "home()", | ||
69 | "buttonsettings", "raise()" }, | ||
70 | }; | ||
71 | 59 | ||
72 | void Ramses::init(const QString&) | 60 | void Ramses::init(const QString&) |
@@ -75,18 +63,20 @@ void Ramses::init(const QString&) | |||
75 | d->m_vendor = Vendor_MundN; | 63 | d->m_vendor = Vendor_MundN; |
76 | 64 | ||
77 | QFile f("/proc/sys/board/ramses"); | 65 | // with old Prototype-LCD, /proc/sys/board/lcd_type = 1 |
66 | //d->m_modelstr = "Ramses"; | ||
67 | //d->m_model = Model_Ramses_MNCI; | ||
68 | //d->m_rotation = Rot0; | ||
78 | 69 | ||
79 | d->m_modelstr = "Ramses"; | 70 | // all current Hardware, with /proc/sys/board/lcd_type = 2 |
80 | d->m_model = Model_Ramses_MNCI; | 71 | d->m_modelstr = "MNCIRX"; |
72 | d->m_model = Model_Ramses_MNCIRX; | ||
73 | d->m_rotation = Rot90; | ||
81 | 74 | ||
82 | d->m_rotation = Rot0; | 75 | d->m_holdtime = 500; |
83 | d->m_holdtime = 1000; | ||
84 | 76 | ||
85 | // Distribution detection code now in the base class | ||
86 | 77 | ||
87 | m_power_timer = 0; | 78 | // This table is true for a Intel XScale PXA 255 |
88 | 79 | ||
89 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 80 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
90 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** | ||
91 | #define OC(x...) x | 81 | #define OC(x...) x |
92 | #else | 82 | #else |
@@ -94,6 +84,4 @@ void Ramses::init(const QString&) | |||
94 | #endif | 84 | #endif |
95 | 85 | ||
96 | // This table is true for a Intel XScale PXA 255 | ||
97 | |||
98 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 | 86 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 |
99 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem | 87 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem |
@@ -105,95 +93,43 @@ OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, P | |||
105 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 | 93 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 |
106 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus | 94 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus |
107 | |||
108 | } | ||
109 | |||
110 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) | ||
111 | { | ||
112 | Q_UNUSED( keycode ); | ||
113 | Q_UNUSED( modifiers ); | ||
114 | Q_UNUSED( isPress ); | ||
115 | Q_UNUSED( autoRepeat ); | ||
116 | return false; | ||
117 | } | ||
118 | |||
119 | void Ramses::timerEvent(QTimerEvent *) | ||
120 | { | ||
121 | killTimer(m_power_timer); | ||
122 | m_power_timer = 0; | ||
123 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); | ||
124 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); | ||
125 | } | 95 | } |
126 | 96 | ||
127 | 97 | ||
128 | bool Ramses::setSoftSuspend(bool soft) | 98 | void Ramses::playAlarmSound() |
129 | { | 99 | { |
130 | qDebug("Ramses::setSoftSuspend(%d)", soft); | 100 | #ifndef QT_NO_SOUND |
131 | #if 0 | 101 | static Sound snd ( "alarm" ); |
132 | bool res = false; | ||
133 | int fd; | ||
134 | |||
135 | if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || | ||
136 | ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { | ||
137 | |||
138 | int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources | ||
139 | |||
140 | if (sources >= 0) { | ||
141 | if (soft) | ||
142 | sources &= ~APM_EVT_POWER_BUTTON; | ||
143 | else | ||
144 | sources |= APM_EVT_POWER_BUTTON; | ||
145 | |||
146 | if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources | ||
147 | res = true; | ||
148 | else | ||
149 | perror("APM_IOCGEVTSRC"); | ||
150 | } | ||
151 | else | ||
152 | perror("APM_IOCGEVTSRC"); | ||
153 | |||
154 | ::close(fd); | ||
155 | } | ||
156 | else | ||
157 | perror("/dev/apm_bios or /dev/misc/apm_bios"); | ||
158 | 102 | ||
159 | return res; | 103 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); |
104 | snd.play(); | ||
160 | #else | 105 | #else |
161 | return true; | 106 | #error QT_NO_SOUND defined |
162 | #endif | 107 | #endif |
163 | } | 108 | } |
164 | 109 | ||
110 | |||
165 | bool Ramses::suspend() | 111 | bool Ramses::suspend() |
166 | { | 112 | { |
167 | qDebug("Ramses::suspend"); | 113 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
168 | return false; | 114 | return false; |
169 | } | ||
170 | 115 | ||
171 | /** | 116 | sendSuspendmsg(); |
172 | * This sets the display on or off | 117 | ::sync(); |
173 | */ | ||
174 | bool Ramses::setDisplayStatus(bool on) | ||
175 | { | ||
176 | qDebug("Ramses::setDisplayStatus(%d)", on); | ||
177 | #if 0 | ||
178 | bool res = false; | ||
179 | int fd; | ||
180 | 118 | ||
181 | if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { | 119 | int fd; |
182 | res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); | 120 | if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { |
121 | char writeCommand[] = "1\n"; | ||
122 | ::write(fd, writeCommand, sizeof(writeCommand) ); | ||
183 | ::close(fd); | 123 | ::close(fd); |
184 | } | 124 | } |
185 | return res; | 125 | |
186 | #else | 126 | ::usleep ( 200 * 1000 ); |
187 | return true; | 127 | return true; |
188 | #endif | ||
189 | } | 128 | } |
190 | 129 | ||
191 | 130 | ||
192 | /* | ||
193 | * We get something between 0..255 into us | ||
194 | */ | ||
195 | bool Ramses::setDisplayBrightness(int bright) | 131 | bool Ramses::setDisplayBrightness(int bright) |
196 | { | 132 | { |
197 | qDebug("Ramses::setDisplayBrightness(%d)", bright); | 133 | //qDebug("Ramses::setDisplayBrightness(%d)", bright); |
198 | bool res = false; | 134 | bool res = false; |
199 | int fd; | 135 | int fd; |
@@ -206,5 +142,5 @@ bool Ramses::setDisplayBrightness(int bright) | |||
206 | bright = 0; | 142 | bright = 0; |
207 | 143 | ||
208 | // Turn backlight completely off | 144 | // Turn backlight completely off if brightness=0 |
209 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { | 145 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { |
210 | char writeCommand[10]; | 146 | char writeCommand[10]; |
@@ -214,9 +150,6 @@ bool Ramses::setDisplayBrightness(int bright) | |||
214 | } | 150 | } |
215 | 151 | ||
216 | // scale backlight brightness to hardware | 152 | if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { |
217 | bright = 500-(bright * 500 / 255); | 153 | char writeCommand[10]; |
218 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { | ||
219 | qDebug(" %d ->pwm1", bright); | ||
220 | char writeCommand[100]; | ||
221 | const int count = sprintf(writeCommand, "%d\n", bright); | 154 | const int count = sprintf(writeCommand, "%d\n", bright); |
222 | res = (::write(fd, writeCommand, count) != -1); | 155 | res = (::write(fd, writeCommand, count) != -1); |
@@ -232,33 +165,4 @@ int Ramses::displayBrightnessResolution() const | |||
232 | } | 165 | } |
233 | 166 | ||
234 | bool Ramses::setDisplayContrast(int contr) | ||
235 | { | ||
236 | qDebug("Ramses::setDisplayContrast(%d)", contr); | ||
237 | bool res = false; | ||
238 | int fd; | ||
239 | |||
240 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) | ||
241 | |||
242 | if (contr > 255 ) | ||
243 | contr = 255; | ||
244 | if (contr < 0) | ||
245 | contr = 0; | ||
246 | contr = 90 - (contr * 20 / 255); | ||
247 | |||
248 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { | ||
249 | qDebug(" %d ->pwm0", contr); | ||
250 | char writeCommand[100]; | ||
251 | const int count = sprintf(writeCommand, "%d\n", contr); | ||
252 | res = (::write(fd, writeCommand, count) != -1); | ||
253 | res = true; | ||
254 | ::close(fd); | ||
255 | } | ||
256 | return res; | ||
257 | } | ||
258 | |||
259 | |||
260 | int Ramses::displayContrastResolution() const | ||
261 | { | ||
262 | return 20; | ||
263 | } | ||
264 | 167 | ||
168 | // TODO: add displayContrast for old MNCI | ||