adat updates from Frank, DG1SBG

Diffs for the ADAT TRX found to be required for stable operation of the
ADAT backend.

Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
Hamlib-3.0
Frank Goenninger 2012-10-28 15:02:14 +01:00 zatwierdzone przez Nate Bargmann
rodzic e2bb0106a2
commit 06671cd6af
3 zmienionych plików z 59 dodań i 6 usunięć

Wyświetl plik

@ -535,17 +535,28 @@ static adat_cmd_list_t adat_cmd_list_open_adat =
{
8,
{
&adat_cmd_display_off,
&adat_cmd_get_serial_nr,
&adat_cmd_get_id_code,
&adat_cmd_get_fw_version,
&adat_cmd_get_gui_fw_version,
&adat_cmd_get_hw_version,
&adat_cmd_get_options,
&adat_cmd_set_callsign,
&adat_cmd_set_callsign
}
};
// -- CLOSE ADAT --
static adat_cmd_list_t adat_cmd_list_close_adat =
{
1,
{
&adat_cmd_display_on
}
};
// -- ADAT SPECIAL: RECOVER FROM ERROR --
static adat_cmd_list_t adat_cmd_list_recover_from_error =
@ -599,8 +610,8 @@ size_t trimwhitespace( char *out, size_t len, const char *str )
end++;
// Set output size to minimum of trimmed string length and buffer size minus 1
// out_size = (end - str) < len-1 ? (end - str) : len-1; BUG !
out_size = (end - str) < len-1 ? (end - str) : len;
//out_size = (end - str) < len-1 ? (end - str) : len - 1;
out_size = strlen( str );
// Copy trimmed string and add null terminator
memcpy(out, str, out_size);
@ -1506,8 +1517,6 @@ int adat_get_single_cmd_result( RIG *pRig )
"*** ADAT: %d acBuf ........ = 0x%08x\n",
gFnLevel, acBuf );
nBufLength = strlen( acBuf );
pcBufEnd = acBuf + nBufLength - 1;
pcPos = acBuf;
if(( nRC == RIG_OK ) && ( pcPos != NULL ))
@ -1518,6 +1527,9 @@ int adat_get_single_cmd_result( RIG *pRig )
pcPos++; // No, please don't ask me why this
// happens ... ;-)
nBufLength = strlen( pcPos );
pcBufEnd = pcPos + nBufLength - 1;
pcResult = pcPos; // Save position
if( pcPos < pcBufEnd )
@ -2890,6 +2902,46 @@ int adat_open( RIG *pRig )
return nRC;
}
// ---------------------------------------------------------------------------
// Function adat_close
// ---------------------------------------------------------------------------
// Status: RELEASED
int adat_close( RIG *pRig )
{
int nRC = RIG_OK;
gFnLevel++;
rig_debug( RIG_DEBUG_TRACE,
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n",
gFnLevel, __func__, __FILE__, __LINE__,
pRig );
// Check Params
if( pRig == NULL )
{
nRC = -RIG_EARG;
}
else
{
// Now switch to interactive mode
nRC = adat_transaction( pRig, &adat_cmd_list_close_adat );
}
// Done !
rig_debug( RIG_DEBUG_TRACE,
"*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n",
gFnLevel, __func__, __FILE__, __LINE__,
nRC );
gFnLevel--;
return nRC;
}
// ---------------------------------------------------------------------------
// Function adat_get_info
// ---------------------------------------------------------------------------

Wyświetl plik

@ -510,7 +510,6 @@ int adat_parse_ptt( char *, int * );
int adat_ptt_rnr2anr( ptt_t, int * );
int adat_ptt_anr2rnr( int, ptt_t * );
int adat_send( RIG *, char * );
int adat_receive( RIG *, char * );
@ -559,6 +558,7 @@ int adat_init( RIG * );
int adat_cleanup( RIG * );
int adat_reset( RIG *, reset_t );
int adat_open( RIG * );
int adat_close( RIG * );
int adat_set_conf( RIG *, token_t, const char *val );
int adat_get_conf( RIG *, token_t, char *val );

Wyświetl plik

@ -179,6 +179,7 @@ const struct rig_caps adt_200a_caps =
.rig_cleanup = adat_cleanup,
.rig_open = adat_open,
.reset = adat_reset,
.rig_close = adat_close,
.set_conf = adat_set_conf,
.get_conf = adat_get_conf,