summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore 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
@@ -652,28 +652,26 @@ bool iPAQ::setSoftSuspend ( bool soft )
}
bool iPAQ::setDisplayBrightness ( int bright )
{
bool res = false;
int fd;
- int maxbright = displayBrightnessResolution ( );
-
- if ( bright > maxbright )
- bright = maxbright;
+ if ( bright > 255 )
+ bright = 255;
if ( bright < 0 )
bright = 0;
if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
FLITE_IN bl;
bl. mode = 1;
bl. pwr = bright ? 1 : 0;
- bl. brightness = bright;
+ bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
::close ( fd );
}
return res;
}
int iPAQ::displayBrightnessResolution ( ) const
{