Re: [Hamlib-developer] FT747GX timeout problem - (disgusting) workaround
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Nate B. <n0...@n0...> - 2010-03-27 18:45:44
|
* On 2010 27 Mar 12:20 -0500, Chris Bryant wrote: > Take this perhaps as another step of debugging rather than any kind of fix > > On the basis that the last few bytes in the status return are undefined, they > can't be used for anything. > > So I downloaded the source of 1.2.10 (which I don't pretend to understand to > any degree as my software skills are 20+ years old and I never did do any C). > I looked around a bit to find were the get status command was issued in > ft747.c, observed the parameter for the no. of characrers expected and edited > the file ft747.h to change > > #define FT747_STATUS_UPDATE_DATA_LENGTH 345 > > to > > #define FT747_STATUS_UPDATE_DATA_LENGTH 344 > > in an attempt to fool hamlib. Then recompiled and ran ldconfig. > > rigctl now runs without a timeout error message and F, M, T commands work. > Clearly I should expect a buffer overflow somewhere as I suspect the rig really > is sending 345 characters and I don't know where the buffer space is > defined/allocated. Interesting sleuth work, Chris. Do you have a copy of the 747 manual? What does it say? Note that I've found errors in the manuals! If, in fact, the rig is putting 345 bytes on the wire then you should see a slow corruption of returned data. Actually, not so slow as everything will be off by one on the next read. As for the buffer, it is defined at line 136 of ft747.c and is used by the read_block function called at line 763. In my experience, if the read_block function is called with a smaller count than what the rig actually puts on the wire, the remainder will just "sit on the wire" until the next status command is sent. If your tests reveal no data corruption and the data reads are consistent, then we can patch ft747.h in SVN to correct this bug. 73, de Nate >> -- "The optimist proclaims that we live in the best of all possible worlds. The pessimist fears this is true." Ham radio, Linux, bikes, and more: http://n0nb.us/index.html |