On 06/09/2014 19:51, Michael Black wrote: Hi Mike, thanks again for your diligent detective work on this issue! > I added a semaphore for fun and output the command being sent when acquiring > it. > > I then noticed what appears to be the problem. Seems the waitForReadyRead > is misbehaving. OK, that would explain the issue. > Here's the trace log with my added debug statements. The semaphore is > acquired just before the hrd_->write > > It took 8 seconds for the first "get context" to get a reply in wsjt-x where > the packet capture shows 2.2 seconds. OK, I see that the replies are getting out of sync with the commands sent which implies that the replies are available if we can coax them out ;) > > There seem to be a lot of bugs on waitForReadyRead > This one in particular now > https://bugreports.qt-project.org/browse/QTBUG-14975 That is interesting and hints at a possible underlying Windows issue or Qt implementation issue. The comments seem to say that either using Qt async signals or retrying the waitReadReady blocking call might solve the issue. I don't want to change the whole CAT conversation to non-blocking signals as that is a big change and defeats the object of having a separate thread for transceiver control. So I have modified my retry code to just retry the waitReadReady after a time out exception in the hope that a second try will be successful. As always I cannot reproduce this issue on my Windows 8.1 machine so if you could update and test it would be much appreciated. > > I then changed the waitForReadyRead to check bytesAvailable and it never > shows any bytes available on the first command sent out. I would assume one > should be able to check this way. > > I did this: > auto retries2 = 200; > replied = (hrd_->bytesAvailable()!=0); > while((!replied) && (retries2 > 0)) > { > if (hrd_->bytesAvailable() > 0) > { > replied=true; > } > else > { > --retries2; > QThread::msleep(50); // 200*50 = 10 seconds > } > } > qDebug () << "HRDTransceiver::bytesAvailable:replied:retries2" << > replied << ":" << hrd_->bytesAvailable() << ":" << retries2; > //replied = hrd_->waitForReadyRead (socket_wait_time); > > And this always times out never seeing any bytres. > > > This is before I changed to bytesAvailable where you can see the HRD reply > come in but the "get id" still times out.
<snip> 73 Bill G4WJS. ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ wsjt-devel mailing list wsjt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wsjt-devel