[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/kmobiletools/kmobiletools/libkmobiletools
From: Marco Gulino <marco () kmobiletools ! org>
Date: 2007-02-24 20:18:48
Message-ID: 1172348328.892440.16157.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 636953 by gulino:
Applying patch from Tais M. Hansen to retry device opening.
BUG: 142115
M +13 -2 qserial.cpp
--- trunk/playground/pim/kmobiletools/kmobiletools/libkmobiletools/qserial.cpp \
#636952:636953 @@ -38,6 +38,7 @@
#include <kuser.h>
#include <qdir.h>
#include <qsocketnotifier.h>
+#include <qwaitcondition.h>
namespace KMobileTools {
@@ -86,7 +87,7 @@
bool QSerial::open(int mode, bool createLockFile)
{
- int iomode=0;
+ int iomode=0, retry=3;
// Fixing weird behaviour of QIODevice open flags
if (mode & IO_ReadWrite) iomode = iomode | O_RDWR;
else
@@ -106,8 +107,18 @@
return false;
}
}
- d->i_modem = ::open( d->m_device.latin1() , iomode | O_NONBLOCK | O_NOCTTY /*| \
O_NOCTTY | O_NONBLOCK*/ ); + // Retry a few times.
+ while( retry > 0 ) {
+ d->i_modem = ::open( d->m_device.latin1() , iomode | O_NONBLOCK | O_NOCTTY \
/*| O_NOCTTY | O_NONBLOCK*/ ); // kdDebug() << "Trying to open " << d->m_device \
<< " in mode " << iomode << ".." << d->i_modem << endl; + if( d->i_modem != -1 \
) break; +
+ // Sleep 1 second.
+ QWaitCondition sleep;
+ sleep.wait( 1000 );
+
+ retry--;
+ }
if(d->i_modem==-1)
{
if(createLockFile) lockFile( false ); // Removing created lockfile
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic