author | sandman <sandman> | 2002-10-01 16:14:39 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-01 16:14:39 (UTC) |
commit | 70d2cbd97a6b39b1738e3e6580f916dcf0fbc787 (patch) (unidiff) | |
tree | ff6ab6c52a7dc886a61de659dd2860a587b953a0 | |
parent | 657eeb18141838eeb0d18351a6755d7fa686f9d9 (diff) | |
download | opie-70d2cbd97a6b39b1738e3e6580f916dcf0fbc787.zip opie-70d2cbd97a6b39b1738e3e6580f916dcf0fbc787.tar.gz opie-70d2cbd97a6b39b1738e3e6580f916dcf0fbc787.tar.bz2 |
Small bug fix for iPAQ only: screensaver "dim" didn't work anymore -
the backlight was already powered off at level 0
-rw-r--r-- | libopie/odevice.cpp | 3 |
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 | |||
@@ -634,33 +634,34 @@ bool iPAQ::setSoftSuspend ( bool soft ) | |||
634 | return res; | 634 | return res; |
635 | } | 635 | } |
636 | 636 | ||
637 | 637 | ||
638 | bool iPAQ::setDisplayBrightness ( int bright ) | 638 | bool 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 | ||
665 | int iPAQ::displayBrightnessResolution ( ) const | 666 | int iPAQ::displayBrightnessResolution ( ) const |
666 | { | 667 | { |