Add retries in easycomm.c

pull/1458/head
Mike Black W9MDB 2023-12-18 09:11:19 -06:00
rodzic a3676e0e3b
commit 21cbd77047
1 zmienionych plików z 31 dodań i 24 usunięć

Wyświetl plik

@ -50,6 +50,7 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
{ {
struct rot_state *rs; struct rot_state *rs;
int retval; int retval;
int retry = rot->caps->retry;
rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __func__, cmdstr); rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __func__, cmdstr);
@ -59,6 +60,9 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
} }
rs = &rot->state; rs = &rot->state;
do
{
rig_flush(&rs->rotport); rig_flush(&rs->rotport);
retval = write_block(&rs->rotport, (unsigned char *) cmdstr, strlen(cmdstr)); retval = write_block(&rs->rotport, (unsigned char *) cmdstr, strlen(cmdstr));
@ -77,7 +81,8 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
if (retval < 0) if (retval < 0)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s read_string failed with status %d:%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s read_string failed with status %d:%s\n",
__func__,
retval, strerror(retval)); retval, strerror(retval));
goto transaction_quit; goto transaction_quit;
} }
@ -86,6 +91,8 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
rig_debug(RIG_DEBUG_TRACE, "%s read_string: %s\n", __func__, data); rig_debug(RIG_DEBUG_TRACE, "%s read_string: %s\n", __func__, data);
retval = RIG_OK; retval = RIG_OK;
} }
}
while (--retry && retval != RIG_OK);
transaction_quit: transaction_quit:
return retval; return retval;
@ -520,7 +527,7 @@ const struct rot_caps easycomm1_rot_caps =
ROT_MODEL(ROT_MODEL_EASYCOMM1), ROT_MODEL(ROT_MODEL_EASYCOMM1),
.model_name = "EasycommI", .model_name = "EasycommI",
.mfg_name = "Hamlib", .mfg_name = "Hamlib",
.version = "20220109.0", .version = "20231218.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_OTHER, .rot_type = ROT_TYPE_OTHER,
@ -556,7 +563,7 @@ const struct rot_caps easycomm2_rot_caps =
ROT_MODEL(ROT_MODEL_EASYCOMM2), ROT_MODEL(ROT_MODEL_EASYCOMM2),
.model_name = "EasycommII", .model_name = "EasycommII",
.mfg_name = "Hamlib", .mfg_name = "Hamlib",
.version = "20191206.0", .version = "20231218.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_OTHER, .rot_type = ROT_TYPE_OTHER,
@ -602,7 +609,7 @@ const struct rot_caps easycomm3_rot_caps =
ROT_MODEL(ROT_MODEL_EASYCOMM3), ROT_MODEL(ROT_MODEL_EASYCOMM3),
.model_name = "EasycommIII", .model_name = "EasycommIII",
.mfg_name = "Hamlib", .mfg_name = "Hamlib",
.version = "20201203.0", .version = "2022312180",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_OTHER, .rot_type = ROT_TYPE_OTHER,