-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 2 |
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 | |||
@@ -313,152 +313,152 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
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 | ||
339 | void iPAQ::timerEvent ( QTimerEvent * ) | 339 | void 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 | ||
348 | void iPAQ::playAlarmSound() | 348 | void 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 | ||
360 | bool iPAQ::setDisplayBrightness ( int bright ) | 360 | bool 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 | ||
394 | int iPAQ::displayBrightnessResolution() const | 394 | int 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 | ||
416 | bool iPAQ::setDisplayStatus ( bool on ) | 416 | bool 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 | ||
433 | bool iPAQ::hasLightSensor() const | 433 | bool iPAQ::hasLightSensor() const |
434 | { | 434 | { |
435 | return true; | 435 | return true; |
436 | } | 436 | } |
437 | 437 | ||
438 | int iPAQ::readLightSensor() | 438 | int 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 | ||
461 | int iPAQ::lightSensorResolution() const | 461 | int iPAQ::lightSensorResolution() const |
462 | { | 462 | { |
463 | return 256; | 463 | return 256; |
464 | } | 464 | } |