author | zecke <zecke> | 2005-11-02 20:08:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-11-02 20:08:42 (UTC) |
commit | 562ff5c89ae1da92172a086afc8c3ffb7eec23bd (patch) (unidiff) | |
tree | 1b95768a3215b4f74b6a2723cd4fa093fcd46d17 /libopie2/opiecore/device/odevice_mypal.cpp | |
parent | 1c35276ae800e8adfcca2ddb010a0fe8080754bd (diff) | |
download | opie-562ff5c89ae1da92172a086afc8c3ffb7eec23bd.zip opie-562ff5c89ae1da92172a086afc8c3ffb7eec23bd.tar.gz opie-562ff5c89ae1da92172a086afc8c3ffb7eec23bd.tar.bz2 |
ODevice iPAQ h191x and MyPal Asus:
Patch by Pawel Kolodziejski to change the maximum brightnes
for H191x and Asus MyPAL.
Diffstat (limited to 'libopie2/opiecore/device/odevice_mypal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_mypal.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_mypal.cpp b/libopie2/opiecore/device/odevice_mypal.cpp index 45c70ae..da0272e 100644 --- a/libopie2/opiecore/device/odevice_mypal.cpp +++ b/libopie2/opiecore/device/odevice_mypal.cpp | |||
@@ -156,97 +156,97 @@ bool MyPal::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, | |||
156 | killTimer ( m_power_timer ); | 156 | killTimer ( m_power_timer ); |
157 | m_power_timer = startTimer ( 500 ); | 157 | m_power_timer = startTimer ( 500 ); |
158 | } | 158 | } |
159 | else if ( m_power_timer ) { | 159 | else if ( m_power_timer ) { |
160 | killTimer ( m_power_timer ); | 160 | killTimer ( m_power_timer ); |
161 | m_power_timer = 0; | 161 | m_power_timer = 0; |
162 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 162 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
163 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 163 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
164 | } | 164 | } |
165 | newkeycode = Key_unknown; | 165 | newkeycode = Key_unknown; |
166 | break; | 166 | break; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | if ( newkeycode != keycode ) { | 170 | if ( newkeycode != keycode ) { |
171 | if ( newkeycode != Key_unknown ) | 171 | if ( newkeycode != Key_unknown ) |
172 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 172 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
173 | return true; | 173 | return true; |
174 | } | 174 | } |
175 | else | 175 | else |
176 | return false; | 176 | return false; |
177 | } | 177 | } |
178 | 178 | ||
179 | void MyPal::timerEvent ( QTimerEvent * ) | 179 | void MyPal::timerEvent ( QTimerEvent * ) |
180 | { | 180 | { |
181 | killTimer ( m_power_timer ); | 181 | killTimer ( m_power_timer ); |
182 | m_power_timer = 0; | 182 | m_power_timer = 0; |
183 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 183 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
184 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 184 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | void MyPal::playAlarmSound() | 188 | void MyPal::playAlarmSound() |
189 | { | 189 | { |
190 | #ifndef QT_NO_SOUND | 190 | #ifndef QT_NO_SOUND |
191 | static Sound snd ( "alarm" ); | 191 | static Sound snd ( "alarm" ); |
192 | if(!snd.isFinished()) | 192 | if(!snd.isFinished()) |
193 | return; | 193 | return; |
194 | 194 | ||
195 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 195 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
196 | snd. play(); | 196 | snd. play(); |
197 | #endif | 197 | #endif |
198 | } | 198 | } |
199 | 199 | ||
200 | bool MyPal::setDisplayBrightness ( int bright ) | 200 | bool MyPal::setDisplayBrightness ( int bright ) |
201 | { | 201 | { |
202 | bool res = false; | 202 | bool res = false; |
203 | 203 | ||
204 | if ( bright > 220 ) | 204 | if ( bright > 255 ) |
205 | bright = 220; | 205 | bright = 255; |
206 | if ( bright < 0 ) | 206 | if ( bright < 0 ) |
207 | bright = 0; | 207 | bright = 0; |
208 | 208 | ||
209 | QString cmdline; | 209 | QString cmdline; |
210 | 210 | ||
211 | switch ( model()) { | 211 | switch ( model()) { |
212 | case Model_MyPal_716: | 212 | case Model_MyPal_716: |
213 | if ( !bright ) | 213 | if ( !bright ) |
214 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); | 214 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); |
215 | else | 215 | else |
216 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); | 216 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); |
217 | // No Global::shellQuote as we gurantee it to be sane | 217 | // No Global::shellQuote as we gurantee it to be sane |
218 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 218 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
219 | break; | 219 | break; |
220 | default: | 220 | default: |
221 | res = OAbstractMobileDevice::setDisplayBrightness(bright); | 221 | res = OAbstractMobileDevice::setDisplayBrightness(bright); |
222 | } | 222 | } |
223 | 223 | ||
224 | return res; | 224 | return res; |
225 | } | 225 | } |
226 | 226 | ||
227 | int MyPal::displayBrightnessResolution() const | 227 | int MyPal::displayBrightnessResolution() const |
228 | { | 228 | { |
229 | switch ( model()) { | 229 | switch ( model()) { |
230 | case Model_MyPal_716: | 230 | case Model_MyPal_716: |
231 | return 220; | 231 | return 7; |
232 | default: | 232 | default: |
233 | return OAbstractMobileDevice::displayBrightnessResolution(); | 233 | return OAbstractMobileDevice::displayBrightnessResolution(); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | bool MyPal::setDisplayStatus ( bool on ) | 237 | bool MyPal::setDisplayStatus ( bool on ) |
238 | { | 238 | { |
239 | bool res = false; | 239 | bool res = false; |
240 | 240 | ||
241 | QString cmdline; | 241 | QString cmdline; |
242 | 242 | ||
243 | if ( model() == Model_MyPal_716 ) { | 243 | if ( model() == Model_MyPal_716 ) { |
244 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 244 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
245 | } else { | 245 | } else { |
246 | return OAbstractMobileDevice::setDisplayStatus(on); | 246 | return OAbstractMobileDevice::setDisplayStatus(on); |
247 | } | 247 | } |
248 | 248 | ||
249 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 249 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
250 | 250 | ||
251 | return res; | 251 | return res; |
252 | } | 252 | } |