author | mickeyl <mickeyl> | 2005-01-01 19:59:53 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-01 19:59:53 (UTC) |
commit | d4b1226ed820ec06ba07361f31dbb35ce559a4cc (patch) (side-by-side diff) | |
tree | d86de5da06a19d5d2a9efd8f1cbc5c90657b0406 | |
parent | 5f310dcd91f574c1b34ca99c157c0b93e6ae1e16 (diff) | |
download | opie-d4b1226ed820ec06ba07361f31dbb35ce559a4cc.zip opie-d4b1226ed820ec06ba07361f31dbb35ce559a4cc.tar.gz opie-d4b1226ed820ec06ba07361f31dbb35ce559a4cc.tar.bz2 |
slightly more correct way to calculate the brightness
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index e75e777..fb23e1d 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -373,97 +373,97 @@ bool Zaurus::setSoftSuspend ( bool soft ) /* non-Embedix kernels dont have kernel autosuspend */ return ODevice::setSoftSuspend( soft ); } bool res = false; int fd; if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources if ( sources >= 0 ) { if ( soft ) sources &= ~APM_EVT_POWER_BUTTON; else sources |= APM_EVT_POWER_BUTTON; if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources res = true; else perror ( "APM_IOCGEVTSRC" ); } else perror ( "APM_IOCGEVTSRC" ); ::close ( fd ); } else perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); return res; } bool Zaurus::setDisplayBrightness( int bright ) { //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if ( m_embedix ) { int numberOfSteps = displayBrightnessResolution(); int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { - int val = ( numberOfSteps * 255 ) / 255; + int val = ( bright * numberOfSteps ) / 255; res = ( ::ioctl ( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); ::close ( fd ); } } else { qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); } return res; } bool Zaurus::setDisplayStatus( bool on ) { bool res = false; if ( m_embedix ) { int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); ::close ( fd ); } } else { qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); } return res; } bool Zaurus::suspend() { qDebug("ODevice::suspend"); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices return false; bool res = false; ODevice::sendSuspendmsg(); struct timeval tvs, tvn; ::gettimeofday ( &tvs, 0 ); ::sync(); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); |