summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 21070bf..9d0bbbf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -550,97 +550,101 @@ bool ODevice::suspend ( )
550 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 550 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
551 return false; 551 return false;
552 552
553 bool res = false; 553 bool res = false;
554 554
555 struct timeval tvs, tvn; 555 struct timeval tvs, tvn;
556 ::gettimeofday ( &tvs, 0 ); 556 ::gettimeofday ( &tvs, 0 );
557 557
558 ::sync ( ); // flush fs caches 558 ::sync ( ); // flush fs caches
559 res = ( ::system ( "apm --suspend" ) == 0 ); 559 res = ( ::system ( "apm --suspend" ) == 0 );
560 560
561 // This is needed because the iPAQ apm implementation is asynchronous and we 561 // This is needed because the iPAQ apm implementation is asynchronous and we
562 // can not be sure when exactly the device is really suspended 562 // can not be sure when exactly the device is really suspended
563 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 563 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
564 564
565 if ( res ) { 565 if ( res ) {
566 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 566 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
567 ::usleep ( 200 * 1000 ); 567 ::usleep ( 200 * 1000 );
568 ::gettimeofday ( &tvn, 0 ); 568 ::gettimeofday ( &tvn, 0 );
569 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 569 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
570 } 570 }
571 571
572 return res; 572 return res;
573} 573}
574 574
575//#include <linux/fb.h> better not rely on kernel headers in userspace ... 575//#include <linux/fb.h> better not rely on kernel headers in userspace ...
576 576
577#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 577#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
578 578
579/* VESA Blanking Levels */ 579/* VESA Blanking Levels */
580#define VESA_NO_BLANKING 0 580#define VESA_NO_BLANKING 0
581#define VESA_VSYNC_SUSPEND 1 581#define VESA_VSYNC_SUSPEND 1
582#define VESA_HSYNC_SUSPEND 2 582#define VESA_HSYNC_SUSPEND 2
583#define VESA_POWERDOWN 3 583#define VESA_POWERDOWN 3
584 584
585/** 585/**
586 * This sets the display on or off 586 * This sets the display on or off
587 */ 587 */
588bool ODevice::setDisplayStatus ( bool on ) 588bool ODevice::setDisplayStatus ( bool on )
589{ 589{
590 qDebug("ODevice::setDisplayStatus(%d)", on); 590 qDebug("ODevice::setDisplayStatus(%d)", on);
591 591
592 if ( d-> m_model == Model_Unknown ) 592 if ( d-> m_model == Model_Unknown )
593 return false; 593 return false;
594 594
595 bool res = false; 595 bool res = false;
596 int fd; 596 int fd;
597 597
598#ifdef QT_QWS_DEVFS
599 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
600#else
598 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 601 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
602#endif
599 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 603 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
600 ::close ( fd ); 604 ::close ( fd );
601 } 605 }
602 return res; 606 return res;
603} 607}
604 608
605/** 609/**
606 * This sets the display brightness 610 * This sets the display brightness
607 * 611 *
608 * @param p The brightness to be set on a scale from 0 to 255 612 * @param p The brightness to be set on a scale from 0 to 255
609 * @return success or failure 613 * @return success or failure
610 */ 614 */
611bool ODevice::setDisplayBrightness ( int p) 615bool ODevice::setDisplayBrightness ( int p)
612{ 616{
613 Q_UNUSED( p ) 617 Q_UNUSED( p )
614 return false; 618 return false;
615} 619}
616 620
617/** 621/**
618 * @return returns the number of steppings on the brightness slider 622 * @return returns the number of steppings on the brightness slider
619 * in the Light-'n-Power settings. 623 * in the Light-'n-Power settings.
620 */ 624 */
621int ODevice::displayBrightnessResolution ( ) const 625int ODevice::displayBrightnessResolution ( ) const
622{ 626{
623 return 16; 627 return 16;
624} 628}
625 629
626/** 630/**
627 * This sets the display contrast 631 * This sets the display contrast
628 * @param p The contrast to be set on a scale from 0 to 255 632 * @param p The contrast to be set on a scale from 0 to 255
629 * @return success or failure 633 * @return success or failure
630 */ 634 */
631bool ODevice::setDisplayContrast ( int p) 635bool ODevice::setDisplayContrast ( int p)
632{ 636{
633 Q_UNUSED( p ) 637 Q_UNUSED( p )
634 return false; 638 return false;
635} 639}
636 640
637/** 641/**
638 * @return return the max value for the brightness settings slider 642 * @return return the max value for the brightness settings slider
639 * or 0 if the device doesn't support setting of a contrast 643 * or 0 if the device doesn't support setting of a contrast
640 */ 644 */
641int ODevice::displayContrastResolution ( ) const 645int ODevice::displayContrastResolution ( ) const
642{ 646{
643 return 0; 647 return 0;
644} 648}
645 649
646/** 650/**