summaryrefslogtreecommitdiff
authorsandman <sandman>2002-08-06 21:46:30 (UTC)
committer sandman <sandman>2002-08-06 21:46:30 (UTC)
commit2ac1e6ec5a97d3721a3d6513ea68e4e21da1d40b (patch) (side-by-side diff)
treead84f4e405da51a6ca14ab4dd33bfd7c9f2a411e
parent8084d002de5e310491eec7fac0713ef29d0cf30f (diff)
downloadopie-2ac1e6ec5a97d3721a3d6513ea68e4e21da1d40b.zip
opie-2ac1e6ec5a97d3721a3d6513ea68e4e21da1d40b.tar.gz
opie-2ac1e6ec5a97d3721a3d6513ea68e4e21da1d40b.tar.bz2
- Fix for the "iPAQ won't suspend until apm --suspend is called" problem
- Improved the resume delay until the LCD backlight is on again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp12
-rw-r--r--libopie/odevice.cpp4
2 files changed, 11 insertions, 5 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 7f24259..552c7c3 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -595,46 +595,50 @@ static void blankScreen()
blanked = TRUE;
}
static void darkScreen()
{
extern void qpe_setBacklight(int);
qpe_setBacklight(0); // force off
}
void Desktop::togglePower()
{
+ extern void qpe_setBacklight ( int ); // We need to toggle the LCD fast - no time to send a QCop
+
static bool excllock = false;
if ( excllock )
return;
excllock = true;
bool wasloggedin = loggedin;
loggedin=0;
suspendTime = QDateTime::currentDateTime();
- darkScreen();
+
+ qpe_setBacklight ( 0 ); // force LCD off
+
if ( wasloggedin )
blankScreen();
ODevice::inst ( )-> suspend ( );
- QWSServer::screenSaverActivate( FALSE );
+ QWSServer::screenSaverActivate ( false );
+
+ qpe_setBacklight ( -3 ); // force LCD on
{
QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep
- QCopEnvelope e("QPE/System", "setBacklight(int)");
- e << -3; // Force on
}
if ( wasloggedin )
login(TRUE);
execAutoStart();
//qcopBridge->closeOpenConnections();
//qDebug("called togglePower()!!!!!!");
qApp-> processEvents ( );
excllock = false;
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 057c344..bf64676 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -297,46 +297,48 @@ typedef struct h3600_ts_led {
void ODeviceIPAQ::tstp_sighandler ( int )
{
}
bool ODeviceIPAQ::suspend ( )
{
int fd;
bool res = false;
- if (( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) {
+ if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
+ (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
struct timeval tvs, tvn;
::signal ( SIGTSTP, tstp_sighandler );
::gettimeofday ( &tvs, 0 );
res = ( ::ioctl ( fd, APM_IOC_SUSPEND ) == 0 );
::close ( fd );
if ( res ) {
::kill ( -::getpid ( ), SIGTSTP );
do {
::usleep ( 200 * 1000 );
::gettimeofday ( &tvn, 0 );
} while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
::kill ( -::getpid ( ), SIGCONT );
}
::signal ( SIGTSTP, SIG_DFL );
}
+
return res;
}
void ODeviceIPAQ::alarmSound ( )
{
#if defined( QT_QWS_IPAQ ) // IPAQ
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
int fd;
int vol;
bool vol_reset = false;