astyle files getting ready for release

pull/1031/head
Mike Black W9MDB 2022-05-13 16:50:13 -05:00
rodzic 2f638a10bf
commit 6f9d057162
24 zmienionych plików z 256 dodań i 162 usunięć

Wyświetl plik

@ -519,16 +519,17 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
vfo = vfo_fixup(rig, vfo, rig->state.cache.split); vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
if (width == RIG_PASSBAND_NOCHANGE) { if (width == RIG_PASSBAND_NOCHANGE)
switch(vfo) {
switch (vfo)
{ {
case RIG_VFO_MAIN: case RIG_VFO_MAIN:
case RIG_VFO_A: width = priv->vfo_a.width;break; case RIG_VFO_A: width = priv->vfo_a.width; break;
case RIG_VFO_SUB: case RIG_VFO_SUB:
case RIG_VFO_B: width = priv->vfo_b.width;break; case RIG_VFO_B: width = priv->vfo_b.width; break;
case RIG_VFO_C: width = priv->vfo_c.width;break; case RIG_VFO_C: width = priv->vfo_c.width; break;
} }
} }

Wyświetl plik

@ -806,12 +806,14 @@ static int flrig_open(RIG *rig)
int v1 = 0, v2 = 0, v3 = 0, v4 = 0; int v1 = 0, v2 = 0, v3 = 0, v4 = 0;
sscanf(value, "%d.%d.%d.%d", &v1, &v2, &v3, &v4); sscanf(value, "%d.%d.%d.%d", &v1, &v2, &v3, &v4);
char version[32]; char version[32];
sprintf(version,"%03d%03d%03d%03d",v1,v2,v3,v4); sprintf(version, "%03d%03d%03d%03d", v1, v2, v3, v4);
int iversion = 0; int iversion = 0;
sscanf(version,"%d", &iversion); sscanf(version, "%d", &iversion);
rig_debug(RIG_DEBUG_VERBOSE, "%s: version='%s'=%d\n", __func__, version, iversion); rig_debug(RIG_DEBUG_VERBOSE, "%s: version='%s'=%d\n", __func__, version,
iversion);
priv->has_verify_cmds = 0; priv->has_verify_cmds = 0;
if (iversion >= 1003054000) // 1.3.54 or greater if (iversion >= 1003054000) // 1.3.54 or greater
{ {
priv->has_verify_cmds = 1; priv->has_verify_cmds = 1;
@ -869,10 +871,12 @@ 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_ENAVAIL) // must not have it if (retval == RIG_ENAVAIL) // must not have it
{ {
priv->has_get_bwA = 0; priv->has_get_bwA = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwA is not available=%s\n", __func__, value); rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwA is not available=%s\n", __func__,
value);
} }
else else
{ {
@ -882,10 +886,12 @@ static int flrig_open(RIG *rig)
/* see if set_bwA is available */ /* see if set_bwA is available */
retval = flrig_transaction(rig, "rig.set_bwA", NULL, value, sizeof(value)); retval = flrig_transaction(rig, "rig.set_bwA", NULL, value, sizeof(value));
if (retval == RIG_ENAVAIL) // must not have it if (retval == RIG_ENAVAIL) // must not have it
{ {
priv->has_set_bwA = 0; priv->has_set_bwA = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwA is not available=%s\n", __func__, value); rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwA is not available=%s\n", __func__,
value);
} }
else else
{ {
@ -1520,9 +1526,13 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width); width);
if (vfo == RIG_VFO_A) if (vfo == RIG_VFO_A)
retval = flrig_transaction(rig, "rig.set_bwA", cmd_arg, NULL, 0); {
retval = flrig_transaction(rig, "rig.set_bwA", cmd_arg, NULL, 0);
}
else else
retval = flrig_transaction(rig, "rig.set_bwB", cmd_arg, NULL, 0); {
retval = flrig_transaction(rig, "rig.set_bwB", cmd_arg, NULL, 0);
}
if (retval < 0) if (retval < 0)
{ {
@ -2335,7 +2345,7 @@ static int flrig_get_ext_parm(RIG *rig, token_t token, value_t *val)
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }
HAMLIB_EXPORT(int) flrig_cat_string (RIG *rig, const char *arg) HAMLIB_EXPORT(int) flrig_cat_string(RIG *rig, const char *arg)
{ {
int retval; int retval;
char cmd_arg[MAXARGLEN]; char cmd_arg[MAXARGLEN];

Wyświetl plik

@ -2640,7 +2640,9 @@ int netrigctl_password(RIG *rig, const char *key1)
rig_debug(RIG_DEBUG_VERBOSE, "%s: key1=%s\n", __func__, key1); rig_debug(RIG_DEBUG_VERBOSE, "%s: key1=%s\n", __func__, key1);
SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\password %s\n", key1); SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\password %s\n", key1);
retval = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); retval = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (retval != RIG_OK) retval = -RIG_EPROTO;
if (retval != RIG_OK) { retval = -RIG_EPROTO; }
RETURNFUNC(retval); RETURNFUNC(retval);
} }

Wyświetl plik

@ -678,12 +678,13 @@ int icom_init(RIG *rig)
priv->filter = RIG_PASSBAND_NOCHANGE; priv->filter = RIG_PASSBAND_NOCHANGE;
priv->x25cmdfails = 0; priv->x25cmdfails = 0;
priv->x1cx03cmdfails = 0; priv->x1cx03cmdfails = 0;
// we can add rigs here that will never use the 0x25 cmd // we can add rigs here that will never use the 0x25 cmd
// some like the 751 don't even reject the command and have to time out // some like the 751 don't even reject the command and have to time out
if (rig->caps->rig_model == RIG_MODEL_IC706 if (rig->caps->rig_model == RIG_MODEL_IC706
|| rig->caps->rig_model == RIG_MODEL_IC706MKII || rig->caps->rig_model == RIG_MODEL_IC706MKII
|| rig->caps->rig_model == RIG_MODEL_IC706MKIIG || rig->caps->rig_model == RIG_MODEL_IC706MKIIG
|| rig->caps->rig_model == RIG_MODEL_IC751 || rig->caps->rig_model == RIG_MODEL_IC751
) )
{ {
priv->x25cmdfails = 1; priv->x25cmdfails = 1;
@ -5366,8 +5367,8 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
// we can add rigs we know will never have 0x25 here to skip this check // we can add rigs we know will never have 0x25 here to skip this check
if ((satmode == 0) if ((satmode == 0)
&& !(rig->caps->rig_model == RIG_MODEL_IC751) && !(rig->caps->rig_model == RIG_MODEL_IC751)
) // only worth trying if not in satmode ) // only worth trying if not in satmode
{ {
int cmd, subcmd, freq_len, retry_save; int cmd, subcmd, freq_len, retry_save;
unsigned char freqbuf[32]; unsigned char freqbuf[32];

Wyświetl plik

@ -905,6 +905,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
val->f = 0; val->f = 0;
return -RIG_EPROTO; return -RIG_EPROTO;
} }
val->f /= 100; val->f /= 100;
break; break;

Wyświetl plik

@ -1773,9 +1773,9 @@ static int k3_get_maxpower(RIG *rig)
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = rig->state.priv;
// default range is 0-12 if there is no KPA3 installed // default range is 0-12 if there is no KPA3 installed
if (priv->has_kpa3 || priv->has_kpa100) if (priv->has_kpa3 || priv->has_kpa100)
{ {
maxpower = 110; maxpower = 110;
} }
else if (RIG_IS_KX2 || RIG_IS_KX3) else if (RIG_IS_KX2 || RIG_IS_KX3)
@ -2209,16 +2209,20 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RFPOWER: case RIG_LEVEL_RFPOWER:
retval = kenwood_transaction(rig, "PC", levelbuf, sizeof(levelbuf)); retval = kenwood_transaction(rig, "PC", levelbuf, sizeof(levelbuf));
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
return retval; return retval;
} }
len = strlen(levelbuf); len = strlen(levelbuf);
if (len == 5 || len == 6) if (len == 5 || len == 6)
{ {
sscanf(levelbuf + 2, "%d", &lvl); sscanf(levelbuf + 2, "%d", &lvl);
if (len == 6) {
if (len == 6)
{
// K2 extended reply // K2 extended reply
lvl /= 10; lvl /= 10;
} }
@ -2227,7 +2231,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{ {
return RIG_EPROTO; return RIG_EPROTO;
} }
val->f = (float) lvl / k3_get_maxpower(rig); val->f = (float) lvl / k3_get_maxpower(rig);
break; break;
@ -2741,7 +2745,7 @@ int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return retval; return retval;
} }
for(i=0; i<5 && ptt2 != ptt; ++i) for (i = 0; i < 5 && ptt2 != ptt; ++i)
{ {
retval = kenwood_safe_transaction(rig, "TQ", pttbuf, 6, 3); retval = kenwood_safe_transaction(rig, "TQ", pttbuf, 6, 3);
@ -2758,8 +2762,9 @@ int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d, expected=%d\n", __func__, ptt2, ptt); rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d, expected=%d\n", __func__, ptt2, ptt);
} }
} }
// had one report of Fake It not returning to RX freq after TX -- so a little more time for the K4 // had one report of Fake It not returning to RX freq after TX -- so a little more time for the K4
if (ptt == RIG_PTT_OFF) hl_usleep(100 * 1000); if (ptt == RIG_PTT_OFF) { hl_usleep(100 * 1000); }
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -391,6 +391,7 @@ transaction_read:
// so in order to retry commands need to re-write them // so in order to retry commands need to re-write them
// https://github.com/Hamlib/Hamlib/issues/983 // https://github.com/Hamlib/Hamlib/issues/983
#if 0 #if 0
if (datasize) if (datasize)
{ {
goto transaction_write; goto transaction_write;
@ -399,6 +400,7 @@ transaction_read:
{ {
goto transaction_read; goto transaction_read;
} }
#endif #endif
} }

Wyświetl plik

@ -115,8 +115,10 @@ static int ft1000mp_open(RIG *rig);
static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); static int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
static int ft1000mp_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); static int ft1000mp_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
static int ft1000mp_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); pbwidth_t tx_width);
static int ft1000mp_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width);
static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
rmode_t mode, pbwidth_t width); rmode_t mode, pbwidth_t width);
static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
@ -1794,14 +1796,16 @@ static int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
RETURNFUNC(ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq)); RETURNFUNC(ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq));
} }
static int ft1000mp_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) static int ft1000mp_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
{ {
int retval; int retval;
retval = rig_set_mode(rig, RIG_VFO_B, tx_mode, tx_width); retval = rig_set_mode(rig, RIG_VFO_B, tx_mode, tx_width);
RETURNFUNC(retval); RETURNFUNC(retval);
} }
static int ft1000mp_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) static int ft1000mp_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
{ {
int retval; int retval;
retval = rig_get_mode(rig, RIG_VFO_B, tx_mode, tx_width); retval = rig_get_mode(rig, RIG_VFO_B, tx_mode, tx_width);
@ -1813,18 +1817,23 @@ static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
{ {
int retval; int retval;
retval = rig_set_mode(rig, RIG_VFO_B, mode, width); retval = rig_set_mode(rig, RIG_VFO_B, mode, width);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_mode failed: %s\n", __func__, rigerror(retval)); rig_debug(RIG_DEBUG_ERR, "%s: rig_set_mode failed: %s\n", __func__,
rigerror(retval));
RETURNFUNC(retval); RETURNFUNC(retval);
} }
retval = ft1000mp_set_split_freq(rig, vfo, freq); retval = ft1000mp_set_split_freq(rig, vfo, freq);
if (retval == RIG_OK) if (retval == RIG_OK)
{ {
rig->state.cache.freqMainB = freq; rig->state.cache.freqMainB = freq;
rig->state.cache.modeMainB = mode; rig->state.cache.modeMainB = mode;
} }
RETURNFUNC(retval);
RETURNFUNC(retval);
} }
static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
@ -1832,18 +1841,23 @@ static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
{ {
int retval; int retval;
retval = rig_get_mode(rig, RIG_VFO_B, mode, width); retval = rig_get_mode(rig, RIG_VFO_B, mode, width);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_mode failed: %s\n", __func__, rigerror(retval)); rig_debug(RIG_DEBUG_ERR, "%s: rig_set_mode failed: %s\n", __func__,
rigerror(retval));
RETURNFUNC(retval); RETURNFUNC(retval);
} }
retval = ft1000mp_get_split_freq(rig, vfo, freq); retval = ft1000mp_get_split_freq(rig, vfo, freq);
if (retval == RIG_OK) if (retval == RIG_OK)
{ {
rig->state.cache.freqMainB = *freq; rig->state.cache.freqMainB = *freq;
rig->state.cache.modeMainB = *mode; rig->state.cache.modeMainB = *mode;
} }
RETURNFUNC(retval);
RETURNFUNC(retval);
} }
static int ft1000mp_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) static int ft1000mp_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)

Wyświetl plik

@ -420,9 +420,11 @@ static int ft757_open(RIG *rig)
{ {
memset(priv->update_data, 0, FT757GX_STATUS_UPDATE_DATA_LENGTH); memset(priv->update_data, 0, FT757GX_STATUS_UPDATE_DATA_LENGTH);
retval = rig_set_vfo(rig, RIG_VFO_A); retval = rig_set_vfo(rig, RIG_VFO_A);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_vfo error: %s\n", __func__, rigerror(retval)); rig_debug(RIG_DEBUG_ERR, "%s: rig_set_vfo error: %s\n", __func__,
rigerror(retval));
} }
} }
else else
@ -492,7 +494,9 @@ static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called. fakefreq=%d\n", __func__, priv->fakefreq); rig_debug(RIG_DEBUG_VERBOSE, "%s called. fakefreq=%d\n", __func__,
priv->fakefreq);
if (priv->fakefreq) // only return last freq set when fakeit is turned on if (priv->fakefreq) // only return last freq set when fakeit is turned on
{ {
*freq = priv->curfreq; *freq = priv->curfreq;

Wyświetl plik

@ -821,10 +821,11 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int retries = rig->state.rigport.retry + int retries = rig->state.rigport.retry +
1; // +1 because, because 2 steps are needed even in best scenario 1; // +1 because, because 2 steps are needed even in best scenario
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, vfo=%s, ptt=%d, split=%d\n", __func__, rig_strvfo(vfo), rig->state.cache.ptt, rig->state.cache.split); rig_debug(RIG_DEBUG_VERBOSE, "%s: called, vfo=%s, ptt=%d, split=%d\n", __func__,
rig_strvfo(vfo), rig->state.cache.ptt, rig->state.cache.split);
// we can't query VFOB while in transmit and split mode // we can't query VFOB while in transmit and split mode
if (rig->state.cache.ptt && vfo==RIG_VFO_B && rig->state.cache.split) if (rig->state.cache.ptt && vfo == RIG_VFO_B && rig->state.cache.split)
{ {
*freq = rig->state.cache.freqMainB; *freq = rig->state.cache.freqMainB;
return RIG_OK; return RIG_OK;
@ -1618,7 +1619,7 @@ static int ft817_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{ {
return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
case RIG_FUNC_CSQL: case RIG_FUNC_CSQL:
if (status) if (status)
{ {
@ -1627,8 +1628,8 @@ static int ft817_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
else else
{ {
return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
case RIG_FUNC_RIT: case RIG_FUNC_RIT:
if (status) if (status)
{ {
@ -1799,7 +1800,7 @@ static int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
} }
/* the rig rejects if these are repeated - don't confuse user with retcode */ /* the rig rejects if these are repeated - don't confuse user with retcode */
/* not used anymore, RIG_FUNC_RIT implemented /* not used anymore, RIG_FUNC_RIT implemented
if (rit == 0) if (rit == 0)
{ {

Wyświetl plik

@ -1158,7 +1158,7 @@ int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{ {
return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
case RIG_FUNC_RIT: case RIG_FUNC_RIT:
if (status) if (status)
{ {
@ -1167,9 +1167,10 @@ int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
else else
{ {
return ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_OFF); return ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_OFF);
} }
#if 0 #if 0
case RIG_FUNC_CODE: /* this doesn't exist */ case RIG_FUNC_CODE: /* this doesn't exist */
if (status) if (status)
{ {
@ -1179,6 +1180,7 @@ int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{ {
return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
#endif #endif
default: default:
@ -1345,7 +1347,7 @@ int ft857_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
} }
/* the rig rejects if these are repeated - don't confuse user with retcode */ /* the rig rejects if these are repeated - don't confuse user with retcode */
/* not used anymore, RIG_FUNC_RIT implemented /* not used anymore, RIG_FUNC_RIT implemented
if (rit == 0) if (rit == 0)
{ {

Wyświetl plik

@ -1325,8 +1325,8 @@ int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{ {
return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
case RIG_FUNC_RIT: case RIG_FUNC_RIT:
if (status) if (status)
{ {
return ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_ON); return ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_ON);
@ -1337,6 +1337,7 @@ int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
} }
#if 0 #if 0
case RIG_FUNC_CODE: /* this doesn't exist */ case RIG_FUNC_CODE: /* this doesn't exist */
if (status) if (status)
{ {
@ -1346,6 +1347,7 @@ int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{ {
return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF);
} }
#endif #endif
default: default:
@ -1512,7 +1514,7 @@ int ft897_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
} }
/* the rig rejects if these are repeated - don't confuse user with retcode */ /* the rig rejects if these are repeated - don't confuse user with retcode */
/* not used anymore, RIG_FUNC_RIT implemented /* not used anymore, RIG_FUNC_RIT implemented
if (rit == 0) if (rit == 0)
{ {

Wyświetl plik

@ -236,34 +236,34 @@ const struct rig_caps ft991_caps =
{FT991_RTTY_DATA_RX_MODES, Hz(2400)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(2400)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(2000)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(2000)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(1700)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(1700)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(1400)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(1400)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(1200)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(1200)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(800)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(800)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(450)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(450)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(400)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(400)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(350)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(350)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(250)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(250)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(200)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(200)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(150)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(150)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(100)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(100)}, /* RTTY, DATA */
{FT991_RTTY_DATA_RX_MODES, Hz(50)}, /* RTTY, DATA */ {FT991_RTTY_DATA_RX_MODES, Hz(50)}, /* RTTY, DATA */
{FT991_CW_RX_MODES, Hz(2400)}, /* Normal CW */ {FT991_CW_RX_MODES, Hz(2400)}, /* Normal CW */
{FT991_CW_RX_MODES, Hz(500)}, /* Narrow CW */ {FT991_CW_RX_MODES, Hz(500)}, /* Narrow CW */
{FT991_CW_RX_MODES, Hz(3000)}, /* Wide CW */ {FT991_CW_RX_MODES, Hz(3000)}, /* Wide CW */
{FT991_CW_RX_MODES, Hz(2000)}, /* CW */ {FT991_CW_RX_MODES, Hz(2000)}, /* CW */
{FT991_CW_RX_MODES, Hz(1700)}, /* CW */ {FT991_CW_RX_MODES, Hz(1700)}, /* CW */
{FT991_CW_RX_MODES, Hz(1400)}, /* CW */ {FT991_CW_RX_MODES, Hz(1400)}, /* CW */
{FT991_CW_RX_MODES, Hz(1200)}, /* CW */ {FT991_CW_RX_MODES, Hz(1200)}, /* CW */
{FT991_CW_RX_MODES, Hz(800)}, /* CW */ {FT991_CW_RX_MODES, Hz(800)}, /* CW */
{FT991_CW_RX_MODES, Hz(450)}, /* CW */ {FT991_CW_RX_MODES, Hz(450)}, /* CW */
{FT991_CW_RX_MODES, Hz(400)}, /* CW */ {FT991_CW_RX_MODES, Hz(400)}, /* CW */
{FT991_CW_RX_MODES, Hz(350)}, /* CW */ {FT991_CW_RX_MODES, Hz(350)}, /* CW */
{FT991_CW_RX_MODES, Hz(300)}, /* CW */ {FT991_CW_RX_MODES, Hz(300)}, /* CW */
{FT991_CW_RX_MODES, Hz(250)}, /* CW */ {FT991_CW_RX_MODES, Hz(250)}, /* CW */
{FT991_CW_RX_MODES, Hz(200)}, /* CW */ {FT991_CW_RX_MODES, Hz(200)}, /* CW */
{FT991_CW_RX_MODES, Hz(150)}, /* CW */ {FT991_CW_RX_MODES, Hz(150)}, /* CW */
{FT991_CW_RX_MODES, Hz(100)}, /* CW */ {FT991_CW_RX_MODES, Hz(100)}, /* CW */
{FT991_CW_RX_MODES, Hz(50)}, /* CW */ {FT991_CW_RX_MODES, Hz(50)}, /* CW */
{RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */
{RIG_MODE_SSB, Hz(1500)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(1500)}, /* Narrow SSB */
{RIG_MODE_SSB, Hz(3200)}, /* Wide SSB */ {RIG_MODE_SSB, Hz(3200)}, /* Wide SSB */
@ -274,7 +274,7 @@ const struct rig_caps ft991_caps =
{RIG_MODE_SSB, Hz(2600)}, /* SSB */ {RIG_MODE_SSB, Hz(2600)}, /* SSB */
{RIG_MODE_SSB, Hz(2500)}, /* SSB */ {RIG_MODE_SSB, Hz(2500)}, /* SSB */
{RIG_MODE_SSB, Hz(2300)}, /* SSB */ {RIG_MODE_SSB, Hz(2300)}, /* SSB */
{RIG_MODE_SSB, Hz(2200)}, /* SSB */ {RIG_MODE_SSB, Hz(2200)}, /* SSB */
{RIG_MODE_SSB, Hz(2100)}, /* SSB */ {RIG_MODE_SSB, Hz(2100)}, /* SSB */
{RIG_MODE_SSB, Hz(1950)}, /* SSB */ {RIG_MODE_SSB, Hz(1950)}, /* SSB */
{RIG_MODE_SSB, Hz(1650)}, /* SSB */ {RIG_MODE_SSB, Hz(1650)}, /* SSB */

Wyświetl plik

@ -957,13 +957,13 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// we need to change vfos, BS, and change back // we need to change vfos, BS, and change back
if (!is_ft991 && !is_ft891 && newcat_valid_command(rig, "VS")) if (!is_ft991 && !is_ft891 && newcat_valid_command(rig, "VS"))
{ {
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%d;BS%02d%c", SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%d;BS%02d%c",
vfo1, newcat_band_index(freq), cat_term); vfo1, newcat_band_index(freq), cat_term);
} }
else else
{ {
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c",
newcat_band_index(freq), cat_term); newcat_band_index(freq), cat_term);
} }
@ -974,8 +974,11 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
} }
hl_usleep(500 * 1000); // wait for BS to do it's thing and swap back hl_usleep(500 * 1000); // wait for BS to do it's thing and swap back
if (newcat_valid_command(rig, "VS")) if (newcat_valid_command(rig, "VS"))
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%d;", vfo2); {
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%d;", vfo2);
}
} }
else else
{ {
@ -1667,9 +1670,9 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
// some rigs like the FT991 need time before doing anything else like set_freq // some rigs like the FT991 need time before doing anything else like set_freq
// We won't mess with CW mode -- no freq change expected hopefully // We won't mess with CW mode -- no freq change expected hopefully
if (rig->state.current_mode != RIG_MODE_CW if (rig->state.current_mode != RIG_MODE_CW
&& rig->state.current_mode != RIG_MODE_CWR && rig->state.current_mode != RIG_MODE_CWR
&& rig->state.current_mode != RIG_MODE_CWN && rig->state.current_mode != RIG_MODE_CWN
) )
{ {
hl_usleep(100 * 1000); hl_usleep(100 * 1000);
} }
@ -3257,10 +3260,12 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
ENTERFUNC; ENTERFUNC;
#if 0 // all Yaeus rigs have PS and calling this here interferes with power on #if 0 // all Yaeus rigs have PS and calling this here interferes with power on
if (!newcat_valid_command(rig, "PS")) if (!newcat_valid_command(rig, "PS"))
{ {
RETURNFUNC(-RIG_ENAVAIL); RETURNFUNC(-RIG_ENAVAIL);
} }
#endif #endif
switch (status) switch (status)
@ -4961,11 +4966,12 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{ {
RETURNFUNC(-RIG_ENAVAIL); RETURNFUNC(-RIG_ENAVAIL);
} }
if (is_ftdx9000) if (is_ftdx9000)
{ {
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RM14%c", cat_term); SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RM14%c", cat_term);
} }
else else
{ {
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RM9%c", cat_term); SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RM9%c", cat_term);
} }
@ -5518,7 +5524,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
i = 0; i = 0;
sscanf(retlvl, "%3d", &i); sscanf(retlvl, "%3d", &i);
val->f = i / 255. * 100.; val->f = i / 255. * 100.;
rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl=%s, i=%d, val=%g\n", __func__, retlvl, i, val->f); rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl=%s, i=%d, val=%g\n", __func__, retlvl,
i, val->f);
break; break;
default: default:
@ -5682,8 +5689,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
priv->cmd_str[2] = main_sub_vfo; priv->cmd_str[2] = main_sub_vfo;
} }
break; break;
case RIG_FUNC_LOCK: case RIG_FUNC_LOCK:
if (!newcat_valid_command(rig, "LK")) if (!newcat_valid_command(rig, "LK"))
{ {
@ -6009,7 +6016,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
} }
break; break;
case RIG_FUNC_CSQL: case RIG_FUNC_CSQL:
if (!newcat_valid_command(rig, "CT")) if (!newcat_valid_command(rig, "CT"))
{ {
@ -6023,7 +6030,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
priv->cmd_str[2] = main_sub_vfo; priv->cmd_str[2] = main_sub_vfo;
} }
break; break;
case RIG_FUNC_LOCK: case RIG_FUNC_LOCK:
if (!newcat_valid_command(rig, "LK")) if (!newcat_valid_command(rig, "LK"))
@ -6228,10 +6235,10 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
case RIG_FUNC_TSQL: case RIG_FUNC_TSQL:
*status = (retfunc[0] == '1') ? 1 : 0; *status = (retfunc[0] == '1') ? 1 : 0;
break; break;
case RIG_FUNC_CSQL: case RIG_FUNC_CSQL:
*status = (retfunc[0] == '3') ? 1 : 0; *status = (retfunc[0] == '3') ? 1 : 0;
break; break;
case RIG_FUNC_TUNER: case RIG_FUNC_TUNER:
*status = (retfunc[2] == '1') ? 1 : 0; *status = (retfunc[2] == '1') ? 1 : 0;
@ -10757,9 +10764,14 @@ rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width)
if (newcat_is_rig(rig, RIG_MODEL_FT991)) if (newcat_is_rig(rig, RIG_MODEL_FT991))
{ {
if (mode == 'E') if (mode == 'E')
{
*width = 16000; *width = 16000;
}
else if (mode == 'F') else if (mode == 'F')
{
*width = 9000; *width = 9000;
}
rig_debug(RIG_DEBUG_TRACE, "991A & C4FM Skip newcat_get_narrow in %s\n", rig_debug(RIG_DEBUG_TRACE, "991A & C4FM Skip newcat_get_narrow in %s\n",
__func__); __func__);
} }
@ -10780,8 +10792,9 @@ rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width)
} }
} }
} }
// don't use RETURNFUNC here as that macros expects an int for the return code // don't use RETURNFUNC here as that macros expects an int for the return code
return(newcat_mode_conv[i].mode); return (newcat_mode_conv[i].mode);
} }
} }

Wyświetl plik

@ -49,7 +49,8 @@ HAMLIB_EXPORT(void) rig_password_generate_secret(char *pass,
srand(product); srand(product);
snprintf(newpass, sizeof(newpass) - 1, "%s\t%lu\t%lu", pass, (long)rand(),(long)time(NULL)); snprintf(newpass, sizeof(newpass) - 1, "%s\t%lu\t%lu", pass, (long)rand(),
(long)time(NULL));
//printf("debug=%s\n", newpass); //printf("debug=%s\n", newpass);
char *md5str = rig_make_md5(newpass); char *md5str = rig_make_md5(newpass);

Wyświetl plik

@ -15,9 +15,9 @@ float freqB = 14074500;
char tx_vfo = '0'; char tx_vfo = '0';
char rx_vfo = '0'; char rx_vfo = '0';
vfo_t curr_vfo = RIG_VFO_A; vfo_t curr_vfo = RIG_VFO_A;
char modeA='1'; char modeA = '1';
char modeB='1'; char modeB = '1';
int width=0; int width = 0;
int ptt; int ptt;
// ID 0310 == 310, Must drop leading zero // ID 0310 == 310, Must drop leading zero
@ -200,9 +200,9 @@ int main(int argc, char *argv[])
} }
else if (strcmp(buf, "AI0;") == 0) else if (strcmp(buf, "AI0;") == 0)
{ {
usleep(50*1000); usleep(50 * 1000);
} }
else if (strcmp(buf,"AB;") == 0) else if (strcmp(buf, "AB;") == 0)
{ {
freqB = freqA; freqB = freqA;
modeB = modeA; modeB = modeA;
@ -302,7 +302,7 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "TX", 2) == 0) else if (strncmp(buf, "TX", 2) == 0)
{ {
usleep(50 * 1000); usleep(50 * 1000);
ptt = buf[2] == '0'? 0 : 1; ptt = buf[2] == '0' ? 0 : 1;
} }
else if (strcmp(buf, "EX032;") == 0) else if (strcmp(buf, "EX032;") == 0)
{ {
@ -316,17 +316,17 @@ int main(int argc, char *argv[])
if (n < 0) { perror("EX032"); } if (n < 0) { perror("EX032"); }
} }
else if (strcmp(buf,"SH0;") == 0) else if (strcmp(buf, "SH0;") == 0)
{ {
SNPRINTF(buf, sizeof(buf), "SH0%02d;", width); SNPRINTF(buf, sizeof(buf), "SH0%02d;", width);
usleep(50*1000); usleep(50 * 1000);
n = write(fd, buf, strlen(buf)); n = write(fd, buf, strlen(buf));
printf("%s n=%d\n", buf, n); printf("%s n=%d\n", buf, n);
} }
else if (strcmp(buf, "NA0;") == 0) else if (strcmp(buf, "NA0;") == 0)
{ {
SNPRINTF(buf, sizeof(buf), "NA00;"); SNPRINTF(buf, sizeof(buf), "NA00;");
usleep(50*1000); usleep(50 * 1000);
n = write(fd, buf, strlen(buf)); n = write(fd, buf, strlen(buf));
printf("%s n=%d\n", buf, n); printf("%s n=%d\n", buf, n);
} }

Wyświetl plik

@ -141,7 +141,7 @@ int main(int argc, char *argv[])
if (n <= 0) { perror("IF"); } if (n <= 0) { perror("IF"); }
} }
else if (strcmp(buf,"FW;")==0) else if (strcmp(buf, "FW;") == 0)
{ {
usleep(50 * 1000); usleep(50 * 1000);
pbuf = "FW2400;"; pbuf = "FW2400;";

Wyświetl plik

@ -15,11 +15,11 @@ float freqB = 14074500;
char tx_vfo = '0'; char tx_vfo = '0';
char rx_vfo = '0'; char rx_vfo = '0';
vfo_t curr_vfo = RIG_VFO_A; vfo_t curr_vfo = RIG_VFO_A;
char modeA='1'; char modeA = '1';
char modeB='1'; char modeB = '1';
int width=0; int width = 0;
int ptt; int ptt;
int power=1; int power = 1;
// ID 0310 == 310, Must drop leading zero // ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e typedef enum nc_rigid_e
@ -121,16 +121,18 @@ int main(int argc, char *argv[])
continue; continue;
} }
if (power==0 && strcmp(buf,"PS1;")!=0) continue; if (power == 0 && strcmp(buf, "PS1;") != 0) { continue; }
if (strcmp(buf, "PS;") == 0) if (strcmp(buf, "PS;") == 0)
{ {
sprintf(resp, "PS%d;", power); sprintf(resp, "PS%d;", power);
n = write(fd, resp, strlen(resp)); n = write(fd, resp, strlen(resp));
if (n <= 0) { perror("PS"); } if (n <= 0) { perror("PS"); }
} }
else if (strncmp(buf, "PS", 2) == 0) else if (strncmp(buf, "PS", 2) == 0)
{ {
sscanf(buf,"PS%d", &power); sscanf(buf, "PS%d", &power);
} }
else if (strcmp(buf, "RM5;") == 0) else if (strcmp(buf, "RM5;") == 0)
{ {
@ -236,9 +238,9 @@ int main(int argc, char *argv[])
} }
else if (strcmp(buf, "AI0;") == 0) else if (strcmp(buf, "AI0;") == 0)
{ {
usleep(50*1000); usleep(50 * 1000);
} }
else if (strcmp(buf,"AB;") == 0) else if (strcmp(buf, "AB;") == 0)
{ {
freqB = freqA; freqB = freqA;
modeB = modeA; modeB = modeA;
@ -338,7 +340,7 @@ int main(int argc, char *argv[])
else if (strncmp(buf, "TX", 2) == 0) else if (strncmp(buf, "TX", 2) == 0)
{ {
usleep(50 * 1000); usleep(50 * 1000);
ptt = buf[2] == '0'? 0 : 1; ptt = buf[2] == '0' ? 0 : 1;
} }
else if (strcmp(buf, "EX032;") == 0) else if (strcmp(buf, "EX032;") == 0)
{ {
@ -352,17 +354,17 @@ int main(int argc, char *argv[])
if (n < 0) { perror("EX032"); } if (n < 0) { perror("EX032"); }
} }
else if (strcmp(buf,"SH0;") == 0) else if (strcmp(buf, "SH0;") == 0)
{ {
SNPRINTF(buf, sizeof(buf), "SH0%02d;", width); SNPRINTF(buf, sizeof(buf), "SH0%02d;", width);
usleep(50*1000); usleep(50 * 1000);
n = write(fd, buf, strlen(buf)); n = write(fd, buf, strlen(buf));
printf("%s n=%d\n", buf, n); printf("%s n=%d\n", buf, n);
} }
else if (strcmp(buf, "NA0;") == 0) else if (strcmp(buf, "NA0;") == 0)
{ {
SNPRINTF(buf, sizeof(buf), "NA00;"); SNPRINTF(buf, sizeof(buf), "NA00;");
usleep(50*1000); usleep(50 * 1000);
n = write(fd, buf, strlen(buf)); n = write(fd, buf, strlen(buf));
//printf("%s n=%d\n", buf, n); //printf("%s n=%d\n", buf, n);
} }

Wyświetl plik

@ -502,16 +502,18 @@ static int port_read_sync_data(hamlib_port_t *p, void *buf, size_t count)
case ERROR_IO_PENDING: case ERROR_IO_PENDING:
TRACE; TRACE;
timeout.QuadPart = (p->timeout * -1000000LL); timeout.QuadPart = (p->timeout * -1000000LL);
if((result = SetWaitableTimer(hLocal, &timeout, 0, NULL, NULL, 0)) == 0)
if ((result = SetWaitableTimer(hLocal, &timeout, 0, NULL, NULL, 0)) == 0)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: SetWaitableTimer error: %d\n", __func__, result); rig_debug(RIG_DEBUG_ERR, "%s: SetWaitableTimer error: %d\n", __func__, result);
wait_result = WaitForMultipleObjects(3, event_handles, FALSE, INFINITE); wait_result = WaitForMultipleObjects(3, event_handles, FALSE, INFINITE);
} }
else else
{ {
wait_result = WaitForMultipleObjects(3, event_handles, FALSE, p->timeout); wait_result = WaitForMultipleObjects(3, event_handles, FALSE, p->timeout);
} }
TRACE; TRACE;
switch (wait_result) switch (wait_result)

Wyświetl plik

@ -315,21 +315,24 @@ void add2debugmsgsave(const char *s)
{ {
int l1 = strlen(debugmsgsave); int l1 = strlen(debugmsgsave);
int l2 = strlen(s); int l2 = strlen(s);
int l3 = sizeof(debugmsgsave)-2; int l3 = sizeof(debugmsgsave) - 2;
while(l1 + l2 > l3)
while (l1 + l2 > l3)
{ {
char *p=strchr(debugmsgsave,'\n'); char *p = strchr(debugmsgsave, '\n');
memmove(debugmsgsave,p+1,strlen(p+1)+1); // include null byte memmove(debugmsgsave, p + 1, strlen(p + 1) + 1); // include null byte
l1 = strlen(debugmsgsave); l1 = strlen(debugmsgsave);
if (l1==0)
if (l1 == 0)
{ {
//rig_debug(RIG_DEBUG_ERR, "%s: debugmsgsave criticl error...overflow\n"); //rig_debug(RIG_DEBUG_ERR, "%s: debugmsgsave criticl error...overflow\n");
// we'll keep some of whatever this thing is // we'll keep some of whatever this thing is
strncat(debugmsgsave, p, sizeof(debugmsgsave)/2); strncat(debugmsgsave, p, sizeof(debugmsgsave) / 2);
return; return;
} }
} }
strcat(debugmsgsave,s);
strcat(debugmsgsave, s);
} }
@ -360,6 +363,7 @@ const char *HAMLIB_API rigerror(int errnum)
char *p = &debugmsgsave[strlen(debugmsgsave) - 1]; char *p = &debugmsgsave[strlen(debugmsgsave) - 1];
if (*p == '\n') { *p = 0; } if (*p == '\n') { *p = 0; }
#endif #endif
#if 0 #if 0
@ -776,7 +780,8 @@ int HAMLIB_API rig_open(RIG *rig)
// Read in our settings // Read in our settings
char *cwd = malloc(4096); char *cwd = malloc(4096);
if(getcwd(cwd,4096)==NULL)
if (getcwd(cwd, 4096) == NULL)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: getcwd: %s\n", __func__, strerror(errno)); rig_debug(RIG_DEBUG_ERR, "%s: getcwd: %s\n", __func__, strerror(errno));
} }
@ -787,13 +792,16 @@ int HAMLIB_API rig_open(RIG *rig)
extern char *settings_file; extern char *settings_file;
sprintf(path, "%s/%s", cwd, settings_file); sprintf(path, "%s/%s", cwd, settings_file);
FILE *fp = fopen(path, "r"); FILE *fp = fopen(path, "r");
if (fp == NULL) if (fp == NULL)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s does not exist\n", __func__, path); rig_debug(RIG_DEBUG_VERBOSE, "%s: %s does not exist\n", __func__, path);
} }
else { else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: reading settings from %s\n", __func__, path); rig_debug(RIG_DEBUG_VERBOSE, "%s: reading settings from %s\n", __func__, path);
} }
free(path); free(path);
} }
@ -851,7 +859,7 @@ int HAMLIB_API rig_open(RIG *rig)
if (rig->caps->rig_model != RIG_MODEL_X6100) if (rig->caps->rig_model != RIG_MODEL_X6100)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s(%d): Icom rig UDP network enabled\n", __FILE__, rig_debug(RIG_DEBUG_TRACE, "%s(%d): Icom rig UDP network enabled\n", __FILE__,
__LINE__); __LINE__);
rs->rigport.type.rig = RIG_PORT_UDP_NETWORK; rs->rigport.type.rig = RIG_PORT_UDP_NETWORK;
} }
@ -2007,10 +2015,16 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
} }
if (retcode == RIG_OK) if (retcode == RIG_OK)
{
rig_cache_show(rig, __func__, __LINE__); rig_cache_show(rig, __func__, __LINE__);
}
rig_set_cache_freq(rig, vfo, *freq); rig_set_cache_freq(rig, vfo, *freq);
if (retcode == RIG_OK) if (retcode == RIG_OK)
{
rig_cache_show(rig, __func__, __LINE__); rig_cache_show(rig, __func__, __LINE__);
}
ELAPSED2; ELAPSED2;
return (retcode); return (retcode);
@ -4545,7 +4559,8 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
ELAPSED1; ELAPSED1;
ENTERFUNC; ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: rx_vfo=%s, split=%d, tx_vfo=%s, cache.split=%d\n", __func__, rig_debug(RIG_DEBUG_VERBOSE,
"%s: rx_vfo=%s, split=%d, tx_vfo=%s, cache.split=%d\n", __func__,
rig_strvfo(rx_vfo), split, rig_strvfo(tx_vfo), rig->state.cache.split); rig_strvfo(rx_vfo), split, rig_strvfo(tx_vfo), rig->state.cache.split);
if (CHECK_RIG_ARG(rig)) if (CHECK_RIG_ARG(rig))
@ -4588,7 +4603,8 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
tx_vfo = vfo_fixup(rig, tx_vfo, split); tx_vfo = vfo_fixup(rig, tx_vfo, split);
rig->state.rx_vfo = rx_vfo; rig->state.rx_vfo = rx_vfo;
rig->state.tx_vfo = tx_vfo; rig->state.tx_vfo = tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: final rxvfo=%s, txvfo=%s, split=%d\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: final rxvfo=%s, txvfo=%s, split=%d\n",
__func__,
rig_strvfo(rx_vfo), rig_strvfo(tx_vfo), rig->state.cache.split); rig_strvfo(rx_vfo), rig_strvfo(tx_vfo), rig->state.cache.split);
} }
@ -4769,7 +4785,8 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
rig->state.cache.split = *split; rig->state.cache.split = *split;
rig->state.cache.split_vfo = *tx_vfo; rig->state.cache.split_vfo = *tx_vfo;
elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET); elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET);
rig_debug(RIG_DEBUG_TRACE, "%s: cache.split=%d\n", __func__, rig->state.cache.split); rig_debug(RIG_DEBUG_TRACE, "%s: cache.split=%d\n", __func__,
rig->state.cache.split);
} }
ELAPSED2; ELAPSED2;
RETURNFUNC(retcode); RETURNFUNC(retcode);
@ -4810,7 +4827,8 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
rig->state.cache.split = *split; rig->state.cache.split = *split;
rig->state.cache.split_vfo = *tx_vfo; rig->state.cache.split_vfo = *tx_vfo;
elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET); elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_SET);
rig_debug(RIG_DEBUG_TRACE, "%s(%d): cache.split=%d\n", __func__, __LINE__, rig->state.cache.split); rig_debug(RIG_DEBUG_TRACE, "%s(%d): cache.split=%d\n", __func__, __LINE__,
rig->state.cache.split);
} }
ELAPSED2; ELAPSED2;
@ -5830,9 +5848,10 @@ int HAMLIB_API rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
caps = rig->caps; caps = rig->caps;
if (caps->vfo_op == NULL || rig_has_vfo_op(rig, op)==0) if (caps->vfo_op == NULL || rig_has_vfo_op(rig, op) == 0)
{ {
rig_debug(RIG_DEBUG_WARN, "%s: vfo_op=%p, has_vfo_op=%d\n", __func__, caps->vfo_op, rig_has_vfo_op(rig, op)); rig_debug(RIG_DEBUG_WARN, "%s: vfo_op=%p, has_vfo_op=%d\n", __func__,
caps->vfo_op, rig_has_vfo_op(rig, op));
RETURNFUNC(-RIG_ENAVAIL); RETURNFUNC(-RIG_ENAVAIL);
} }

Wyświetl plik

@ -985,20 +985,21 @@ char *settings_file = SETTINGS_FILE;
* \sa rig_setting_load() * \sa rig_setting_load()
*/ */
HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value, HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
settings_value_t valuetype) settings_value_t valuetype)
{ {
FILE *fp = fopen(settings_file, "r"); FILE *fp = fopen(settings_file, "r");
FILE *fptmp; FILE *fptmp;
char buf[4096]; char buf[4096];
char *cvalue = (char*)value; char *cvalue = (char *)value;
int *ivalue = (int*)value; int *ivalue = (int *)value;
long *lvalue = (long*) value; long *lvalue = (long *) value;
float *fvalue = (float*) value; float *fvalue = (float *) value;
double *dvalue = (double*) value; double *dvalue = (double *) value;
char *vformat; char *vformat;
char template[64]; char template[64];
strcpy(template,"hamlib_settings_XXXXXX"); strcpy(template, "hamlib_settings_XXXXXX");
switch (valuetype) switch (valuetype)
{ {
case e_CHAR: cvalue = (char *)value; vformat = "%s=%s\n"; break; case e_CHAR: cvalue = (char *)value; vformat = "%s=%s\n"; break;
@ -1076,6 +1077,7 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
fclose(fptmp); fclose(fptmp);
return -RIG_EINTERNAL; return -RIG_EINTERNAL;
} }
fprintf(fptmp, vformat, s, value); fprintf(fptmp, vformat, s, value);
} }
@ -1087,30 +1089,35 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
} }
HAMLIB_EXPORT(int) rig_settings_load(char *setting, void *value, HAMLIB_EXPORT(int) rig_settings_load(char *setting, void *value,
settings_value_t valuetype) settings_value_t valuetype)
{ {
return -RIG_ENIMPL; return -RIG_ENIMPL;
} }
HAMLIB_EXPORT(int) rig_settings_load_all(char * settings_file) HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file)
{ {
FILE *fp = fopen(settings_file, "r"); FILE *fp = fopen(settings_file, "r");
char buf[4096]; char buf[4096];
if (fp == NULL) if (fp == NULL)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: settings_file error(%s): %s\n", __func__, settings_file, strerror(errno)); rig_debug(RIG_DEBUG_ERR, "%s: settings_file error(%s): %s\n", __func__,
settings_file, strerror(errno));
return -RIG_EINVAL; return -RIG_EINVAL;
} }
while(fgets(buf,sizeof(buf),fp))
while (fgets(buf, sizeof(buf), fp))
{ {
char *s = strtok(buf,"="); char *s = strtok(buf, "=");
char *v = strtok(NULL, "\r\n"); char *v = strtok(NULL, "\r\n");
if (strcmp(s,"sharedkey")==0)
if (strcmp(s, "sharedkey") == 0)
{ {
//sharedkey = strdup(v); //sharedkey = strdup(v);
//rig_debug(RIG_DEBUG_TRACE, "%s: settings_file=%s, shared_key=%s\n", __func__, settings_file, sharedkey); //rig_debug(RIG_DEBUG_TRACE, "%s: settings_file=%s, shared_key=%s\n", __func__, settings_file, sharedkey);
} }
} }
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -96,7 +96,7 @@ extern int read_history();
static int chk_vfo_executed; static int chk_vfo_executed;
char rigctld_password[64]; char rigctld_password[64];
int is_passwordOK; int is_passwordOK;
int is_rigctld; int is_rigctld;
@ -680,7 +680,8 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
{ {
if ((retcode = scanfc(fin, "%c", &cmd)) < 1) if ((retcode = scanfc(fin, "%c", &cmd)) < 1)
{ {
rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=%c\n", __func__, rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=%c\n",
__func__,
retcode, last_cmd); retcode, last_cmd);
return (RIGCTL_PARSE_ERROR); return (RIGCTL_PARSE_ERROR);
} }
@ -759,7 +760,8 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
*pcmd = '\0'; *pcmd = '\0';
cmd = parse_arg((char *)cmd_name); cmd = parse_arg((char *)cmd_name);
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s handle=%d\n", __func__, cmd_name, fileno(fin)); rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s handle=%d\n", __func__, cmd_name,
fileno(fin));
break; break;
} }
@ -1711,19 +1713,19 @@ readline_repeat:
else else
{ {
retcode = (*cmd_entry->rig_routine)(my_rig, retcode = (*cmd_entry->rig_routine)(my_rig,
fout, fout,
fin, fin,
interactive, interactive,
prompt, prompt,
vfo_opt, vfo_opt,
send_cmd_term, send_cmd_term,
*ext_resp_ptr, *ext_resp_ptr,
*resp_sep_ptr, *resp_sep_ptr,
cmd_entry, cmd_entry,
vfo, vfo,
p1, p1,
p2 ? p2 : "", p2 ? p2 : "",
p3 ? p3 : ""); p3 ? p3 : "");
} }

Wyświetl plik

@ -1523,7 +1523,8 @@ static int handle_ts2000(void *arg)
{ {
freq_t freq; freq_t freq;
vfo_t vfo = RIG_VFO_A; vfo_t vfo = RIG_VFO_A;
if (mapa2b) vfo = RIG_VFO_B;
if (mapa2b) { vfo = RIG_VFO_B; }
sscanf((char *)arg + 2, "%"SCNfreq, &freq); sscanf((char *)arg + 2, "%"SCNfreq, &freq);
return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo, return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo,

Wyświetl plik

@ -306,7 +306,7 @@ int main(int argc, char *argv[])
case 'A': case 'A':
strncpy(rigctld_password, optarg, sizeof(rigctld_password) - 1); strncpy(rigctld_password, optarg, sizeof(rigctld_password) - 1);
//char *md5 = rig_make_m d5(rigctld_password); //char *md5 = rig_make_m d5(rigctld_password);
char md5[HAMLIB_SECRET_LENGTH+1]; char md5[HAMLIB_SECRET_LENGTH + 1];
rig_password_generate_secret(rigctld_password, md5); rig_password_generate_secret(rigctld_password, md5);
printf("Secret key: %s\n", md5); printf("Secret key: %s\n", md5);
rig_settings_save("sharedkey", md5, e_CHAR); rig_settings_save("sharedkey", md5, e_CHAR);
@ -632,7 +632,8 @@ int main(int argc, char *argv[])
rig_debug(RIG_DEBUG_VERBOSE, "rigctld %s\n", hamlib_version2); rig_debug(RIG_DEBUG_VERBOSE, "rigctld %s\n", hamlib_version2);
rig_debug(RIG_DEBUG_VERBOSE, "%s", rig_debug(RIG_DEBUG_VERBOSE, "%s",
"Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n"); "Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n");
rig_debug(RIG_DEBUG_VERBOSE, "Max# of rigctld client services=%d\n", NI_MAXSERV); rig_debug(RIG_DEBUG_VERBOSE, "Max# of rigctld client services=%d\n",
NI_MAXSERV);
my_rig = rig_init(my_model); my_rig = rig_init(my_model);
@ -1067,6 +1068,7 @@ int main(int argc, char *argv[])
/* allow threads to finish current action */ /* allow threads to finish current action */
mutex_rigctld(1); mutex_rigctld(1);
TRACE; TRACE;
if (client_count) if (client_count)
{ {
rig_debug(RIG_DEBUG_WARN, "%u outstanding client(s)\n", client_count); rig_debug(RIG_DEBUG_WARN, "%u outstanding client(s)\n", client_count);