summaryrefslogtreecommitdiff
path: root/libopie
authormickeyl <mickeyl>2003-12-30 02:17:25 (UTC)
committer mickeyl <mickeyl>2003-12-30 02:17:25 (UTC)
commitb53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a (patch) (unidiff)
tree98db0a0053c53e98ba758773f80ad8e14c9564c9 /libopie
parentb636d3d91e8456b22bc450b3d7f3a862b7f615a9 (diff)
downloadopie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.zip
opie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.tar.gz
opie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.tar.bz2
fix a problem in the c7x0 backlight handling...
Bah! Got confused by the input interval for ODevice::setDisplayBrightness() (once) again - it has been ridiculous to scale that down from [0-255] to the actual interval since the day we invented ODevice::displayBrightnessResolution(). I'm going to remove that antique cruft soon.
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index bc09e92..82a0099 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1961,28 +1961,30 @@ bool Zaurus::setSoftSuspend ( bool soft )
1961 return res; 1961 return res;
1962} 1962}
1963 1963
1964 1964
1965bool Zaurus::setDisplayBrightness ( int bright ) 1965bool Zaurus::setDisplayBrightness ( int bright )
1966{ 1966{
1967 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright );
1967 bool res = false; 1968 bool res = false;
1968 int fd; 1969 int fd;
1969 1970
1970 if ( bright > 255 ) bright = 255; 1971 if ( bright > 255 ) bright = 255;
1971 if ( bright < 0 ) bright = 0; 1972 if ( bright < 0 ) bright = 0;
1972 1973
1973 if ( m_embedix ) 1974 if ( m_embedix )
1974 { 1975 {
1975 if ( d->m_model == Model_Zaurus_SLC7x0 ) 1976 if ( d->m_model == Model_Zaurus_SLC7x0 )
1976 { 1977 {
1978 //qDebug( "using special treatment for devices with the corgi backlight interface" );
1977 // special treatment for devices with the corgi backlight interface 1979 // special treatment for devices with the corgi backlight interface
1978 if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 ) 1980 if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 )
1979 { 1981 {
1980 if ( bright > 0x11 ) bright = 0x11; 1982 int value = ( bright == 1 ) ? 1 : bright * ( 17.0 / 255.0 );
1981 char writeCommand[100]; 1983 char writeCommand[100];
1982 const int count = sprintf( writeCommand, "0x%x\n", bright ); 1984 const int count = sprintf( writeCommand, "0x%x\n", value );
1983 res = ( ::write ( fd, writeCommand, count ) != -1 ); 1985 res = ( ::write ( fd, writeCommand, count ) != -1 );
1984 ::close ( fd ); 1986 ::close ( fd );
1985 } 1987 }
1986 return res; 1988 return res;
1987 } 1989 }
1988 else 1990 else