summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c84312e..75426f9 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -626,49 +626,50 @@ bool iPAQ::setSoftSuspend ( bool soft )
626 else 626 else
627 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 627 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
628 628
629 ::close ( fd ); 629 ::close ( fd );
630 } 630 }
631 else 631 else
632 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 632 ::perror ( "/proc/sys/ts/suspend_button_mode" );
633 633
634 return res; 634 return res;
635} 635}
636 636
637 637
638bool iPAQ::setDisplayBrightness ( int bright ) 638bool iPAQ::setDisplayBrightness ( int bright )
639{ 639{
640 bool res = false; 640 bool res = false;
641 int fd; 641 int fd;
642 642
643 if ( bright > 255 ) 643 if ( bright > 255 )
644 bright = 255; 644 bright = 255;
645 if ( bright < 0 ) 645 if ( bright < 0 )
646 bright = 0; 646 bright = 0;
647 647
648 // 128 is the maximum if you want a decent lifetime for the LCD 648 // 128 is the maximum if you want a decent lifetime for the LCD
649 649
650 bright = (int) (( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic 650 if ( bright > 1 )
651 bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
651 //bright = ( bright + 1 ) / 2; 652 //bright = ( bright + 1 ) / 2;
652 653
653 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) || 654 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) ||
654 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) { 655 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) {
655 FLITE_IN bl; 656 FLITE_IN bl;
656 bl. mode = 1; 657 bl. mode = 1;
657 bl. pwr = bright ? 1 : 0; 658 bl. pwr = bright ? 1 : 0;
658 bl. brightness = bright; 659 bl. brightness = bright;
659 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 660 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
660 ::close ( fd ); 661 ::close ( fd );
661 } 662 }
662 return res; 663 return res;
663} 664}
664 665
665int iPAQ::displayBrightnessResolution ( ) const 666int iPAQ::displayBrightnessResolution ( ) const
666{ 667{
667 return 255; // really 128, but logarithmic control is smoother this way 668 return 255; // really 128, but logarithmic control is smoother this way
668} 669}
669 670
670 671
671/************************************************** 672/**************************************************
672 * 673 *
673 * Zaurus 674 * Zaurus
674 * 675 *