#8 Erratic timeouts with Yaesu FT757GXII / rigctl

closed
nobody
None
5
2008-09-12
2008-09-11
No

I have sometimes erratic timeouts when entering commands with rigctl in the function ft757_get_update. I tried to increase the timeout in the function read_block but it does not change anything. I propose a fix of this function: It simply loops with a quadratic delay, ten times, until it works. There should not be any change for existing programs.

int ft757_get_update_data(RIG *rig)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10};
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
int retval;
int nbtries ;
/* Maximum number of attempts to ask/read the data. */
int maxtries = 10 ;

rig_debug(RIG_DEBUG_VERBOSE, "%s called. Timeout=%ld ms\n", __func__, rig->state.rigport.timeout);

if (!rig)
return -RIG_EINVAL;

/* At least on one model, returns erraticaly a timeout. Increasing the timeout
does not fix things. So we restart the read from scratch, it works most of times. */
for( nbtries = 0 ; nbtries < maxtries ; nbtries++ )
{
serial_flush(&rig->state.rigport);

/* send READ STATUS cmd to rig */
retval = write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
if (retval < 0)
return retval;

/* read back the 75 status bytes */
retval = read_block(&rig->state.rigport,
(char *)priv->update_data,
FT757GX_STATUS_UPDATE_DATA_LENGTH);
if (retval == FT757GX_STATUS_UPDATE_DATA_LENGTH) {
break ;
}
rig_debug(RIG_DEBUG_ERR,
"%s: read update_data failed, %d octets of %d read, retry %d out of %d\n",
__func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH,
nbtries, maxtries);
/* The delay is quadratic. */
sleep(nbtries*nbtries);
}

if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH) {
rig_debug(RIG_DEBUG_ERR,"%s: read update_data failed, %d octets of %d read.\n",
__func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH);

return retval < 0 ? retval : -RIG_EIO;
}

return RIG_OK;
}

Discussion

  • Remi Chateauneu

    Remi Chateauneu - 2008-09-11

    File Added: ft757gx.c

     
  • Remi Chateauneu

    Remi Chateauneu - 2008-09-11

    Fix of ft757_get_update_data to eliminate erratic timeouts.

     
  • Stéphane Fillod

    Bonjour Remi,

    Thanks for the patch, it's been committed to CVS right now.
    For your information, the variable maxtries has been set from rig->state.rigport.retry.

    73
    Stephane F8CFE

     
  • Stéphane Fillod

    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks