SVN commit 568359 by gulino: Fixing bug in motorola (mine only): phone locks when sending +CGMM just after +CGMI. Increasing (A LOT) timeouts: since now the lower stack code is much more stable, we can use hight timeouts. If you note that some operations take too long, please report it by email (DON'T USE BUGZILLA). M +6 -6 engines/at_engine/at_jobs.cpp M +8 -8 engines/at_engine/kmobiletoolsat_engine.cpp M +8 -6 libkmobiletools/serialdevice.cpp --- trunk/playground/pim/kmobiletools/kmobiletools/engines/at_engine/at_jobs.cpp #568358:568359 @@ -237,18 +237,18 @@ else s_manufacturer=QString::null; emit percentDone( 20 ); + buffer=p_device->sendATCommand(this, "AT+CGMR\r", 20); + if(!CMDERROR) // Phone revision + s_revision = parseInfo( buffer ); + else s_revision=QString::null; + emit percentDone( 60 ); + buffer=p_device->sendATCommand(this, "AT+CGMM\r", 20); if(!CMDERROR) // Phone model s_model = parseInfo( buffer ); else s_model=QString::null; emit percentDone( 40 ); - buffer=p_device->sendATCommand(this, "AT+CGMR\r", 20); - if(!CMDERROR) // Phone revision - s_revision = parseInfo( buffer ); - else s_revision=QString::null; - emit percentDone( 60 ); - buffer=p_device->sendATCommand(this, "AT+CGSN\r", 20); if(!CMDERROR) // Phone imei s_imei = parseInfo( buffer ); --- trunk/playground/pim/kmobiletools/kmobiletools/engines/at_engine/kmobiletoolsat_engine.cpp #568358:568359 @@ -388,18 +388,14 @@ return retval; } + buffer=device->sendATCommand(job, "AT+CGMR\r", 100); + if(!CMDERROR) // Phone revision + retval->setRevision( kmobiletoolsATJob::parseInfo( buffer ) ); + buffer=device->sendATCommand(job, "AT+CGMI\r", 100); if( !CMDERROR ) // Phone manufacturer retval->setManufacturer( kmobiletoolsATJob::parseInfo( buffer ) ); - buffer=device->sendATCommand(job, "AT+CGMM\r", 100); - if(!CMDERROR) // Phone model - retval->setModel( kmobiletoolsATJob::parseInfo( buffer ) ); - - buffer=device->sendATCommand(job, "AT+CGMR\r", 100); - if(!CMDERROR) // Phone revision - retval->setRevision( kmobiletoolsATJob::parseInfo( buffer ) ); - buffer=device->sendATCommand(job, "AT+CPMS=?\r", 100); if( !CMDERROR ) // SMS Slots temp = kmobiletoolsATJob::parseInfo( buffer ); @@ -412,6 +408,10 @@ else temp=QString::null; retval->setPbSlots( kmobiletoolsATJob::parseList( temp.replace("AT+CPBS=?", "") ) ); + buffer=device->sendATCommand(job, "AT+CGMM\r", 100); + if(!CMDERROR) // Phone model + retval->setModel( kmobiletoolsATJob::parseInfo( buffer ) ); + buffer=device->sendATCommand(job, "AT+CSCS=?\r", 100); if( !CMDERROR ) // Charset temp = kmobiletoolsATJob::parseInfo( buffer ); --- trunk/playground/pim/kmobiletools/kmobiletools/libkmobiletools/serialdevice.cpp #568358:568359 @@ -147,7 +147,7 @@ classcmd=classcmd.left(classcmd.find(QRegExp("[^\\w]"), 1) ); d->commandQueueStack+=classcmd; kdDebug() << "QueueStack: " << d->commandQueueStack << endl; - timeout=(timeout / 1)+1; + timeout=(timeout * 1000)+1; d->buffer=QString::null; long err=d->serial->writeBlock(cmd.latin1(), cmd.length()); @@ -166,11 +166,13 @@ while ( d->serial && !EnginesList::instance()->closing() && ( (timeout==0) || ((ibuffer.contains(exitExp) ) )) /// @TODO fix this loop to have something like timeout in msecs. { - - if(job) - job->thread()->msleep( 1 ); - else - usleep(100000); + if( i>=1000 && (i%1000 == 0)) {d->serial->writeBlock("\x1A\r", 2); + kdDebug() << "Sending \\r to unblock\n"; + } +// if(job) + job->thread()->msleep( 1 ); +// else +// usleep(100000); i++; } std::cout << endl;