Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index b22ee70..cbc7a24 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -367,69 +367,32 @@ bool Zaurus::setLedState( OLed which, OLedState st ) | |||
367 | switch ( st ) { | 367 | switch ( st ) { |
368 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 368 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
369 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 369 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
370 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 370 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
371 | default : ok = false; | 371 | default : ok = false; |
372 | } | 372 | } |
373 | 373 | ||
374 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 374 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
375 | m_leds [0] = st; | 375 | m_leds [0] = st; |
376 | return true; | 376 | return true; |
377 | } | 377 | } |
378 | } | 378 | } |
379 | } | 379 | } |
380 | return false; | 380 | return false; |
381 | } | 381 | } |
382 | 382 | ||
383 | bool Zaurus::setSoftSuspend ( bool soft ) | ||
384 | { | ||
385 | if (!m_embedix) { | ||
386 | /* non-Embedix kernels dont have kernel autosuspend */ | ||
387 | return ODevice::setSoftSuspend( soft ); | ||
388 | } | ||
389 | |||
390 | bool res = false; | ||
391 | int fd; | ||
392 | |||
393 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | ||
394 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | ||
395 | |||
396 | int sources = ::ioctl( fd, APM_IOCGEVTSRC, 0 ); // get current event sources | ||
397 | |||
398 | if ( sources >= 0 ) { | ||
399 | if ( soft ) | ||
400 | sources &= ~APM_EVT_POWER_BUTTON; | ||
401 | else | ||
402 | sources |= APM_EVT_POWER_BUTTON; | ||
403 | |||
404 | if ( ::ioctl( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | ||
405 | res = true; | ||
406 | else | ||
407 | perror ( "APM_IOCGEVTSRC" ); | ||
408 | } | ||
409 | else | ||
410 | perror ( "APM_IOCGEVTSRC" ); | ||
411 | |||
412 | ::close( fd ); | ||
413 | } | ||
414 | else | ||
415 | perror( "/dev/apm_bios or /dev/misc/apm_bios" ); | ||
416 | |||
417 | return res; | ||
418 | } | ||
419 | |||
420 | int Zaurus::displayBrightnessResolution() const | 383 | int Zaurus::displayBrightnessResolution() const |
421 | { | 384 | { |
422 | int res = 1; | 385 | int res = 1; |
423 | if (m_embedix) | 386 | if (m_embedix) |
424 | { | 387 | { |
425 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 388 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
426 | if ( fd ) | 389 | if ( fd ) |
427 | { | 390 | { |
428 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 391 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
429 | ::close( fd ); | 392 | ::close( fd ); |
430 | return value ? value : res; | 393 | return value ? value : res; |
431 | } | 394 | } |
432 | } | 395 | } |
433 | else | 396 | else |
434 | { | 397 | { |
435 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); | 398 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); |
@@ -527,60 +490,57 @@ bool Zaurus::suspend() | |||
527 | // can not be sure when exactly the device is really suspended | 490 | // can not be sure when exactly the device is really suspended |
528 | if ( res ) { | 491 | if ( res ) { |
529 | do { // Yes, wait 15 seconds. This APM sucks big time. | 492 | do { // Yes, wait 15 seconds. This APM sucks big time. |
530 | ::usleep ( 200 * 1000 ); | 493 | ::usleep ( 200 * 1000 ); |
531 | ::gettimeofday ( &tvn, 0 ); | 494 | ::gettimeofday ( &tvn, 0 ); |
532 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | 495 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); |
533 | } | 496 | } |
534 | 497 | ||
535 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | 498 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); |
536 | return res; | 499 | return res; |
537 | } | 500 | } |
538 | 501 | ||
539 | 502 | ||
540 | Transformation Zaurus::rotation() const | 503 | Transformation Zaurus::rotation() const |
541 | { | 504 | { |
542 | Transformation rot; | 505 | Transformation rot; |
543 | int handle = 0; | 506 | |
544 | int retval = 0; | ||
545 | |||
546 | switch ( d->m_model ) { | 507 | switch ( d->m_model ) { |
547 | case Model_Zaurus_SLC3000: // fallthrough | 508 | case Model_Zaurus_SLC3000: // fallthrough |
548 | case Model_Zaurus_SLC7x0: | 509 | case Model_Zaurus_SLC7x0: |
549 | OHingeStatus hs = readHingeSensor(); | 510 | OHingeStatus hs = readHingeSensor(); |
550 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 511 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
551 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 512 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
552 | else rot = Rot270; | 513 | else rot = Rot270; |
553 | break; | 514 | break; |
554 | case Model_Zaurus_SL6000: | 515 | case Model_Zaurus_SL6000: |
555 | case Model_Zaurus_SLB600: | 516 | case Model_Zaurus_SLB600: |
556 | case Model_Zaurus_SLA300: | 517 | case Model_Zaurus_SLA300: |
557 | case Model_Zaurus_SL5500: | 518 | case Model_Zaurus_SL5500: |
558 | case Model_Zaurus_SL5000: | 519 | case Model_Zaurus_SL5000: |
559 | default: | 520 | default: |
560 | rot = d->m_rotation; | 521 | rot = d->m_rotation; |
561 | break; | 522 | break; |
562 | } | 523 | } |
563 | 524 | ||
564 | return rot; | 525 | return rot; |
565 | } | 526 | } |
566 | ODirection Zaurus::direction() const | 527 | ODirection Zaurus::direction() const |
567 | { | 528 | { |
568 | ODirection dir; | 529 | ODirection dir; |
569 | int handle = 0; | 530 | |
570 | int retval = 0; | ||
571 | switch ( d->m_model ) { | 531 | switch ( d->m_model ) { |
572 | case Model_Zaurus_SLC3000: // fallthrough | 532 | case Model_Zaurus_SLC3000: // fallthrough |
573 | case Model_Zaurus_SLC7x0: | 533 | case Model_Zaurus_SLC7x0: |
574 | OHingeStatus hs = readHingeSensor(); | 534 | OHingeStatus hs = readHingeSensor(); |
575 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 535 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
576 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 536 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
577 | else dir = CW; | 537 | else dir = CW; |
578 | break; | 538 | break; |
579 | case Model_Zaurus_SL6000: | 539 | case Model_Zaurus_SL6000: |
580 | case Model_Zaurus_SLA300: | 540 | case Model_Zaurus_SLA300: |
581 | case Model_Zaurus_SLB600: | 541 | case Model_Zaurus_SLB600: |
582 | case Model_Zaurus_SL5500: | 542 | case Model_Zaurus_SL5500: |
583 | case Model_Zaurus_SL5000: | 543 | case Model_Zaurus_SL5000: |
584 | default: dir = d->m_direction; | 544 | default: dir = d->m_direction; |
585 | break; | 545 | break; |
586 | } | 546 | } |