kopia lustrzana https://github.com/Hamlib/Hamlib
Add ENTER/RETURNFUNC to netrigctl_open to identify lines when EPROTO errors occur
rodzic
534299d9fb
commit
5f26083fac
|
@ -260,7 +260,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
struct netrigctl_priv_data *priv;
|
struct netrigctl_priv_data *priv;
|
||||||
|
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
ENTERFUNC;
|
||||||
|
|
||||||
priv = (struct netrigctl_priv_data *)rig->state.priv;
|
priv = (struct netrigctl_priv_data *)rig->state.priv;
|
||||||
priv->rx_vfo = RIG_VFO_A;
|
priv->rx_vfo = RIG_VFO_A;
|
||||||
|
@ -298,7 +298,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC( (ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
prot_ver = atoi(buf);
|
prot_ver = atoi(buf);
|
||||||
|
@ -306,7 +306,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (prot_ver < RIGCTLD_PROT_VER)
|
if (prot_ver < RIGCTLD_PROT_VER)
|
||||||
{
|
{
|
||||||
return -RIG_EPROTO;
|
RETURNFUNC( -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
|
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
|
||||||
|
@ -314,7 +314,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
|
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
|
||||||
|
@ -322,7 +322,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->deprecated_itu_region = atoi(buf);
|
rs->deprecated_itu_region = atoi(buf);
|
||||||
|
@ -334,7 +334,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
|
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
|
||||||
|
@ -349,7 +349,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret != 7)
|
if (ret != 7)
|
||||||
{
|
{
|
||||||
return -RIG_EPROTO;
|
RETURNFUNC(-RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_FRNG_END(rs->rx_range_list[i]))
|
if (RIG_IS_FRNG_END(rs->rx_range_list[i]))
|
||||||
|
@ -365,7 +365,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
|
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
|
||||||
|
@ -380,7 +380,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret != 7)
|
if (ret != 7)
|
||||||
{
|
{
|
||||||
return -RIG_EPROTO;
|
RETURNFUNC(-RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_FRNG_END(rs->tx_range_list[i]))
|
if (RIG_IS_FRNG_END(rs->tx_range_list[i]))
|
||||||
|
@ -408,7 +408,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sscanf(buf, "%"SCNXll"%ld",
|
ret = sscanf(buf, "%"SCNXll"%ld",
|
||||||
|
@ -417,7 +417,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret != 2)
|
if (ret != 2)
|
||||||
{
|
{
|
||||||
return -RIG_EPROTO;
|
RETURNFUNC(-RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_TS_END(rs->tuning_steps[i]))
|
if (RIG_IS_TS_END(rs->tuning_steps[i]))
|
||||||
|
@ -433,7 +433,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sscanf(buf, "%"SCNXll"%ld",
|
ret = sscanf(buf, "%"SCNXll"%ld",
|
||||||
|
@ -442,7 +442,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret != 2)
|
if (ret != 2)
|
||||||
{
|
{
|
||||||
return -RIG_EPROTO;
|
RETURNFUNC(-RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_FLT_END(rs->filters[i]))
|
if (RIG_IS_FLT_END(rs->filters[i]))
|
||||||
|
@ -461,7 +461,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->max_rit = rs->max_rit = atol(buf);
|
rig->caps->max_rit = rs->max_rit = atol(buf);
|
||||||
|
@ -471,7 +471,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->max_xit = rs->max_xit = atol(buf);
|
rig->caps->max_xit = rs->max_xit = atol(buf);
|
||||||
|
@ -481,7 +481,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
|
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
|
||||||
|
@ -491,7 +491,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->announces = atoi(buf);
|
rs->announces = atoi(buf);
|
||||||
|
@ -501,7 +501,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sscanf(buf, "%d%d%d%d%d%d%d",
|
ret = sscanf(buf, "%d%d%d%d%d%d%d",
|
||||||
|
@ -529,7 +529,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sscanf(buf, "%d%d%d%d%d%d%d",
|
ret = sscanf(buf, "%d%d%d%d%d%d%d",
|
||||||
|
@ -557,7 +557,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
|
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
|
||||||
|
@ -567,7 +567,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
|
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
|
||||||
|
@ -577,7 +577,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->has_get_level = rs->has_get_level = strtoll(buf, NULL, 0);
|
rig->caps->has_get_level = rs->has_get_level = strtoll(buf, NULL, 0);
|
||||||
|
@ -600,7 +600,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
|
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
|
||||||
|
@ -610,7 +610,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->has_get_parm = strtoll(buf, NULL, 0);
|
rs->has_get_parm = strtoll(buf, NULL, 0);
|
||||||
|
@ -620,7 +620,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
rig->caps->has_set_parm = rs->has_set_parm = strtoll(buf, NULL, 0);
|
rig->caps->has_set_parm = rs->has_set_parm = strtoll(buf, NULL, 0);
|
||||||
|
@ -651,7 +651,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
rs->vfo_list = RIG_VFO_A | RIG_VFO_B;
|
rs->vfo_list = RIG_VFO_A | RIG_VFO_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prot_ver == 0) { return RIG_OK; }
|
if (prot_ver == 0) { RETURNFUNC(RIG_OK); }
|
||||||
|
|
||||||
// otherwise we continue reading protocol 1 fields
|
// otherwise we continue reading protocol 1 fields
|
||||||
|
|
||||||
|
@ -665,10 +665,10 @@ static int netrigctl_open(RIG *rig)
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(buf, "done", 4) == 0) { return RIG_OK; }
|
if (strncmp(buf, "done", 4) == 0) { RETURNFUNC(RIG_OK); }
|
||||||
|
|
||||||
if (sscanf(buf, "%31[^=]=%1023[^\t\n]", setting, value) == 2)
|
if (sscanf(buf, "%31[^=]=%1023[^\t\n]", setting, value) == 2)
|
||||||
{
|
{
|
||||||
|
@ -834,7 +834,7 @@ static int netrigctl_open(RIG *rig)
|
||||||
}
|
}
|
||||||
while (1);
|
while (1);
|
||||||
|
|
||||||
return RIG_OK;
|
RETURNFUNC(RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netrigctl_close(RIG *rig)
|
static int netrigctl_close(RIG *rig)
|
||||||
|
@ -2690,7 +2690,7 @@ struct rig_caps netrigctl_caps =
|
||||||
RIG_MODEL(RIG_MODEL_NETRIGCTL),
|
RIG_MODEL(RIG_MODEL_NETRIGCTL),
|
||||||
.model_name = "NET rigctl",
|
.model_name = "NET rigctl",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "20220606.0",
|
.version = "20220612.0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_STABLE,
|
||||||
.rig_type = RIG_TYPE_OTHER,
|
.rig_type = RIG_TYPE_OTHER,
|
||||||
|
|
Ładowanie…
Reference in New Issue