summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-01 19:03:41 (UTC)
committer sandman <sandman>2002-11-01 19:03:41 (UTC)
commit0380a66a6edc8692668a24a49082881b13a4c5fc (patch) (unidiff)
tree6e1fbfe4133d493c6380da26e38d29678b8c3622
parent6860113387bbc86ee33e86327941cafc986e6481 (diff)
downloadopie-0380a66a6edc8692668a24a49082881b13a4c5fc.zip
opie-0380a66a6edc8692668a24a49082881b13a4c5fc.tar.gz
opie-0380a66a6edc8692668a24a49082881b13a4c5fc.tar.bz2
setDisplayBrightness calculated the wrong backlight level for iPAQs
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 8f4e296..7d8cdbf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -657,10 +657,8 @@ bool iPAQ::setDisplayBrightness ( int bright )
657 bool res = false; 657 bool res = false;
658 int fd; 658 int fd;
659 659
660 int maxbright = displayBrightnessResolution ( ); 660 if ( bright > 255 )
661 661 bright = 255;
662 if ( bright > maxbright )
663 bright = maxbright;
664 if ( bright < 0 ) 662 if ( bright < 0 )
665 bright = 0; 663 bright = 0;
666 664
@@ -668,7 +666,7 @@ bool iPAQ::setDisplayBrightness ( int bright )
668 FLITE_IN bl; 666 FLITE_IN bl;
669 bl. mode = 1; 667 bl. mode = 1;
670 bl. pwr = bright ? 1 : 0; 668 bl. pwr = bright ? 1 : 0;
671 bl. brightness = bright; 669 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
672 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 670 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
673 ::close ( fd ); 671 ::close ( fd );
674 } 672 }