summaryrefslogtreecommitdiff
path: root/libopie
authorsandman <sandman>2002-10-01 16:14:39 (UTC)
committer sandman <sandman>2002-10-01 16:14:39 (UTC)
commit70d2cbd97a6b39b1738e3e6580f916dcf0fbc787 (patch) (side-by-side diff)
treeff6ab6c52a7dc886a61de659dd2860a587b953a0 /libopie
parent657eeb18141838eeb0d18351a6755d7fa686f9d9 (diff)
downloadopie-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
Diffstat (limited to 'libopie') (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 )
else
::perror ( "write to /proc/sys/ts/suspend_button_mode" );
::close ( fd );
}
else
::perror ( "/proc/sys/ts/suspend_button_mode" );
return res;
}
bool iPAQ::setDisplayBrightness ( int bright )
{
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
// 128 is the maximum if you want a decent lifetime for the LCD
- bright = (int) (( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
+ if ( bright > 1 )
+ bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
// bright = ( bright + 1 ) / 2;
if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) ||
(( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) {
FLITE_IN bl;
bl. mode = 1;
bl. pwr = bright ? 1 : 0;
bl. brightness = bright;
res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
::close ( fd );
}
return res;
}
int iPAQ::displayBrightnessResolution ( ) const
{
return 255; // really 128, but logarithmic control is smoother this way
}
/**************************************************
*
* Zaurus
*