author | schurig <schurig> | 2003-07-01 06:16:34 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-07-01 06:16:34 (UTC) |
commit | 1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f (patch) (side-by-side diff) | |
tree | 8ef66a4ca29fa42ca6e337e1bfb578d575ca1e93 | |
parent | 5f014b53c18138266bd45251babbc8658831ebd2 (diff) | |
download | opie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.zip opie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.tar.gz opie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.tar.bz2 |
silence some warnings
still trying to find out what d->m_rotation does exactly
fake setSoftSuspend()
working suspend()
different /proc/sys/board entry for Brightness & Contrast
-rw-r--r-- | libopie/odevice.cpp | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 993aedf..62dc9d4 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -922,5 +922,6 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) } void ODevice::virtual_hook( int id, void* data ) { - + Q_UNUSED(id); + Q_UNUSED(data); } @@ -1974,6 +1975,7 @@ void Ramses::init() d->m_model = Model_Ramses_MNCI; - d->m_rotation = Rot0; - d->m_holdtime = 1000; + d->m_rotation = Rot180; + d->m_direction = CW; + d->m_holdtime = 1000; f.setName("/etc/oz_version"); @@ -2033,43 +2035,22 @@ void Ramses::timerEvent(QTimerEvent *) bool Ramses::setSoftSuspend(bool soft) { - qDebug("Ramses::setSoftSuspend(%d)", soft); -#if 0 - 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 + Q_UNUSED(soft); + return true; +} - if (sources >= 0) { - if (soft) - sources &= ~APM_EVT_POWER_BUTTON; - else - sources |= APM_EVT_POWER_BUTTON; +bool Ramses::suspend() +{ + //qDebug("Ramses::suspend()"); + if ( !isQWS() ) // only qwsserver is allowed to suspend + return false; - if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources - res = true; - else - perror("APM_IOCGEVTSRC"); - } - else - perror("APM_IOCGEVTSRC"); + bool res = false; + int fd; + if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { + res = ( ::write ( fd, "1", 1 ) != -1 ); ::close(fd); } - else - perror("/dev/apm_bios or /dev/misc/apm_bios"); - - return res; -#else - return true; -#endif -} - -bool Ramses::suspend ( ) -{ - qDebug("Ramses::suspend"); - return false; + return res; } @@ -2079,17 +2060,13 @@ bool Ramses::suspend ( ) bool Ramses::setDisplayStatus(bool on) { - qDebug("Ramses::setDisplayStatus(%d)", on); -#if 0 + //qDebug("Ramses::setDisplayStatus(%d)", on); bool res = false; int fd; - if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { + if ((fd = ::open ("/dev/fb/1", O_RDWR)) >= 0) { res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); ::close(fd); } return res; -#else - return true; -#endif } @@ -2100,5 +2077,5 @@ bool Ramses::setDisplayStatus(bool on) bool Ramses::setDisplayBrightness(int bright) { - qDebug("Ramses::setDisplayBrightness(%d)", bright); + //qDebug("Ramses::setDisplayBrightness(%d)", bright); bool res = false; int fd; @@ -2120,7 +2097,6 @@ bool Ramses::setDisplayBrightness(int bright) // scale backlight brightness to hardware - bright = 500-(bright * 500 / 255); - if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { - qDebug(" %d -> pwm1", bright); + if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { + //qDebug(" %d -> pwm1", bright); char writeCommand[100]; const int count = sprintf(writeCommand, "%d\n", bright); @@ -2134,10 +2110,10 @@ bool Ramses::setDisplayBrightness(int bright) int Ramses::displayBrightnessResolution() const { - return 32; + return 256; } bool Ramses::setDisplayContrast(int contr) { - qDebug("Ramses::setDisplayContrast(%d)", contr); + //qDebug("Ramses::setDisplayContrast(%d)", contr); bool res = false; int fd; @@ -2149,8 +2125,7 @@ bool Ramses::setDisplayContrast(int contr) if (contr < 0) contr = 0; - contr = 90 - (contr * 20 / 255); - if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { - qDebug(" %d -> pwm0", contr); + if ((fd = ::open("/proc/sys/board/lcd_contrast", O_WRONLY)) >= 0) { + //qDebug(" %d -> pwm0", contr); char writeCommand[100]; const int count = sprintf(writeCommand, "%d\n", contr); @@ -2165,4 +2140,4 @@ bool Ramses::setDisplayContrast(int contr) int Ramses::displayContrastResolution() const { - return 20; + return 256; } |