Michael Black W9MDB 2021-03-06 11:40:27 -06:00
rodzic 175092a99c
commit e6e04d258c
2 zmienionych plików z 1516 dodań i 1492 usunięć

Wyświetl plik

@ -233,10 +233,10 @@ static int check_vfo(vfo_t vfo)
break; // will default to A in which_vfo break; // will default to A in which_vfo
default: default:
return FALSE; RETURNFUNC(FALSE);
} }
return TRUE; RETURNFUNC(TRUE);
} }
/*Rather than use some huge XML library we only need a few things /*Rather than use some huge XML library we only need a few things
@ -254,7 +254,7 @@ static char *xml_build(char *cmd, char *value, char *xmlbuf, int xmlbuflen)
if (xmlbuflen < 4096) if (xmlbuflen < 4096)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: xmllen < 4096\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s: xmllen < 4096\n", __func__);
return NULL; RETURNFUNC(NULL);
} }
header = header =
@ -290,7 +290,7 @@ static char *xml_build(char *cmd, char *value, char *xmlbuf, int xmlbuflen)
snprintf(tmp, sizeof(tmp), "%d\r\n\r\n", (int)strlen(xml)); snprintf(tmp, sizeof(tmp), "%d\r\n\r\n", (int)strlen(xml));
strncat(xmlbuf, tmp, xmlbuflen - 1); strncat(xmlbuf, tmp, xmlbuflen - 1);
strncat(xmlbuf, xml, xmlbuflen - 1); strncat(xmlbuf, xml, xmlbuflen - 1);
return xmlbuf; RETURNFUNC(xmlbuf);
} }
/*This is a very crude xml parse specific to what we need from FLRig /*This is a very crude xml parse specific to what we need from FLRig
@ -351,7 +351,7 @@ static char *xml_parse2(char *xml, char *value, int valueLen)
} }
free(xmltmp); free(xmltmp);
return value; RETURNFUNC(value);
} }
/* /*
@ -367,7 +367,7 @@ static char *xml_parse(char *xml, char *value, int value_len)
/* first off we should have an OK on the 1st line */ /* first off we should have an OK on the 1st line */
if (strstr(xml, " 200 OK") == NULL) if (strstr(xml, " 200 OK") == NULL)
{ {
return NULL; RETURNFUNC(NULL);
} }
rig_debug(RIG_DEBUG_TRACE, "%s XML:\n%s\n", __func__, xml); rig_debug(RIG_DEBUG_TRACE, "%s XML:\n%s\n", __func__, xml);
@ -377,7 +377,7 @@ static char *xml_parse(char *xml, char *value, int value_len)
if (pxml == NULL) if (pxml == NULL)
{ {
return NULL; RETURNFUNC(NULL);
} }
next = strchr(pxml + 1, '<'); next = strchr(pxml + 1, '<');
@ -393,7 +393,7 @@ static char *xml_parse(char *xml, char *value, int value_len)
value[0] = 0; /* truncate to give empty response */ value[0] = 0; /* truncate to give empty response */
} }
return value; RETURNFUNC(value);
} }
/* /*
@ -408,7 +408,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
char *terminator = "</methodResponse>"; char *terminator = "</methodResponse>";
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); ENTERFUNC;
retry = 2; retry = 2;
delims = "\n"; delims = "\n";
@ -432,7 +432,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: Expected 'HTTP/1.1 200 OK', got '%s'\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: Expected 'HTTP/1.1 200 OK', got '%s'\n", __func__,
tmp_buf); tmp_buf);
return -1; RETURNFUNC(-1);
} }
if (len > 0) { retry = 3; } if (len > 0) { retry = 3; }
@ -440,7 +440,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
if (len <= 0) if (len <= 0)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: read_string error=%d\n", __func__, len); rig_debug(RIG_DEBUG_ERR, "%s: read_string error=%d\n", __func__, len);
//return -(100 + RIG_EPROTO); //RETURNFUNC(-(100 + RIG_EPROTO));
continue; continue;
} }
@ -453,7 +453,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
rig_debug(RIG_DEBUG_ERR, rig_debug(RIG_DEBUG_ERR,
"%s: xml buffer overflow!!\nTrying to add len=%d\nTo len=%d\n", __func__, "%s: xml buffer overflow!!\nTrying to add len=%d\nTo len=%d\n", __func__,
(int)strlen(tmp_buf), (int)strlen(xml)); (int)strlen(tmp_buf), (int)strlen(xml));
return -RIG_EPROTO; RETURNFUNC(-RIG_EPROTO);
} }
} }
while (retry-- > 0 && strstr(xml, terminator) == NULL); while (retry-- > 0 && strstr(xml, terminator) == NULL);
@ -461,7 +461,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
if (retry == 0) if (retry == 0)
{ {
rig_debug(RIG_DEBUG_WARN, "%s: retry timeout\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s: retry timeout\n", __func__);
return -RIG_ETIMEOUT; RETURNFUNC(-RIG_ETIMEOUT);
} }
if (strstr(xml, terminator)) if (strstr(xml, terminator))
@ -477,7 +477,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
retval = -(101 + RIG_EPROTO); retval = -(101 + RIG_EPROTO);
} }
return retval; RETURNFUNC(retval);
} }
/* /*
@ -493,12 +493,14 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
ENTERFUNC;
// This shouldn't ever happen...but just in case // This shouldn't ever happen...but just in case
// We need to avoid an empty write as rigctld replies with blank line // We need to avoid an empty write as rigctld replies with blank line
if (xml_len == 0) if (xml_len == 0)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: len==0??\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s: len==0??\n", __func__);
return retval; RETURNFUNC(retval);
} }
// appears we can lose sync if we don't clear things out // appears we can lose sync if we don't clear things out
@ -511,11 +513,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
if (retval < 0) if (retval < 0)
{ {
return -RIG_EIO; RETURNFUNC(-RIG_EIO);
} }
} }
return retval; RETURNFUNC(retval);
} }
static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value, static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
@ -524,6 +526,8 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
char xml[MAXXMLLEN]; char xml[MAXXMLLEN];
int retry = 5; int retry = 5;
ENTERFUNC;
if (value) if (value)
{ {
value[0] = 0; value[0] = 0;
@ -548,7 +552,7 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
// if we get RIG_EIO the socket has probably disappeared // if we get RIG_EIO the socket has probably disappeared
// so bubble up the error so port can re re-opened // so bubble up the error so port can re re-opened
if (retval == -RIG_EIO) { return retval; } if (retval == -RIG_EIO) { RETURNFUNC(retval); }
hl_usleep(50 * 1000); // 50ms sleep if error hl_usleep(50 * 1000); // 50ms sleep if error
} }
@ -563,9 +567,9 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
while (((value && strlen(value) == 0) || (strlen(xml) == 0)) while (((value && strlen(value) == 0) || (strlen(xml) == 0))
&& retry--); // we'll do retries if needed && retry--); // we'll do retries if needed
if (value && strlen(value) == 0) { return RIG_EPROTO; } if (value && strlen(value) == 0) { RETURNFUNC(RIG_EPROTO); }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -576,6 +580,7 @@ static int flrig_init(RIG *rig)
{ {
struct flrig_priv_data *priv; struct flrig_priv_data *priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER); rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
rig->state.priv = (struct flrig_priv_data *)malloc(sizeof( rig->state.priv = (struct flrig_priv_data *)malloc(sizeof(
@ -583,7 +588,7 @@ static int flrig_init(RIG *rig)
if (!rig->state.priv) if (!rig->state.priv)
{ {
return -RIG_ENOMEM; RETURNFUNC(-RIG_ENOMEM);
} }
priv = rig->state.priv; priv = rig->state.priv;
@ -603,13 +608,13 @@ static int flrig_init(RIG *rig)
if (!rig->caps) if (!rig->caps)
{ {
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
strncpy(rig->state.rigport.pathname, DEFAULTPATH, strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname)); sizeof(rig->state.rigport.pathname));
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -621,6 +626,7 @@ static const char *modeMapGetFLRig(rmode_t modeHamlib)
{ {
int i; int i;
ENTERFUNC;
for (i = 0; modeMap[i].mode_hamlib != 0; ++i) for (i = 0; modeMap[i].mode_hamlib != 0; ++i)
{ {
rig_debug(RIG_DEBUG_TRACE, rig_debug(RIG_DEBUG_TRACE,
@ -631,13 +637,13 @@ static const char *modeMapGetFLRig(rmode_t modeHamlib)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s matched mode=%.0f, returning '%s'\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s matched mode=%.0f, returning '%s'\n", __func__,
(double)modeHamlib, modeMap[i].mode_flrig); (double)modeHamlib, modeMap[i].mode_flrig);
return modeMap[i].mode_flrig; RETURNFUNC(modeMap[i].mode_flrig);
} }
} }
rig_debug(RIG_DEBUG_ERR, "%s: Unknown mode requested: %s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: Unknown mode requested: %s\n", __func__,
rig_strrmode(modeHamlib)); rig_strrmode(modeHamlib));
return "ERROR"; RETURNFUNC("ERROR");
} }
/* /*
@ -649,6 +655,9 @@ static rmode_t modeMapGetHamlib(const char *modeFLRig)
{ {
int i; int i;
char modeFLRigCheck[64]; char modeFLRigCheck[64];
ENTERFUNC;
snprintf(modeFLRigCheck, sizeof(modeFLRigCheck), "|%s|", modeFLRig); snprintf(modeFLRigCheck, sizeof(modeFLRigCheck), "|%s|", modeFLRig);
for (i = 0; modeMap[i].mode_hamlib != 0; ++i) for (i = 0; modeMap[i].mode_hamlib != 0; ++i)
@ -659,13 +668,13 @@ static rmode_t modeMapGetHamlib(const char *modeFLRig)
if (modeMap[i].mode_flrig if (modeMap[i].mode_flrig
&& strcmp(modeMap[i].mode_flrig, modeFLRigCheck) == 0) && strcmp(modeMap[i].mode_flrig, modeFLRigCheck) == 0)
{ {
return modeMap[i].mode_hamlib; RETURNFUNC(modeMap[i].mode_hamlib);
} }
} }
rig_debug(RIG_DEBUG_TRACE, "%s: mode requested: %s, not in modeMap\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: mode requested: %s, not in modeMap\n", __func__,
modeFLRig); modeFLRig);
return RIG_MODE_NONE; RETURNFUNC(RIG_MODE_NONE);
} }
@ -736,6 +745,7 @@ static int flrig_open(RIG *rig)
char *pr; char *pr;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER); rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
retval = flrig_transaction(rig, "rig.get_xcvr", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_xcvr", NULL, value, sizeof(value));
@ -744,7 +754,7 @@ static int flrig_open(RIG *rig)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: get_xcvr failed: %s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: get_xcvr failed: %s\n", __func__,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
strncpy(priv->info, value, sizeof(priv->info)); strncpy(priv->info, value, sizeof(priv->info));
@ -754,7 +764,7 @@ static int flrig_open(RIG *rig)
retval = flrig_transaction(rig, "rig.get_pwrmeter_scale", NULL, value, retval = flrig_transaction(rig, "rig.get_pwrmeter_scale", NULL, value,
sizeof(value)); sizeof(value));
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
priv->powermeter_scale = 1; // default priv->powermeter_scale = 1; // default
@ -766,7 +776,7 @@ static int flrig_open(RIG *rig)
/* see if get_modeA is available */ /* see if get_modeA is available */
retval = flrig_transaction(rig, "rig.get_modeA", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_modeA", NULL, value, sizeof(value));
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (strlen(value) > 0) /* must have it since we got an answer */ if (strlen(value) > 0) /* must have it since we got an answer */
{ {
@ -782,7 +792,7 @@ static int flrig_open(RIG *rig)
/* see if get_bwA is available */ /* see if get_bwA is available */
retval = flrig_transaction(rig, "rig.get_bwA", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_bwA", NULL, value, sizeof(value));
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (strlen(value) > 0) /* must have it since we got an answer */ if (strlen(value) > 0) /* must have it since we got an answer */
{ {
@ -798,7 +808,7 @@ static int flrig_open(RIG *rig)
strcpy(arg, value); strcpy(arg, value);
retval = flrig_transaction(rig, "rig.get_AB", arg, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_AB", arg, value, sizeof(value));
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (streq(value, "A")) if (streq(value, "A"))
{ {
@ -818,7 +828,7 @@ static int flrig_open(RIG *rig)
/* find out available widths and modes */ /* find out available widths and modes */
retval = flrig_transaction(rig, "rig.get_modes", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_modes", NULL, value, sizeof(value));
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
rig_debug(RIG_DEBUG_TRACE, "%s: modes=%s\n", __func__, value); rig_debug(RIG_DEBUG_TRACE, "%s: modes=%s\n", __func__, value);
modes = 0; modes = 0;
@ -945,7 +955,7 @@ static int flrig_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: hamlib modes=%s\n", __func__, value); rig_debug(RIG_DEBUG_VERBOSE, "%s: hamlib modes=%s\n", __func__, value);
return retval; RETURNFUNC(retval);
} }
/* /*
@ -954,9 +964,9 @@ static int flrig_open(RIG *rig)
*/ */
static int flrig_close(RIG *rig) static int flrig_close(RIG *rig)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); ENTERFUNC;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -967,9 +977,10 @@ static int flrig_cleanup(RIG *rig)
{ {
int i; int i;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
if (!rig) if (!rig)
{ {
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
free(rig->state.priv); free(rig->state.priv);
@ -985,7 +996,7 @@ static int flrig_cleanup(RIG *rig)
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -997,6 +1008,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char value[MAXARGLEN]; char value[MAXARGLEN];
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -1005,7 +1017,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
@ -1024,7 +1036,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: flrig_transaction failed retval=%s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: flrig_transaction failed retval=%s\n", __func__,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
*freq = atof(value); *freq = atof(value);
@ -1033,7 +1045,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: freq==0??\nvalue=%s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: freq==0??\nvalue=%s\n", __func__,
value); value);
return -(102 + RIG_EPROTO); RETURNFUNC(-(102 + RIG_EPROTO));
} }
else else
{ {
@ -1049,7 +1061,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
priv->curr_freqB = *freq; priv->curr_freqB = *freq;
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1063,6 +1075,7 @@ static int flrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char *cmd; char *cmd;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.0f\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.0f\n", __func__,
rig_strvfo(vfo), freq); rig_strvfo(vfo), freq);
@ -1070,7 +1083,7 @@ static int flrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
@ -1102,10 +1115,10 @@ static int flrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1118,6 +1131,7 @@ static int flrig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
char cmd_arg[MAXARGLEN]; char cmd_arg[MAXARGLEN];
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d\n", __func__, ptt); rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d\n", __func__, ptt);
@ -1125,7 +1139,7 @@ static int flrig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
sprintf(cmd_arg, sprintf(cmd_arg,
@ -1135,12 +1149,12 @@ static int flrig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
return retval; RETURNFUNC(retval);
} }
priv->ptt = ptt; priv->ptt = ptt;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1153,17 +1167,17 @@ static int flrig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
char xml[MAXXMLLEN]; char xml[MAXXMLLEN];
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
int retval; int retval;
retval = flrig_transaction(rig, "rig.get_ptt", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_ptt", NULL, value, sizeof(value));
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
return retval; RETURNFUNC(retval);
} }
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
@ -1172,7 +1186,7 @@ static int flrig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
priv->ptt = *ptt; priv->ptt = *ptt;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1185,6 +1199,7 @@ static int flrig_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode,
int retval; int retval;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n", rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n",
__func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width); __func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width);
@ -1207,14 +1222,14 @@ static int flrig_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode,
rig_strrmode(priv->curr_modeB)); rig_strrmode(priv->curr_modeB));
// save some VFO swapping .. may replace with VFO specific calls that won't cause VFO change // save some VFO swapping .. may replace with VFO specific calls that won't cause VFO change
if (vfo == RIG_VFO_A && mode == priv->curr_modeA) { return RIG_OK; } if (vfo == RIG_VFO_A && mode == priv->curr_modeA) { RETURNFUNC(RIG_OK); }
if (vfo == RIG_VFO_B && mode == priv->curr_modeB) { return RIG_OK; } if (vfo == RIG_VFO_B && mode == priv->curr_modeB) { RETURNFUNC(RIG_OK); }
retval = flrig_set_mode(rig, vfo, mode, width); retval = flrig_set_mode(rig, vfo, mode, width);
rig_debug(RIG_DEBUG_TRACE, "%s: set mode=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: set mode=%s\n", __func__,
rig_strrmode(mode)); rig_strrmode(mode));
return retval; RETURNFUNC(retval);
} }
/* /*
@ -1232,6 +1247,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
char *ttmode; char *ttmode;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n", rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n",
__func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width); __func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width);
@ -1241,7 +1257,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: returning because priv->ptt=%d\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: returning because priv->ptt=%d\n", __func__,
(int)priv->ptt); (int)priv->ptt);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
@ -1253,13 +1269,13 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
if (priv->ptt) if (priv->ptt)
{ {
rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__);
return RIG_OK; // just return OK and ignore this RETURNFUNC(RIG_OK); // just return OK and ignore this
} }
// Switch to VFOB if appropriate since we can't set mode directly // Switch to VFOB if appropriate since we can't set mode directly
@ -1285,7 +1301,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
} }
@ -1297,7 +1313,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (ttmode == NULL) if (ttmode == NULL)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: strdup failed\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s: strdup failed\n", __func__);
return -RIG_EINTERNAL; RETURNFUNC(-RIG_EINTERNAL);
} }
// if (strncmp(ttmode,"ERROR",5)==0) RETURNFUNC(-RIG_EINTERN); // if (strncmp(ttmode,"ERROR",5)==0) RETURNFUNC(-RIG_EINTERN);
@ -1339,7 +1355,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: failed: %s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: failed: %s\n", __func__,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
// Determine if we need to update the bandwidth // Determine if we need to update the bandwidth
@ -1379,7 +1395,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
flrig_set_vfo(rig, vfo); // ensure reset to our initial vfo flrig_set_vfo(rig, vfo); // ensure reset to our initial vfo
@ -1396,7 +1412,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
} }
@ -1415,7 +1431,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
"%s: return modeA=%s, widthA=%d\n,modeB=%s, widthB=%d\n", __func__, "%s: return modeA=%s, widthA=%d\n,modeB=%s, widthB=%d\n", __func__,
rig_strrmode(priv->curr_modeA), (int)priv->curr_widthA, rig_strrmode(priv->curr_modeA), (int)priv->curr_widthA,
rig_strrmode(priv->curr_modeB), (int)priv->curr_widthB); rig_strrmode(priv->curr_modeB), (int)priv->curr_widthB);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1432,6 +1448,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rmode_t my_mode; rmode_t my_mode;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -1439,7 +1456,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
curr_vfo = rig->state.current_vfo; curr_vfo = rig->state.current_vfo;
@ -1458,7 +1475,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
else { *mode = priv->curr_modeB; } else { *mode = priv->curr_modeB; }
rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__);
return RIG_OK; // just return OK and ignore this RETURNFUNC(RIG_OK); // just return OK and ignore this
} }
// Switch to VFOB if appropriate // Switch to VFOB if appropriate
@ -1477,7 +1494,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
} }
@ -1500,7 +1517,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: %s failed: %s\n", __func__, cmdp, rig_debug(RIG_DEBUG_ERR, "%s: %s failed: %s\n", __func__, cmdp,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
my_mode = modeMapGetHamlib(value); my_mode = modeMapGetHamlib(value);
@ -1536,7 +1553,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
return retval; RETURNFUNC(retval);
} }
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%s width='%s'\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: mode=%s width='%s'\n", __func__,
@ -1569,11 +1586,11 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
return retval; RETURNFUNC(retval);
} }
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1587,6 +1604,7 @@ static int flrig_set_vfo(RIG *rig, vfo_t vfo)
struct rig_state *rs = &rig->state; struct rig_state *rs = &rig->state;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -1595,7 +1613,7 @@ static int flrig_set_vfo(RIG *rig, vfo_t vfo)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
if (vfo == RIG_VFO_TX) if (vfo == RIG_VFO_TX)
@ -1617,7 +1635,7 @@ static int flrig_set_vfo(RIG *rig, vfo_t vfo)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: rig.set_AB failed: %s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: rig.set_AB failed: %s\n", __func__,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
rig->state.current_vfo = vfo; rig->state.current_vfo = vfo;
@ -1633,11 +1651,11 @@ static int flrig_set_vfo(RIG *rig, vfo_t vfo)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1648,7 +1666,7 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
{ {
char value[MAXCMDLEN]; char value[MAXCMDLEN];
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); ENTERFUNC;
int retval; int retval;
@ -1656,7 +1674,7 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
rig_debug(RIG_DEBUG_TRACE, "%s: vfo value=%s\n", __func__, value); rig_debug(RIG_DEBUG_TRACE, "%s: vfo value=%s\n", __func__, value);
@ -1673,14 +1691,14 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
default: default:
*vfo = RIG_VFO_CURR; *vfo = RIG_VFO_CURR;
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
if (check_vfo(*vfo) == FALSE) if (check_vfo(*vfo) == FALSE)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(*vfo)); __func__, rig_strvfo(*vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
rig->state.current_vfo = *vfo; rig->state.current_vfo = *vfo;
@ -1688,7 +1706,7 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(*vfo)); rig_strvfo(*vfo));
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1702,6 +1720,7 @@ static int flrig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
freq_t qtx_freq; freq_t qtx_freq;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__,
rig_strvfo(vfo), tx_freq); rig_strvfo(vfo), tx_freq);
@ -1709,15 +1728,15 @@ static int flrig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
// we always split on VFOB so if no change just return // we always split on VFOB so if no change just return
retval = flrig_get_freq(rig, RIG_VFO_B, &qtx_freq); retval = flrig_get_freq(rig, RIG_VFO_B, &qtx_freq);
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (tx_freq == qtx_freq) { return RIG_OK; } if (tx_freq == qtx_freq) { RETURNFUNC(RIG_OK); }
sprintf(cmd_arg, sprintf(cmd_arg,
"<params><param><value><double>%.6f</double></value></param></params>", "<params><param><value><double>%.6f</double></value></param></params>",
@ -1726,12 +1745,12 @@ static int flrig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
priv->curr_freqB = tx_freq; priv->curr_freqB = tx_freq;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1743,12 +1762,13 @@ static int flrig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
int retval; int retval;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
retval = flrig_get_freq(rig, RIG_VFO_B, tx_freq); retval = flrig_get_freq(rig, RIG_VFO_B, tx_freq);
priv->curr_freqB = *tx_freq; priv->curr_freqB = *tx_freq;
return retval; RETURNFUNC(retval);
} }
/* /*
@ -1763,19 +1783,20 @@ static int flrig_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
char cmd_arg[MAXXMLLEN]; char cmd_arg[MAXXMLLEN];
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s\n", __func__,
rig_strvfo(tx_vfo)); rig_strvfo(tx_vfo));
retval = flrig_get_split_vfo(rig, RIG_VFO_A, &qsplit, &qtx_vfo); retval = flrig_get_split_vfo(rig, RIG_VFO_A, &qsplit, &qtx_vfo);
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (split == qsplit) { return RIG_OK; } if (split == qsplit) { RETURNFUNC(RIG_OK); }
if (priv->ptt) if (priv->ptt)
{ {
rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__);
return RIG_OK; // just return OK and ignore this RETURNFUNC(RIG_OK); // just return OK and ignore this
} }
sprintf(cmd_arg, "<params><param><value><i4>%d</i4></value></param></params>", sprintf(cmd_arg, "<params><param><value><i4>%d</i4></value></param></params>",
@ -1784,12 +1805,12 @@ static int flrig_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
priv->split = split; priv->split = split;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1802,14 +1823,14 @@ static int flrig_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
char value[MAXCMDLEN]; char value[MAXCMDLEN];
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); ENTERFUNC;
int retval; int retval;
retval = flrig_transaction(rig, "rig.get_split", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.get_split", NULL, value, sizeof(value));
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
*tx_vfo = RIG_VFO_B; *tx_vfo = RIG_VFO_B;
@ -1817,7 +1838,7 @@ static int flrig_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
priv->split = *split; priv->split = *split;
rig_debug(RIG_DEBUG_TRACE, "%s tx_vfo=%s, split=%d\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s tx_vfo=%s, split=%d\n", __func__,
rig_strvfo(*tx_vfo), *split); rig_strvfo(*tx_vfo), *split);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1832,18 +1853,17 @@ static int flrig_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
pbwidth_t qwidth; pbwidth_t qwidth;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); ENTERFUNC;
if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX) if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX)
{ {
return -RIG_ENTARGET; RETURNFUNC(-RIG_ENTARGET);
} }
if (priv->ptt) if (priv->ptt)
{ {
rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__);
return RIG_OK; // just return OK and ignore this RETURNFUNC(RIG_OK); // just return OK and ignore this
} }
retval = flrig_set_freq(rig, RIG_VFO_B, freq); retval = flrig_set_freq(rig, RIG_VFO_B, freq);
@ -1851,27 +1871,27 @@ static int flrig_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_ERR, "%s flrig_set_freq failed\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s flrig_set_freq failed\n", __func__);
return retval; RETURNFUNC(retval);
} }
// Make VFOB mode match VFOA mode, keep VFOB width // Make VFOB mode match VFOA mode, keep VFOB width
retval = flrig_get_mode(rig, RIG_VFO_B, &qmode, &qwidth); retval = flrig_get_mode(rig, RIG_VFO_B, &qmode, &qwidth);
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { RETURNFUNC(retval); }
if (qmode == priv->curr_modeA) { return RIG_OK; } if (qmode == priv->curr_modeA) { RETURNFUNC(RIG_OK); }
retval = flrig_set_mode(rig, RIG_VFO_B, priv->curr_modeA, width); retval = flrig_set_mode(rig, RIG_VFO_B, priv->curr_modeA, width);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_ERR, "%s flrig_set_mode failed\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s flrig_set_mode failed\n", __func__);
return retval; RETURNFUNC(retval);
} }
retval = flrig_set_vfo(rig, RIG_VFO_A); retval = flrig_set_vfo(rig, RIG_VFO_A);
return retval; RETURNFUNC(retval);
} }
/* /*
@ -1883,9 +1903,11 @@ static int flrig_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
{ {
int retval; int retval;
ENTERFUNC;
if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX) if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX)
{ {
return -RIG_ENTARGET; RETURNFUNC(-RIG_ENTARGET);
} }
retval = flrig_get_freq(rig, RIG_VFO_B, freq); retval = flrig_get_freq(rig, RIG_VFO_B, freq);
@ -1895,7 +1917,7 @@ static int flrig_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
retval = flrig_get_mode(rig, vfo, mode, width); retval = flrig_get_mode(rig, vfo, mode, width);
} }
return retval; RETURNFUNC(retval);
} }
static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
@ -1905,6 +1927,7 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
char *cmd; char *cmd;
char *param_type = "i4"; char *param_type = "i4";
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s level=%d, val=%f\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s level=%d, val=%f\n", __func__,
rig_strvfo(vfo), (int)level, val.f); rig_strvfo(vfo), (int)level, val.f);
@ -1912,7 +1935,7 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
switch (level) switch (level)
@ -1927,7 +1950,7 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: invalid level=%d\n", __func__, (int)level); rig_debug(RIG_DEBUG_ERR, "%s: invalid level=%d\n", __func__, (int)level);
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
sprintf(cmd_arg, sprintf(cmd_arg,
@ -1939,10 +1962,10 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1956,6 +1979,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int retval; int retval;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -1977,7 +2001,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown level=%d\n", __func__, (int)level); rig_debug(RIG_DEBUG_ERR, "%s: unknown level=%d\n", __func__, (int)level);
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
retval = flrig_transaction(rig, cmd, NULL, value, sizeof(value)); retval = flrig_transaction(rig, cmd, NULL, value, sizeof(value));
@ -1986,7 +2010,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: flrig_transaction failed retval=%s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: flrig_transaction failed retval=%s\n", __func__,
rigerror(retval)); rigerror(retval));
return retval; RETURNFUNC(retval);
} }
// most levels are 0-100 -- may have to allow for different ranges // most levels are 0-100 -- may have to allow for different ranges
@ -2019,7 +2043,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -2029,9 +2053,9 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
static const char *flrig_get_info(RIG *rig) static const char *flrig_get_info(RIG *rig)
{ {
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); ENTERFUNC;
return priv->info; RETURNFUNC(priv->info);
} }
static int flrig_power2mW(RIG *rig, unsigned int *mwpower, float power, static int flrig_power2mW(RIG *rig, unsigned int *mwpower, float power,

Wyświetl plik

@ -28,7 +28,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "20210220" #define BACKEND_VER "20210306"
#define EOM "\r" #define EOM "\r"
#define TRUE 1 #define TRUE 1