author | eilers <eilers> | 2003-08-08 15:09:29 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-08 15:09:29 (UTC) |
commit | b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16 (patch) (side-by-side diff) | |
tree | b0f96db67cfb1b9d2476530ecec9a2ba6eacbab1 /libopie/odevice.cpp | |
parent | 14d394e6c107b037a09a31a92605034fe50f7813 (diff) | |
download | opie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.zip opie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.tar.gz opie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.tar.bz2 |
Merging all changes from BRANCH_1_0.
-rw-r--r-- | libopie/odevice.cpp | 111 |
1 files changed, 63 insertions, 48 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 62dc9d4..17ae389 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -474,2 +474,5 @@ ODevice::~ODevice ( ) { +// we leak m_devicebuttons and m_cpu_frequency +// but it's a singleton and it is not so importantant +// -zecke delete d; @@ -787,3 +790,3 @@ const QStrList &ODevice::allowedCpuFrequencies ( ) const * Set desired CPU frequency - * + * * @param index index into d->m_cpu_frequencies of the frequency to be set @@ -922,7 +925,5 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) } -void ODevice::virtual_hook( int id, void* data ) { - Q_UNUSED(id); - Q_UNUSED(data); -} +void ODevice::virtual_hook(int, void* ){ +} @@ -1650,3 +1651,2 @@ int Zaurus::displayBrightnessResolution ( ) const - /************************************************** @@ -1891,3 +1891,3 @@ bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm ::sync ( ); // flush fs caches - res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :) + res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) @@ -1913,6 +1913,4 @@ bool SIMpad::setDisplayStatus ( bool on ) - if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { - res = ( ::system( (const char*) cmdline ) == 0 ); - ::close ( fd ); - } + res = ( ::system( (const char*) cmdline ) == 0 ); + return res; @@ -1929,3 +1927,3 @@ bool SIMpad::setDisplayBrightness ( int bright ) bright = 255; - if ( bright < 0 ) + if ( bright < 1 ) bright = 0; @@ -1948,12 +1946,3 @@ int SIMpad::displayBrightnessResolution ( ) const { - switch ( model ( )) { - case Model_SIMpad_CL4: - case Model_SIMpad_SL4: - case Model_SIMpad_SLC: - case Model_SIMpad_TSinus: - return 255; //TODO find out if this is save - - default: - return 2; - } + return 255; // All SIMpad models share the same display } @@ -1976,5 +1965,4 @@ void Ramses::init() - d->m_rotation = Rot180; - d->m_direction = CW; - d->m_holdtime = 1000; + d->m_rotation = Rot0; + d->m_holdtime = 1000; @@ -2036,12 +2024,4 @@ bool Ramses::setSoftSuspend(bool soft) { - Q_UNUSED(soft); - return true; -} - -bool Ramses::suspend() -{ - //qDebug("Ramses::suspend()"); - if ( !isQWS() ) // only qwsserver is allowed to suspend - return false; - + qDebug("Ramses::setSoftSuspend(%d)", soft); +#if 0 bool res = false; @@ -2049,7 +2029,36 @@ bool Ramses::suspend() - if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { - res = ( ::write ( fd, "1", 1 ) != -1 ); + 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); } - return res; + else + perror("/dev/apm_bios or /dev/misc/apm_bios"); + + return res; +#else + return true; +#endif +} + +bool Ramses::suspend ( ) +{ + qDebug("Ramses::suspend"); + return false; } @@ -2061,3 +2070,4 @@ bool Ramses::setDisplayStatus(bool on) { - //qDebug("Ramses::setDisplayStatus(%d)", on); + qDebug("Ramses::setDisplayStatus(%d)", on); +#if 0 bool res = false; @@ -2065,3 +2075,3 @@ bool Ramses::setDisplayStatus(bool on) - if ((fd = ::open ("/dev/fb/1", O_RDWR)) >= 0) { + if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); @@ -2070,2 +2080,5 @@ bool Ramses::setDisplayStatus(bool on) return res; +#else + return true; +#endif } @@ -2078,3 +2091,3 @@ bool Ramses::setDisplayBrightness(int bright) { - //qDebug("Ramses::setDisplayBrightness(%d)", bright); + qDebug("Ramses::setDisplayBrightness(%d)", bright); bool res = false; @@ -2098,4 +2111,5 @@ bool Ramses::setDisplayBrightness(int bright) // scale backlight brightness to hardware - if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { - //qDebug(" %d -> pwm1", bright); + bright = 500-(bright * 500 / 255); + if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { + qDebug(" %d -> pwm1", bright); char writeCommand[100]; @@ -2111,3 +2125,3 @@ int Ramses::displayBrightnessResolution() const { - return 256; + return 32; } @@ -2116,3 +2130,3 @@ bool Ramses::setDisplayContrast(int contr) { - //qDebug("Ramses::setDisplayContrast(%d)", contr); + qDebug("Ramses::setDisplayContrast(%d)", contr); bool res = false; @@ -2126,5 +2140,6 @@ bool Ramses::setDisplayContrast(int contr) contr = 0; + contr = 90 - (contr * 20 / 255); - if ((fd = ::open("/proc/sys/board/lcd_contrast", O_WRONLY)) >= 0) { - //qDebug(" %d -> pwm0", contr); + if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { + qDebug(" %d -> pwm0", contr); char writeCommand[100]; @@ -2141,3 +2156,3 @@ int Ramses::displayContrastResolution() const { - return 256; + return 20; } |