From 50a739fa81c9bef140c341545e2565339e473b9f Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 29 Mar 2016 21:44:08 +0100 Subject: [PATCH 1/2] 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. --- kenwood/kenwood.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index 2e0c7e779..a34ad40f0 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -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); retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm)); if (retval < 0) { - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) goto transaction_write; 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 */ if (strchr(cmdtrm, buffer[strlen(buffer)-1])==NULL) { 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; retval = -RIG_EPROTO; 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); } - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) goto transaction_write; retval = -RIG_EPROTO; 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); } - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) goto transaction_write; retval = -RIG_EIO; 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); } - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) { rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__); 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", __func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]); - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) goto transaction_write; 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] , priv->verify_cmd[0], priv->verify_cmd[1]); - if (retry_read++ < rig->caps->retry) + if (retry_read++ < rs->rigport.retry) goto transaction_write; retval = -RIG_EPROTO; @@ -440,7 +440,7 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf, err = -RIG_EPROTO; usleep (rig->caps->timeout * 1000); } - } while (err != RIG_OK && ++retry < rig->caps->retry); + } while (err != RIG_OK && ++retry < rig->state.rigport.retry); return err; } From 6fb4f72b2ad5a000338aca8652abf6ff4d4d2102 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 29 Mar 2016 21:51:19 +0100 Subject: [PATCH 2/2] Use a sensible port timeout value for the Kenwood TS-850 This back end used a 480 second timeout which effectively blocks retries. The long timeout claimed to be for something to do with tuning which I assume is related to an auto ATU blocking rig CAT responses. The standard retry mechanism should cope with this without resorting to an artificially extended timeout. --- kenwood/ts850.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kenwood/ts850.c b/kenwood/ts850.c index b419a99d3..7751d32cd 100644 --- a/kenwood/ts850.c +++ b/kenwood/ts850.c @@ -110,7 +110,7 @@ const struct rig_caps ts850_caps = { .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 100, - .timeout = 480000, // When you tune a Kenwood, the reply is delayed until you stop. + .timeout = 500, .retry = 10, .has_get_func = TS850_FUNC_ALL,