-rw-r--r-- | libopie/odevice.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 013f804..21070bf 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -1081,49 +1081,49 @@ void Yopy::initButtons ( ) b. setUserText ( QObject::tr ( "Button", ib-> utext )); b. setPixmap ( Resource::loadPixmap ( ib-> pix )); b. setFactoryPresetPressedAction (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); b. setFactoryPresetHeldAction (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); d-> m_buttons-> append ( b ); } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel("QPE/System", this); connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(systemMessage(const QCString&,const QByteArray&))); } bool Yopy::suspend() { /* Opie for Yopy does not implement its own power management at the moment. The public version runs parallel to X, and relies on the existing power management features. */ return false; } -bool Yopy::setDisplayBrightness(int bright) +bool Yopy::setDisplayBrightness(int /*bright*/) { /* The code here works, but is disabled as the current version runs parallel to X, and relies on the existing backlight demon. */ #if 0 if ( QFile::exists("/proc/sys/pm/light") ) { int fd = ::open("/proc/sys/pm/light", O_WRONLY); if (fd >= 0 ) { if (bright) ::write(fd, "1\n", 2); else ::write(fd, "0\n", 2); ::close(fd); return true; } } #endif return false; } int Yopy::displayBrightnessResolution() const { return 2; } @@ -1647,49 +1647,48 @@ void Zaurus::init ( ) if ( loc != -1 ) model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); } if ( model == "SHARP Corgi" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C750"; } else if ( model == "SHARP Husky" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C760"; } else if ( model == "SHARP Poodle" ) { d-> m_model = Model_Zaurus_SLB600; d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; } else if ( model == "Sharp-Collie" || model == "Collie" ) { d-> m_model = Model_Zaurus_SL5500; d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; } else { d-> m_model = Model_Zaurus_SL5500; d-> m_modelstr = "Zaurus (Model unknown)"; } - bool flipstate = false; switch ( d-> m_model ) { case Model_Zaurus_SLA300: d-> m_rotation = Rot0; break; case Model_Zaurus_SLC7x0: d-> m_rotation = rotation(); d-> m_direction = direction(); break; case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: d-> m_rotation = Rot270; break; } m_leds [0] = Led_Off; } void Zaurus::initButtons ( ) { if ( d-> m_buttons ) return; d-> m_buttons = new QValueList <ODeviceButton>; @@ -2346,49 +2345,49 @@ bool SIMpad::setLedState ( OLed l, OLedState st ) leds. OffTime = 1; leds. OffOnBlink = 2; switch ( st ) { case Led_Off : leds. OffOnBlink = 0; break; case Led_On : leds. OffOnBlink = 1; break; case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; } { /*TODO Implement this like that: read from cs3 && with SIMPAD_LED2_ON write to cs3 */ m_leds [0] = st; return true; } } } return false; } -bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) +bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ ) { //TODO return false; } void SIMpad::timerEvent ( QTimerEvent * ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); } void SIMpad::alarmSound ( ) { #ifndef QT_NO_SOUND static Sound snd ( "alarm" ); int fd; int vol; bool vol_reset = false; if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { @@ -2407,71 +2406,70 @@ void SIMpad::alarmSound ( ) } } snd. play ( ); while ( !snd. isFinished ( )) qApp-> processEvents ( ); if ( fd >= 0 ) { if ( vol_reset ) ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); ::close ( fd ); } #endif } bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm { qDebug( "ODevice for SIMpad: suspend()" ); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; bool res = false; - struct timeval tvs, tvn; + struct timeval tvs; ::gettimeofday ( &tvs, 0 ); ::sync ( ); // flush fs caches res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) return res; } bool SIMpad::setSoftSuspend ( bool soft ) { qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); return false; } bool SIMpad::setDisplayStatus ( bool on ) { qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); bool res = false; - int fd; QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) res = ( ::system( (const char*) cmdline ) == 0 ); return res; } bool SIMpad::setDisplayBrightness ( int bright ) { qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 1 ) bright = 0; if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { int value = 255 - bright; const int mask = SIMPAD_BACKLIGHT_MASK; value = value << 8; @@ -2760,48 +2758,49 @@ void Jornada::initButtons ( ) qDebug ( "init Buttons" ); d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { i_button *ib = ipaq_buttons + i; ODeviceButton b; if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { b. setKeycode ( ib-> code ); b. setUserText ( QObject::tr ( "Button", ib-> utext )); b. setPixmap ( Resource::loadPixmap ( ib-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); d-> m_buttons-> append ( b ); } } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } #endif int Jornada::displayBrightnessResolution ( ) const { + return 255; } bool Jornada::setDisplayBrightness ( int bright ) { bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { FLITE_IN bl; bl. mode = 1; bl. pwr = bright ? 1 : 0; bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); ::close ( fd ); } return res; } bool Jornada::setSoftSuspend ( bool soft ) |