summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 103104f..02f13b5 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -141,3 +141,5 @@ public:
141 virtual bool setSoftSuspend ( bool soft ); 141 virtual bool setSoftSuspend ( bool soft );
142 virtual bool suspend();
142 143
144 virtual bool setDisplayStatus( bool on );
143 virtual bool setDisplayBrightness ( int b ); 145 virtual bool setDisplayBrightness ( int b );
@@ -1717,5 +1719,23 @@ void SIMpad::alarmSound ( )
1717 1719
1720bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm
1721{
1722 qDebug( "ODevice for SIMpad: suspend()" );
1723 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
1724 return false;
1725
1726 bool res = false;
1727
1728 struct timeval tvs, tvn;
1729 ::gettimeofday ( &tvs, 0 );
1730
1731 ::sync ( ); // flush fs caches
1732 res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :)
1733
1734 return res;
1735}
1736
1737
1718bool SIMpad::setSoftSuspend ( bool soft ) 1738bool SIMpad::setSoftSuspend ( bool soft )
1719{ 1739{
1720 //TODO 1740 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
1721 return false; 1741 return false;
@@ -1724,4 +1744,22 @@ bool SIMpad::setSoftSuspend ( bool soft )
1724 1744
1745bool SIMpad::setDisplayStatus ( bool on )
1746{
1747 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
1748
1749 bool res = false;
1750 int fd;
1751
1752 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
1753
1754 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
1755 res = ( ::system( (const char*) cmdline ) == 0 );
1756 ::close ( fd );
1757 }
1758 return res;
1759}
1760
1761
1725bool SIMpad::setDisplayBrightness ( int bright ) 1762bool SIMpad::setDisplayBrightness ( int bright )
1726{ 1763{
1764 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
1727 bool res = false; 1765 bool res = false;