kopia lustrzana https://github.com/Hamlib/Hamlib
This seems to fix the DLL backwards compatiblity now -- more testing needed
Revert "Remove timeout_retry as it broke DLL compatibility"
This reverts commit 1c08cd7a64
.
pull/1330/head
rodzic
203920e293
commit
05cf554671
|
@ -2084,6 +2084,7 @@ struct rig_caps {
|
||||||
int (*password)(RIG *rig, const char *key1); /*< Send encrypted password if rigctld is secured with -A/--password */
|
int (*password)(RIG *rig, const char *key1); /*< Send encrypted password if rigctld is secured with -A/--password */
|
||||||
int (*set_lock_mode)(RIG *rig, int mode);
|
int (*set_lock_mode)(RIG *rig, int mode);
|
||||||
int (*get_lock_mode)(RIG *rig, int *mode);
|
int (*get_lock_mode)(RIG *rig, int *mode);
|
||||||
|
short timeout_retry; /*!< number of retries to make in case of read timeout errors, some serial interfaces may require this, 0 to use default value, -1 to disable */
|
||||||
};
|
};
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
|
18
src/conf.c
18
src/conf.c
|
@ -69,6 +69,11 @@ static const struct confparams frontend_cfg_params[] =
|
||||||
TOK_RETRY, "retry", "Retry", "Max number of retry",
|
TOK_RETRY, "retry", "Retry", "Max number of retry",
|
||||||
"0", RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } }
|
"0", RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
TOK_TIMEOUT_RETRY, "timeout_retry", "Number of retries for read timeouts",
|
||||||
|
"Set the number of retries for data read timeouts that may occur especially with some serial interfaces",
|
||||||
|
"1", RIG_CONF_NUMERIC, { .n = { 0, 100, 1 } }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
TOK_RANGE_SELECTED, "Selected range list", "Range list#",
|
TOK_RANGE_SELECTED, "Selected range list", "Range list#",
|
||||||
"The tx/rx range list in use",
|
"The tx/rx range list in use",
|
||||||
|
@ -738,6 +743,15 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
rs->tuner_control_pathname = strdup(val); // yeah -- need to free it
|
rs->tuner_control_pathname = strdup(val); // yeah -- need to free it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_TIMEOUT_RETRY:
|
||||||
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
|
{
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rs->rigport.timeout_retry = val_i;
|
||||||
|
break;
|
||||||
|
|
||||||
case TOK_OFFSET_VFOA:
|
case TOK_OFFSET_VFOA:
|
||||||
if (1 != sscanf(val, "%ld", &val_i))
|
if (1 != sscanf(val, "%ld", &val_i))
|
||||||
{
|
{
|
||||||
|
@ -1111,6 +1125,10 @@ static int frontend_get_conf2(RIG *rig, token_t token, char *val, int val_len)
|
||||||
SNPRINTF(val, val_len, "%d", rs->async_data_enabled);
|
SNPRINTF(val, val_len, "%d", rs->async_data_enabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_TIMEOUT_RETRY:
|
||||||
|
SNPRINTF(val, val_len, "%d", rs->rigport.timeout_retry);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
17
src/rig.c
17
src/rig.c
|
@ -623,13 +623,28 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
||||||
rs->rigport.post_write_delay = caps->post_write_delay;
|
rs->rigport.post_write_delay = caps->post_write_delay;
|
||||||
|
|
||||||
// since we do two timeouts now we can cut the timeout in half for serial
|
// since we do two timeouts now we can cut the timeout in half for serial
|
||||||
if (caps->port_type == RIG_PORT_SERIAL)
|
if (caps->port_type == RIG_PORT_SERIAL && caps->timeout_retry >= 0)
|
||||||
{
|
{
|
||||||
rs->rigport.timeout = caps->timeout / 2;
|
rs->rigport.timeout = caps->timeout / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->rigport.retry = caps->retry;
|
rs->rigport.retry = caps->retry;
|
||||||
|
|
||||||
|
if (caps->timeout_retry < 0)
|
||||||
|
{
|
||||||
|
// Rigs may disable read timeout retries
|
||||||
|
rs->rigport.timeout_retry = 0;
|
||||||
|
}
|
||||||
|
else if (caps->timeout_retry == 0)
|
||||||
|
{
|
||||||
|
// Default to 1 retry for read timeouts
|
||||||
|
rs->rigport.timeout_retry = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rs->rigport.timeout_retry = caps->timeout_retry;
|
||||||
|
}
|
||||||
|
|
||||||
rs->pttport.type.ptt = caps->ptt_type;
|
rs->pttport.type.ptt = caps->ptt_type;
|
||||||
rs->dcdport.type.dcd = caps->dcd_type;
|
rs->dcdport.type.dcd = caps->dcd_type;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue