Use rig state rig port retry option rather than from capabilities

The   rig->state.rigport  retry   option  can   be  overridden   by  a
configuration  option and  therefore should  be used  rather than  the
initial capabilities default value.

Thanks to Ervin HA2OS for finding this defect.
Hamlib-3.1
Bill Somerville 2016-03-29 21:44:08 +01:00
rodzic cd9b0ed58d
commit 50a739fa81
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -267,7 +267,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
len = min (datasize ? datasize + 1 : strlen (priv->verify_cmd) + 13, KENWOOD_MAX_BUF_LEN); len = min (datasize ? datasize + 1 : strlen (priv->verify_cmd) + 13, KENWOOD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm)); retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm));
if (retval < 0) { if (retval < 0) {
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
goto transaction_quit; goto transaction_quit;
} }
@ -275,7 +275,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
/* Check that command termination is correct */ /* Check that command termination is correct */
if (strchr(cmdtrm, buffer[strlen(buffer)-1])==NULL) { if (strchr(cmdtrm, buffer[strlen(buffer)-1])==NULL) {
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, buffer); rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, buffer);
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
retval = -RIG_EPROTO; retval = -RIG_EPROTO;
goto transaction_quit; goto transaction_quit;
@ -297,7 +297,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr); rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr);
} }
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
retval = -RIG_EPROTO; retval = -RIG_EPROTO;
goto transaction_quit; goto transaction_quit;
@ -307,7 +307,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: Communication error for '%s'\n", __func__, cmdstr); rig_debug(RIG_DEBUG_VERBOSE, "%s: Communication error for '%s'\n", __func__, cmdstr);
} }
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
retval = -RIG_EIO; retval = -RIG_EIO;
goto transaction_quit; goto transaction_quit;
@ -317,7 +317,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
{ {
rig_debug(RIG_DEBUG_ERR, "%s: Unknown command or rig busy '%s'\n", __func__, cmdstr); rig_debug(RIG_DEBUG_ERR, "%s: Unknown command or rig busy '%s'\n", __func__, cmdstr);
} }
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
usleep (rig->caps->timeout * 1000); usleep (rig->caps->timeout * 1000);
@ -346,7 +346,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
rig_debug(RIG_DEBUG_ERR, "%s: wrong reply %c%c for command %c%c\n", rig_debug(RIG_DEBUG_ERR, "%s: wrong reply %c%c for command %c%c\n",
__func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]); __func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]);
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
retval = -RIG_EPROTO; retval = -RIG_EPROTO;
@ -376,7 +376,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasiz
__func__, buffer[0], buffer[1] __func__, buffer[0], buffer[1]
, priv->verify_cmd[0], priv->verify_cmd[1]); , priv->verify_cmd[0], priv->verify_cmd[1]);
if (retry_read++ < rig->caps->retry) if (retry_read++ < rs->rigport.retry)
goto transaction_write; goto transaction_write;
retval = -RIG_EPROTO; retval = -RIG_EPROTO;
@ -440,7 +440,7 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
err = -RIG_EPROTO; err = -RIG_EPROTO;
usleep (rig->caps->timeout * 1000); usleep (rig->caps->timeout * 1000);
} }
} while (err != RIG_OK && ++retry < rig->caps->retry); } while (err != RIG_OK && ++retry < rig->state.rigport.retry);
return err; return err;
} }