From f6d7ed30f034b318d77f36f81b0aa4588cea63fb Mon Sep 17 00:00:00 2001 From: mickeyl Date: Fri, 23 May 2003 13:28:27 +0000 Subject: more handling of SIMpad specifica --- diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 103104f..02f13b5 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -139,7 +139,9 @@ protected: public: virtual bool setSoftSuspend ( bool soft ); + virtual bool suspend(); + virtual bool setDisplayStatus( bool on ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; @@ -1715,15 +1717,51 @@ void SIMpad::alarmSound ( ) } +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; + ::gettimeofday ( &tvs, 0 ); + + ::sync ( ); // flush fs caches + res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :) + + return res; +} + + bool SIMpad::setSoftSuspend ( bool soft ) { - //TODO + 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 :) + + if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { + res = ( ::system( (const char*) cmdline ) == 0 ); + ::close ( fd ); + } + return res; +} + + bool SIMpad::setDisplayBrightness ( int bright ) { + qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); bool res = false; int fd; -- cgit v0.9.0.2