summaryrefslogtreecommitdiff
authorzecke <zecke>2005-10-07 18:21:10 (UTC)
committer zecke <zecke>2005-10-07 18:21:10 (UTC)
commitd5beae7038e36633480cc3e17134a85b6d68fbc7 (patch) (unidiff)
tree632f5ae52296438e1ff6b4a6c669395da912a3bb
parent0bad2116a1ceed19956b94889cb034781f35146d (diff)
downloadopie-d5beae7038e36633480cc3e17134a85b6d68fbc7.zip
opie-d5beae7038e36633480cc3e17134a85b6d68fbc7.tar.gz
opie-d5beae7038e36633480cc3e17134a85b6d68fbc7.tar.bz2
libopie2/opiecore/device/odevice_ipaq.cpp:
-make it compile. This line should have been H1940 in the patch. Now I even compiled libopiecore before comitting ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 52da2d9..2d734a4 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -281,184 +281,184 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
281 switch ( keycode ) { 281 switch ( keycode ) {
282 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 282 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
283 case HardKey_Menu: { 283 case HardKey_Menu: {
284 if (( d->m_model == Model_iPAQ_H38xx ) || 284 if (( d->m_model == Model_iPAQ_H38xx ) ||
285 ( d->m_model == Model_iPAQ_H39xx ) || 285 ( d->m_model == Model_iPAQ_H39xx ) ||
286 ( d->m_model == Model_iPAQ_H5xxx)) { 286 ( d->m_model == Model_iPAQ_H5xxx)) {
287 newkeycode = HardKey_Mail; 287 newkeycode = HardKey_Mail;
288 } 288 }
289 break; 289 break;
290 } 290 }
291 291
292 // Rotate cursor keys 180 or 270 292 // Rotate cursor keys 180 or 270
293 case Key_Left : 293 case Key_Left :
294 case Key_Right: 294 case Key_Right:
295 case Key_Up : 295 case Key_Up :
296 case Key_Down : { 296 case Key_Down : {
297 if (( d->m_model == Model_iPAQ_H31xx ) || 297 if (( d->m_model == Model_iPAQ_H31xx ) ||
298 ( d->m_model == Model_iPAQ_H38xx )) { 298 ( d->m_model == Model_iPAQ_H38xx )) {
299 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 299 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
300 } 300 }
301 // Rotate the cursor keys by 270 301 // Rotate the cursor keys by 270
302 // keycode - Key_Left = position of the button starting from left clockwise 302 // keycode - Key_Left = position of the button starting from left clockwise
303 // add the rotation to it and modolo. No we've the original offset 303 // add the rotation to it and modolo. No we've the original offset
304 // add the offset to the Key_Left key 304 // add the offset to the Key_Left key
305 if (( d->m_model == Model_iPAQ_H5xxx ) || 305 if (( d->m_model == Model_iPAQ_H5xxx ) ||
306 ( d->m_model == Model_iPAQ_H191x ) || 306 ( d->m_model == Model_iPAQ_H191x ) ||
307 ( d->m_model == Model_iPAQ_H1940 )) 307 ( d->m_model == Model_iPAQ_H1940 ))
308 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 308 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
309 break; 309 break;
310 } 310 }
311 311
312 // map Power Button short/long press to F34/F35 312 // map Power Button short/long press to F34/F35
313 case Key_SysReq: { 313 case Key_SysReq: {
314 if ( isPress ) { 314 if ( isPress ) {
315 if ( m_power_timer ) 315 if ( m_power_timer )
316 killTimer ( m_power_timer ); 316 killTimer ( m_power_timer );
317 m_power_timer = startTimer ( 500 ); 317 m_power_timer = startTimer ( 500 );
318 } 318 }
319 else if ( m_power_timer ) { 319 else if ( m_power_timer ) {
320 killTimer ( m_power_timer ); 320 killTimer ( m_power_timer );
321 m_power_timer = 0; 321 m_power_timer = 0;
322 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 322 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
323 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 323 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
324 } 324 }
325 newkeycode = Key_unknown; 325 newkeycode = Key_unknown;
326 break; 326 break;
327 } 327 }
328 } 328 }
329 329
330 if ( newkeycode != keycode ) { 330 if ( newkeycode != keycode ) {
331 if ( newkeycode != Key_unknown ) 331 if ( newkeycode != Key_unknown )
332 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 332 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
333 return true; 333 return true;
334 } 334 }
335 else 335 else
336 return false; 336 return false;
337} 337}
338 338
339void iPAQ::timerEvent ( QTimerEvent * ) 339void iPAQ::timerEvent ( QTimerEvent * )
340{ 340{
341 killTimer ( m_power_timer ); 341 killTimer ( m_power_timer );
342 m_power_timer = 0; 342 m_power_timer = 0;
343 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 343 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
344 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 344 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
345} 345}
346 346
347 347
348void iPAQ::playAlarmSound() 348void iPAQ::playAlarmSound()
349{ 349{
350#ifndef QT_NO_SOUND 350#ifndef QT_NO_SOUND
351 static Sound snd ( "alarm" ); 351 static Sound snd ( "alarm" );
352 if(!snd.isFinished()) 352 if(!snd.isFinished())
353 return; 353 return;
354 354
355 changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); 355 changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
356 snd. play(); 356 snd. play();
357#endif 357#endif
358} 358}
359 359
360bool iPAQ::setDisplayBrightness ( int bright ) 360bool iPAQ::setDisplayBrightness ( int bright )
361{ 361{
362 bool res = false; 362 bool res = false;
363 int fd; 363 int fd;
364 364
365 if ( bright > 255 ) 365 if ( bright > 255 )
366 bright = 255; 366 bright = 255;
367 if ( bright < 0 ) 367 if ( bright < 0 )
368 bright = 0; 368 bright = 0;
369 369
370 QString cmdline; 370 QString cmdline;
371 371
372 switch ( model()) { 372 switch ( model()) {
373 case Model_iPAQ_H191x: 373 case Model_iPAQ_H191x:
374 if ( !bright ) 374 if ( !bright )
375 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); 375 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power");
376 else 376 else
377 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); 377 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright );
378 // No Global::shellQuote as we gurantee it to be sane 378 // No Global::shellQuote as we gurantee it to be sane
379 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 379 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
380 break; 380 break;
381 default: 381 default:
382 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 382 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
383 FLITE_IN bl; 383 FLITE_IN bl;
384 bl. mode = 1; 384 bl. mode = 1;
385 bl. pwr = bright ? 1 : 0; 385 bl. pwr = bright ? 1 : 0;
386 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 386 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
387 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 387 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
388 ::close ( fd ); 388 ::close ( fd );
389 } 389 }
390 } 390 }
391 return res; 391 return res;
392} 392}
393 393
394int iPAQ::displayBrightnessResolution() const 394int iPAQ::displayBrightnessResolution() const
395{ 395{
396 switch ( model()) { 396 switch ( model()) {
397 case Model_iPAQ_H31xx: 397 case Model_iPAQ_H31xx:
398 case Model_iPAQ_H36xx: 398 case Model_iPAQ_H36xx:
399 case Model_iPAQ_H37xx: 399 case Model_iPAQ_H37xx:
400 return 128; // really 256, but >128 could damage the LCD 400 return 128; // really 256, but >128 could damage the LCD
401 401
402 case Model_iPAQ_H38xx: 402 case Model_iPAQ_H38xx:
403 case Model_iPAQ_H39xx: 403 case Model_iPAQ_H39xx:
404 return 64; 404 return 64;
405 case Model_iPAQ_H5xxx: 405 case Model_iPAQ_H5xxx:
406 return 255; 406 return 255;
407 case Model_iPAQ_H191x: 407 case Model_iPAQ_H191x:
408 return 183; 408 return 183;
409 case Model_iPAQ_H191x: 409 case Model_iPAQ_H1940:
410 return 44; 410 return 44;
411 default: 411 default:
412 return 2; 412 return 2;
413 } 413 }
414} 414}
415 415
416bool iPAQ::setDisplayStatus ( bool on ) 416bool iPAQ::setDisplayStatus ( bool on )
417{ 417{
418 bool res = false; 418 bool res = false;
419 419
420 QString cmdline; 420 QString cmdline;
421 421
422 if ( model() == Model_iPAQ_H191x ) { 422 if ( model() == Model_iPAQ_H191x ) {
423 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" ); 423 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" );
424 } else { 424 } else {
425 return OAbstractMobileDevice::setDisplayStatus(on); 425 return OAbstractMobileDevice::setDisplayStatus(on);
426 } 426 }
427 427
428 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 428 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
429 429
430 return res; 430 return res;
431} 431}
432 432
433bool iPAQ::hasLightSensor() const 433bool iPAQ::hasLightSensor() const
434{ 434{
435 return true; 435 return true;
436} 436}
437 437
438int iPAQ::readLightSensor() 438int iPAQ::readLightSensor()
439{ 439{
440 int fd; 440 int fd;
441 int val = -1; 441 int val = -1;
442 442
443 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 443 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
444 char buffer [8]; 444 char buffer [8];
445 445
446 if ( ::read ( fd, buffer, 5 ) == 5 ) { 446 if ( ::read ( fd, buffer, 5 ) == 5 ) {
447 char *endptr; 447 char *endptr;
448 448
449 buffer [4] = 0; 449 buffer [4] = 0;
450 val = ::strtol ( buffer + 2, &endptr, 16 ); 450 val = ::strtol ( buffer + 2, &endptr, 16 );
451 451
452 if ( *endptr != 0 ) 452 if ( *endptr != 0 )
453 val = -1; 453 val = -1;
454 } 454 }
455 ::close ( fd ); 455 ::close ( fd );
456 } 456 }
457 457
458 return val; 458 return val;
459} 459}
460 460
461int iPAQ::lightSensorResolution() const 461int iPAQ::lightSensorResolution() const
462{ 462{
463 return 256; 463 return 256;
464} 464}