summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
authormickeyl <mickeyl>2005-01-23 21:35:29 (UTC)
committer mickeyl <mickeyl>2005-01-23 21:35:29 (UTC)
commitdd410f1eb69e68f04cf26b6d3e6bca88f0987f71 (patch) (side-by-side diff)
tree0f2b59bae4c326011783e9cdea0754e180ae0e27 /libopie2/opiecore/device/odevice.cpp
parent78e658cecc7521cf3932f5eb44d3f551d73f3181 (diff)
downloadopie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.zip
opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.gz
opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.bz2
remove setSoftSuspend() from ODevice. this is a left-over from the old days
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index a824392..3d69614 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -209,101 +209,96 @@ ODevice::ODevice()
break;
}
}
}
void ODevice::systemMessage( const QCString &msg, const QByteArray & )
{
if ( msg == "deviceButtonMappingChanged()" ) {
reloadButtonMapping();
}
}
void ODevice::init(const QString&)
{
}
/**
* This method initialises the button mapping
*/
void ODevice::initButtons()
{
if ( d->m_buttons )
return;
qDebug ( "init Buttons" );
d->m_buttons = new QValueList <ODeviceButton>;
for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
default_button *db = default_buttons + i;
ODeviceButton b;
b. setKeycode ( db->code );
b. setUserText ( QObject::tr ( "Button", db->utext ));
b. setPixmap ( Resource::loadPixmap ( db->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction ));
d->m_buttons->append ( b );
}
reloadButtonMapping();
}
ODevice::~ODevice()
{
// we leak m_devicebuttons and m_cpu_frequency
// but it's a singleton and it is not so importantant
// -zecke
delete d;
}
-bool ODevice::setSoftSuspend ( bool /*soft*/ )
-{
- return false;
-}
-
//#include <linux/apm_bios.h>
#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
/**
* This method will try to suspend the device
* It only works if the user is the QWS Server and the apm application
* is installed.
* It tries to suspend and then waits some time cause some distributions
* do have asynchronus apm implementations.
* This method will either fail and return false or it'll suspend the
* device and return once the device got woken up
*
* @return if the device got suspended
*/
bool ODevice::suspend()
{
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
// This is needed because the iPAQ apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
// This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
if ( res ) {
do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
::usleep ( 200 * 1000 );
::gettimeofday ( &tvn, 0 );
} while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
}
return res;
}
//#include <linux/fb.h> better not rely on kernel headers in userspace ...