Merge remote-tracking branch 'Hamlib/master'

pull/179/head
Malcolm Herring 2020-01-18 05:59:49 +00:00
commit 85541cc257
127 zmienionych plików z 900 dodań i 843 usunięć

Wyświetl plik

@ -691,7 +691,7 @@ int adat_parse_freq(char *pcStr,
if (pcStr != NULL)
{
int _nVFO = 0;
freq_t _nFreq = 0;
freq_t _nFreq;
char *pcEnd = NULL;
@ -2636,9 +2636,9 @@ adat_priv_data_ptr adat_new_priv_data(RIG *pRig)
{
// Init Priv Data
pPriv = (adat_priv_data_ptr) calloc(sizeof(adat_priv_data_t), 1);
pRig->state.priv = (adat_priv_data_ptr) calloc(sizeof(adat_priv_data_t), 1);
if (pPriv != NULL)
if (pRig->state.priv != NULL)
{
char acBuf[ ADAT_BUFSZ + 1 ];
memset(acBuf, 0, ADAT_BUFSZ + 1);
@ -2654,8 +2654,6 @@ adat_priv_data_ptr adat_new_priv_data(RIG *pRig)
pRig->state.priv = (void *) pPriv;
}
#else
pRig->state.priv = (void *) pPriv;
#endif
}
else
@ -2886,8 +2884,9 @@ int adat_close(RIG *pRig)
int nRC = RIG_OK;
adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv;
if (pPriv->pcCmd != NULL) free(pPriv->pcCmd);
if (pPriv->pcResult != NULL) free(pPriv->pcResult);
if (pPriv->pcCmd != NULL) { free(pPriv->pcCmd); }
if (pPriv->pcResult != NULL) { free(pPriv->pcResult); }
gFnLevel++;
@ -2895,18 +2894,9 @@ int adat_close(RIG *pRig)
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = %p\n",
gFnLevel, __func__, __FILE__, __LINE__, pRig);
// Check Params
// Now switch to interactive mode
if (pRig == NULL)
{
nRC = -RIG_EARG;
}
else
{
// Now switch to interactive mode
nRC = adat_transaction(pRig, &adat_cmd_list_close_adat);
}
nRC = adat_transaction(pRig, &adat_cmd_list_close_adat);
// Done !
@ -2925,7 +2915,6 @@ int adat_close(RIG *pRig)
// Status: RELEASED
const char *adat_get_info(RIG *pRig)
{
int nRC = RIG_OK;
static char acBuf[ 512 ];
gFnLevel++;
@ -2938,7 +2927,7 @@ const char *adat_get_info(RIG *pRig)
if (pRig != NULL)
{
nRC = adat_transaction(pRig, &adat_cmd_list_get_info);
int nRC = adat_transaction(pRig, &adat_cmd_list_get_info);
if (nRC == RIG_OK)
{
@ -3524,7 +3513,8 @@ int adat_set_conf(RIG *pRig, token_t token, const char *val)
switch (token)
{
case TOKEN_ADAT_PRODUCT_NAME:
if (pPriv->pcProductName != NULL) free(pPriv->pcProductName);
if (pPriv->pcProductName != NULL) { free(pPriv->pcProductName); }
pPriv->pcProductName = strdup(val);
break;

Wyświetl plik

@ -106,6 +106,13 @@ int alinco_transaction(RIG *rig,
struct rig_state *rs;
char echobuf[BUFSZ + 1];
if (cmd == NULL)
{
rig_debug(RIG_DEBUG_ERR,
"%s: null argument for cmd?\n", __func__);
return -RIG_EINTERNAL;
}
rs = &rig->state;
serial_flush(&rs->rigport);
@ -128,8 +135,14 @@ int alinco_transaction(RIG *rig,
return retval;
}
if (!(data && data_len))
{
rig_debug(RIG_DEBUG_ERR, "%s: data and datalen not both NULL??\n", __func__);
return -RIG_EINTERNAL;
}
/* no data expected, check for OK returned */
if (!data || !data_len)
if (data == NULL)
{
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF));
@ -163,8 +176,14 @@ int alinco_transaction(RIG *rig,
/* strip CR/LF from string
*/
*data_len -= 2;
data[*data_len] = 0;
data[0] = 0;
if (*data_len > 2)
{
*data_len -= 2;
data[*data_len] = 0;
}
return RIG_OK;
}
@ -816,6 +835,7 @@ int alinco_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_CWPITCH:
lvl = 4;
if (val.i < 426)
{
lvl = 5;

Wyświetl plik

@ -79,7 +79,7 @@ const struct rig_caps dx77_caps =
.rig_model = RIG_MODEL_DX77,
.model_name = "DX-77",
.mfg_name = "Alinco",
.version = "0.8",
.version = "0.9",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -59,8 +59,6 @@ const struct fault_list kpa_fault_list [] =
int kpa_init(AMP *amp)
{
struct kpa_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!amp)
@ -68,21 +66,30 @@ int kpa_init(AMP *amp)
return -RIG_EINVAL;
}
priv = (struct kpa_priv_data *)
amp->state.priv = (struct kpa_priv_data *)
malloc(sizeof(struct kpa_priv_data));
if (!priv)
if (!amp->state.priv)
{
return -RIG_ENOMEM;
}
amp->state.priv = (void *)priv;
amp->state.ampport.type.rig = RIG_PORT_SERIAL;
return RIG_OK;
}
int kpa_close(AMP *amp)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (amp->state.priv) { free(amp->state.priv); }
amp->state.priv = NULL;
return RIG_OK;
}
int kpa_flushbuffer(AMP *amp)
{
struct amp_state *rs;

Wyświetl plik

@ -40,21 +40,23 @@ extern const struct amp_caps kpa1500_rot_caps;
*/
struct kpa_priv_data
{
char tmpbuf[256]; // for unknown error msg
char tmpbuf[256]; // for unknown error msg
};
int kpa_init(AMP *amp);
int kpa_close(AMP *amp);
int kpa_reset(AMP *amp, amp_reset_t reset);
int kpa_flush_buffer(AMP *amp);
int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len);
const char *kpa_get_info (AMP *amp);
int kpa_get_freq (AMP *amp, freq_t *freq);
int kpa_set_freq (AMP *amp, freq_t freq);
int kpa_transaction(AMP *amp, const char *cmd, char *response,
int response_len);
const char *kpa_get_info(AMP *amp);
int kpa_get_freq(AMP *amp, freq_t *freq);
int kpa_set_freq(AMP *amp, freq_t freq);
int kpa_get_level (AMP *amp, setting_t level, value_t *val);
int kpa_get_powerstat (AMP *amp, powerstat_t *status);
int kpa_set_powerstat (AMP *amp, powerstat_t status);
int kpa_get_level(AMP *amp, setting_t level, value_t *val);
int kpa_get_powerstat(AMP *amp, powerstat_t *status);
int kpa_set_powerstat(AMP *amp, powerstat_t status);
#endif /* _AMP_ELECRAFT_H */

Wyświetl plik

@ -41,8 +41,6 @@ struct kpa_priv_data *kpa1500_priv;
*
*/
static int kpa1500_cleanup(AMP *amp);
/*
* Private helper function prototypes
*/
@ -67,7 +65,7 @@ const struct amp_caps kpa1500_amp_caps =
.amp_model = AMP_MODEL_ELECRAFT_KPA1500,
.model_name = "KPA1500",
.mfg_name = "Elecraft",
.version = "2019-12-06",
.version = "2020-01-12",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.amp_type = AMP_TYPE_OTHER,
@ -85,7 +83,7 @@ const struct amp_caps kpa1500_amp_caps =
.amp_open = amp_open,
.amp_init = kpa_init,
.amp_cleanup = kpa1500_cleanup,
.amp_close = kpa_close,
.reset = kpa_reset,
.get_info = kpa_get_info,
.get_powerstat = kpa_get_powerstat,
@ -103,31 +101,6 @@ const struct amp_caps kpa1500_amp_caps =
* ************************************
*/
/*
* Clean up allocated memory structures
*/
static int kpa1500_cleanup(AMP *amp)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!amp)
{
return -RIG_EINVAL;
}
if (amp->state.priv)
{
free(amp->state.priv);
}
amp->state.priv = NULL;
return RIG_OK;
}
/*
*
*/

Wyświetl plik

@ -635,7 +635,7 @@ int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
/* should be caught by the front end */
if ((val.i != 0) & (i >= MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])))
if ((val.i != 0) && (i >= MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])))
{
return -RIG_EINVAL;
}

Wyświetl plik

@ -24,7 +24,7 @@
#include <hamlib/rig.h>
#define BACKEND_VER "0.6"
#define BACKEND_VER "0.7"
int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width);

Wyświetl plik

@ -283,18 +283,18 @@ int ar3030_init(RIG *rig)
{
struct ar3030_priv_data *priv;
priv = malloc(sizeof(struct ar3030_priv_data));
rig->state.priv = malloc(sizeof(struct ar3030_priv_data));
if (!priv)
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->curr_ch = 99; /* huh! FIXME: get_mem in open() ? */
priv->curr_vfo = RIG_VFO_A;
rig->state.priv = priv;
return RIG_OK;
}

Wyświetl plik

@ -406,10 +406,11 @@ static int ar7030p_open(RIG *rig)
{
rc = getFilterBW(rig, i);
if (0 > rc)
if (rc < 0)
{
rc = -RIG_EIO;
break;
rig_debug(RIG_DEBUG_ERR, "%s: err in getFilterBW: %s\n", __func__,
strerror(rc));
return rc;
}
else
{
@ -516,9 +517,10 @@ static int ar7030p_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// this RIG_OK check added to clear cppcheck warnings
// not sure if it's needed but seem like RIG_OK should be expected
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK) {
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
}
rc = execRoutine(rig, SET_ALL);
@ -573,9 +575,10 @@ static int ar7030p_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// this RIG_OK check added to clear cppcheck warnings
// not sure if it's needed but seem like RIG_OK should be expected
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK) {
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
}
rc = lockRx(rig, LOCK_0);
@ -597,44 +600,35 @@ static int ar7030p_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width)
{
int rc = RIG_OK;
unsigned char ar_mode = (unsigned char) USB;
unsigned char ar_filter = (unsigned char) FILTER_3;
rc = lockRx(rig, LOCK_1);
if (RIG_OK == rc)
{
/* TODO - deal with selected VFO */
ar_mode = modeToNative(mode);
unsigned char ar_mode = modeToNative(mode);
rc = writeByte(rig, WORKING, MODE, ar_mode);
if (RIG_OK == rc && width != RIG_PASSBAND_NOCHANGE)
{
if (RIG_PASSBAND_NORMAL == width)
{
width = rig_passband_normal(rig, mode);
}
else
{
int i;
int i;
/* TODO - get filter BWs at startup */
ar_filter = (unsigned char) 6;
/* TODO - get filter BWs at startup */
unsigned char ar_filter = (unsigned char) 6;
for (i = 1; i <= 6; i++)
for (i = 1; i <= 6; i++)
{
if (width <= filterTab[ i ])
{
if (width <= filterTab[ i ])
if (filterTab[ i ] < filterTab[(int) ar_filter ])
{
if (filterTab[ i ] < filterTab[(int) ar_filter ])
{
ar_filter = (unsigned char) i;
}
ar_filter = (unsigned char) i;
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
__func__, (int)width, ar_filter, i, filterTab[i]);
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
__func__, (int)width, ar_filter, i, filterTab[i]);
}
rc = writeByte(rig, WORKING, FILTER, ar_filter);
@ -647,9 +641,10 @@ static int ar7030p_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
// this RIG_OK check added to clear cppcheck warnings
// not sure if it's needed but seem like RIG_OK should be expected
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK) {
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
}
rc = lockRx(rig, LOCK_0);
@ -991,9 +986,10 @@ static int ar7030p_set_level(RIG *rig, vfo_t vfo, setting_t level,
// this RIG_OK check added to clear cppcheck warnings
// not sure if it's needed but seem like RIG_OK should be expected
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK) {
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
// if this debug prints out when things are working need to reexamine
if (rc != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: unexpected error?? %s\n", __func__, rigerror(rc));
}
rc = lockRx(rig, LOCK_0);
@ -1538,7 +1534,7 @@ static int ar7030p_set_powerstat(RIG *rig, powerstat_t status)
break;
}
rc = lockRx(rig, LOCK_0);
lockRx(rig, LOCK_0);
}
return (-RIG_ENIMPL);

Wyświetl plik

@ -1015,7 +1015,7 @@ int getCalLevel(RIG *rig, unsigned char rawAgc, int *dbm)
int rc = RIG_OK;
int i;
int raw = (int) rawAgc;
int step = 10;
int step;
unsigned char v;
assert(NULL != rig);
@ -1111,7 +1111,7 @@ int getCalLevel(RIG *rig, unsigned char rawAgc, int *dbm)
*/
int getFilterBW(RIG *rig, enum FILTER_e filter)
{
int rc = -1;
int rc;
unsigned char bw;
rc = readByte(rig, BBRAM, (FL_BW + ((filter - 1) * 4)), &bw);
@ -1122,7 +1122,8 @@ int getFilterBW(RIG *rig, enum FILTER_e filter)
}
else
{
rc = -1;
rig_debug(RIG_DEBUG_ERR, "%s: readByte err: %s\n", __func__, strerror(rc));
return rc;
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: filter %1d BW %5d\n", __func__, filter, rc);

Wyświetl plik

@ -130,7 +130,7 @@ const struct rig_caps sr2200_caps =
.rig_model = RIG_MODEL_SR2200,
.model_name = "SR2200",
.mfg_name = "AOR",
.version = "0.1",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_SCANNER,
@ -648,7 +648,7 @@ int sr2200_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
/* should be caught by the front end */
if ((val.i != 0) & (i >= MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])))
if ((val.i != 0) && (i >= MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])))
{
return -RIG_EINVAL;
}

Wyświetl plik

@ -150,14 +150,16 @@ ars_init(ROT *rot)
return -RIG_EINVAL;
}
priv = (struct ars_priv_data *)malloc(sizeof(struct ars_priv_data));
rot->state.priv = (struct ars_priv_data *)malloc(sizeof(struct ars_priv_data));
if (!priv)
if (!rot->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rot->state.priv;
priv->pp_control = 0;
priv->pp_data = 0;
@ -167,8 +169,6 @@ ars_init(ROT *rot)
priv->brake_off = 0; /* i.e. brake is ON */
priv->curr_move = 0;
rot->state.priv = (void *)priv;
return RIG_OK;
}

11
cppcheck.sh 100755
Wyświetl plik

@ -0,0 +1,11 @@
# Author Michael Black W9MDB
# This SUPPRESS setting results in no warnings as of 2020-01-14
# There are things that could still be done...especialy in the C++ area
echo "See cppcheck.log when done"
echo "As of cppcheck v1.90 should be one message about missing include files"
echo "This takes several minutes to run"
# We do suppress some errors which are expected or other code
# There are quite a few C++ items to take care of still if anybody cares
SUPPRESS="-i bindings -i lib/getopt.c -i lib/getopt_long.c --suppress=*:gnuradio/demod.h --suppress=*:gnuradio/HrAGC.h --suppress=*:gnuradio/nfm.h --suppress=*:gnuradio/am.h --suppress=*:gnuradio/ssb.h --suppress=*:gnuradio/wfm.h --suppress=*:gnuradio/wfm.h --suppress=*:microtune/i2c.h --suppress=*:microtune/i2cio.h --suppress=*:microtune/i2cio_pp.h --suppress=*:microtune/microtune_4702.h --suppress=*:microtune/microtune_4937.h --suppress=*:microtune/microtune_eval_board.h -i microtune/microtune_eval_board.cc --suppress=*:gnuradio/HrAGC.h --suppress=knownConditionTrueFalse:tests/rotctl.c --suppress=knownConditionTrueFalse:tests/rigctl.c --suppress=knownConditionTrueFalse:tests/ampctl.c --suppress=knownConditionTrueFalse:tests/rotctl_parse.c --suppress=knownConditionTrueFalse:tests/rigctl_parse.c --suppress=knownConditionTrueFalse:tests/ampctl_parse.c"
CHECK="-D RIG_LEVEL_LINEOUT=1 -D SIGPIPE -D SIGINT -D IPV6_V6ONLY -D RIG_MODE_WFM -D ABI_VERSION=4 -D F_SETSIG=1 -U O_ASYNC -U SA_SIGINFO -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U __USEP5P6__"
cppcheck -q --force --enable=all --std=c99 $SUPPRESS $CHECK . &>cppcheck.log

Wyświetl plik

@ -137,16 +137,18 @@ static int dra818_setvolume(RIG *rig)
int dra818_init(RIG *rig)
{
struct dra818_priv *priv = calloc(sizeof(*priv), 1);
struct dra818_priv *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: dra818_init called\n", __func__);
if (!priv)
rig->state.priv = calloc(sizeof(*priv), 1);
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
rig->state.priv = priv;
priv = rig->state.priv;
switch (rig->caps->rig_model)
{

Wyświetl plik

@ -104,15 +104,15 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int drake_init(RIG *rig)
{
struct drake_priv_data *priv;
priv = malloc(sizeof(struct drake_priv_data));
rig->state.priv = malloc(sizeof(struct drake_priv_data));
if (!priv)
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->curr_ch = 0;
rig->state.priv = priv;
return RIG_OK;
}

Wyświetl plik

@ -60,17 +60,18 @@ static int dummy_amp_init(AMP *amp)
{
struct dummy_amp_priv_data *priv;
priv = (struct dummy_amp_priv_data *)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
amp->state.priv = (struct dummy_amp_priv_data *)
malloc(sizeof(struct dummy_amp_priv_data));
if (!priv)
if (!amp->state.priv)
{
return -RIG_ENOMEM;
}
amp->state.priv = (void *)priv;
priv = amp->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
amp->state.ampport.type.rig = RIG_PORT_NONE;
priv->freq = 0;

Wyświetl plik

@ -1541,7 +1541,7 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
if (!ret) { break; }
ret = dummy_set_freq(rig, vfo, freq + ts); /* up */
dummy_set_freq(rig, vfo, freq + ts); /* up */
break;
case RIG_OP_DOWN:
@ -1553,7 +1553,7 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
if (!ret) { break; }
ret = dummy_set_freq(rig, vfo, freq - ts); /* down */
dummy_set_freq(rig, vfo, freq - ts); /* down */
break;
default:

Wyświetl plik

@ -498,23 +498,25 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
*/
static int flrig_init(RIG *rig)
{
struct flrig_priv_data *priv = (struct flrig_priv_data *)malloc(sizeof(
struct flrig_priv_data));
struct flrig_priv_data *priv;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
rig->state.priv = (struct flrig_priv_data *)malloc(sizeof(
struct flrig_priv_data));
if (!priv)
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct flrig_priv_data));
/*
* set arbitrary initial status
*/
rig->state.priv = (rig_ptr_t) priv;
priv->curr_vfo = RIG_VFO_A;
priv->split = 0;
priv->ptt = 0;
@ -866,6 +868,9 @@ static int flrig_open(RIG *rig)
static int flrig_close(RIG *rig)
{
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
if (rig->state.priv) { free(rig->state.priv); }
return RIG_OK;
}
@ -1241,6 +1246,13 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ttmode = strdup(modeMapGetFLRig(mode));
rig_debug(RIG_DEBUG_TRACE, "%s: got ttmode = %s\n", __func__,
ttmode == NULL ? "NULL" : ttmode);
if (ttmode == NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s: strdup failed\n", __func__);
return -RIG_EINTERNAL;
}
pttmode = ttmode;
if (ttmode[0] == '|') { pttmode = &ttmode[1]; } // remove first pipe symbol

Wyświetl plik

@ -141,14 +141,15 @@ static int netrigctl_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct netrigctl_priv_data *)malloc(sizeof(
struct netrigctl_priv_data));
priv = (struct netrigctl_priv_data *)malloc(sizeof(struct netrigctl_priv_data));
if (!priv)
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct netrigctl_priv_data));
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -157,11 +158,9 @@ static int netrigctl_init(RIG *rig)
* set arbitrary initial status
* VFO will be updated in open call
*/
rig->state.priv = (rig_ptr_t) priv;
priv->vfo_curr = RIG_VFO_A;
priv->rigctld_vfo_mode = 0;
return RIG_OK;
}

Wyświetl plik

@ -53,17 +53,18 @@ static int dummy_rot_init(ROT *rot)
{
struct dummy_rot_priv_data *priv;
priv = (struct dummy_rot_priv_data *)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct dummy_rot_priv_data *)
malloc(sizeof(struct dummy_rot_priv_data));
if (!priv)
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.priv = (void *)priv;
priv = rot->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.rotport.type.rig = RIG_PORT_NONE;
priv->az = priv->el = 0;

Wyświetl plik

@ -260,22 +260,24 @@ static int read_transaction(RIG *rig, char *response, int response_len)
*/
static int trxmanager_init(RIG *rig)
{
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)malloc(
sizeof(struct trxmanager_priv_data));
struct trxmanager_priv_data *priv;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
if (!priv)
rig->state.priv = (struct trxmanager_priv_data *)malloc(
sizeof(struct trxmanager_priv_data));
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct trxmanager_priv_data));
/*
* set arbitrary initial status
*/
rig->state.priv = (rig_ptr_t) priv;
priv->vfo_curr = RIG_VFO_A;
priv->split = 0;

Wyświetl plik

@ -524,19 +524,19 @@ int elad_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = malloc(sizeof(struct elad_priv_data));
rig->state.priv = malloc(sizeof(struct elad_priv_data));
if (priv == NULL)
if (rig->state.priv == NULL)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0x00, sizeof(struct elad_priv_data));
strcpy(priv->verify_cmd, RIG_MODEL_XG3 == rig->caps->rig_model ? ";" : "ID;");
priv->split = RIG_SPLIT_OFF;
priv->trn_state = -1;
priv->curr_mode = 0;
rig->state.priv = priv;
/* default mode_table */
if (caps->mode_table == NULL)
@ -1648,7 +1648,7 @@ int elad_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = rig_passband_normal(rig, mode);
}
err = elad_set_filter(rig, width);
elad_set_filter(rig, width);
/* non fatal */
}

Wyświetl plik

@ -481,16 +481,16 @@ int dttsp_init(RIG *rig)
const char *cmdpath;
char *p;
priv = (struct dttsp_priv_data *)calloc(1, sizeof(struct dttsp_priv_data));
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!priv)
rig->state.priv = (struct dttsp_priv_data *)calloc(1, sizeof(struct dttsp_priv_data));
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = rig->state.priv;
priv->tuner = NULL;
priv->tuner_model = RIG_MODEL_DUMMY;

Wyświetl plik

@ -199,20 +199,20 @@ int sdr1k_init(RIG *rig)
{
struct sdr1k_priv_data *priv;
priv = (struct sdr1k_priv_data *)malloc(sizeof(struct sdr1k_priv_data));
rig->state.priv = (struct sdr1k_priv_data *)malloc(sizeof(struct sdr1k_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->dds_freq = RIG_FREQ_NONE;
priv->xtal = DEFAULT_XTAL;
priv->pll_mult = DEFAULT_PLL_MULT;
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -60,13 +60,13 @@ class DemodChainCF {
VrSource<d_iType> *d_source;
VrSink<d_oType> *d_sink;
VrSigProc *demod_in;
VrSigProc *demod_out;
VrSigProc *demod_in = NULL;
VrSigProc *demod_out = NULL;
HrAGC<d_oType,d_oType> *agc;
GrFreqXlatingFIRfilterCCF *mixer;
VrAmp<d_oType,d_oType> *gainstage;
GrFIRfilterFFF *audio_filter;
HrAGC<d_oType,d_oType> *agc = NULL;
GrFreqXlatingFIRfilterCCF *mixer = NULL;
VrAmp<d_oType,d_oType> *gainstage = NULL;
GrFIRfilterFFF *audio_filter = NULL;
int input_rate;
freq_t centerfreq;

Wyświetl plik

@ -38,7 +38,7 @@ class USBDemodChainCF : public DemodChainCF {
low_cutoff = 300;
// centerfreq, relative to IF_center_freq
centerfreq += (freq_t)(low_cutoff + width/2);
// centerfreq += (freq_t)(low_cutoff + width/2);
s_demod = new GrSSBMod<d_oType>(2*M_PI*(low_cutoff+width/2)/(double)input_rate,1.0);
@ -62,7 +62,7 @@ class LSBDemodChainCF : public DemodChainCF {
low_cutoff = 300;
// centerfreq, relative to IF_center_freq
centerfreq += (freq_t)(-low_cutoff - width/2);
//centerfreq += (freq_t)(-low_cutoff - width/2);
s_demod = new GrSSBMod<d_oType>(-2*M_PI*(low_cutoff+width/2)/(double)input_rate,1.0);

Wyświetl plik

@ -120,15 +120,15 @@ static int hd1780_rot_init(ROT *rot)
return -RIG_EINVAL;
}
priv = (struct hd1780_rot_priv_data *)
rot->state.priv = (struct hd1780_rot_priv_data *)
malloc(sizeof(struct hd1780_rot_priv_data));
if (!priv)
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.priv = (void *)priv;
priv = rot->state.priv;
rot->state.rotport.type.rig = RIG_PORT_SERIAL;

Wyświetl plik

@ -276,15 +276,15 @@ int icm710_init(RIG *rig)
priv_caps = (const struct icm710_priv_caps *) caps->priv;
priv = (struct icm710_priv_data *)calloc(1, sizeof(struct icm710_priv_data));
rig->state.priv = (struct icm710_priv_data *)calloc(1, sizeof(struct icm710_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->remote_id = priv_caps->default_remote_id;
priv->split = RIG_SPLIT_OFF;

Wyświetl plik

@ -136,15 +136,15 @@ int icmarine_init(RIG *rig)
priv_caps = (const struct icmarine_priv_caps *) caps->priv;
priv = (struct icmarine_priv_data *)malloc(sizeof(struct icmarine_priv_data));
rig->state.priv = (struct icmarine_priv_data *)malloc(sizeof(struct icmarine_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->remote_id = priv_caps->default_remote_id;
priv->split = RIG_SPLIT_OFF;

Wyświetl plik

@ -224,6 +224,15 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
* ACKFRMLEN is the smallest frame we can expect from the rig
*/
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
if (memcmp(buf, sendbuf, frm_len) == 0 && priv->serial_USB_echo_off)
{
// Hmmm -- got an echo back when not expected so let's change
priv->serial_USB_echo_off = 0;
// And try again
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
}
Unhold_Decode(rig);
if (frm_len < 0)
@ -298,9 +307,15 @@ int icom_transaction(RIG *rig, int cmd, int subcmd,
{
break;
}
hl_usleep(500*1000); // pause a half second
}
while (retry-- > 0);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: failed: %s\n", __func__, strerror(retval));
}
return retval;
}

Wyświetl plik

@ -131,8 +131,8 @@ typedef struct
unsigned char tone_sql[3]; /* tone squelch frequency as tone */
struct
{
unsigned char
pol; /* DTCS polarity by nibbles Tx pol | Rx pol; 0 = normal; 1 = rev */
//unsigned char
//pol; /* DTCS polarity by nibbles Tx pol | Rx pol; 0 = normal; 1 = rev */
unsigned char code[2]; /* DTCS code bigendian */
} dcs;
} channel_str_t;

Wyświetl plik

@ -588,15 +588,15 @@ icom_init(RIG *rig)
priv_caps = (const struct icom_priv_caps *) caps->priv;
priv = (struct icom_priv_data *) calloc(1, sizeof(struct icom_priv_data));
rig->state.priv = (struct icom_priv_data *) calloc(1, sizeof(struct icom_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *) priv;
priv = rig->state.priv;
/* TODO: CI-V address should be customizable */
@ -649,6 +649,56 @@ icom_cleanup(RIG *rig)
return RIG_OK;
}
/**
* Returns 1 when USB ECHO is off
* Returns 0 when USB ECHO is on
* \return Returns < 0 when error occurs (e.g. timeout, nimple, navail)
*/
int icom_get_usb_echo_off(RIG *rig)
{
int retval;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
struct rig_state *rs = &rig->state;
int retry_save = rs->rigport.retry;
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
// reduce the retry here so it's quicker
rs->rigport.retry = 1;
// Check for echo on first
priv->serial_USB_echo_off = 0;
retval = icom_transaction(rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo on detected\n",
__func__);
rs->rigport.retry = retry_save;
return RIG_OK;
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s %d \n", __func__, __LINE__);
priv->serial_USB_echo_off = 1;
retval = icom_transaction(rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo off detected\n",
__func__);
rs->rigport.retry = retry_save;
return RIG_OK;
}
}
rs->rigport.retry = retry_save;
return retval;
}
/*
* ICOM rig open routine
@ -657,66 +707,37 @@ icom_cleanup(RIG *rig)
int
icom_rig_open(RIG *rig)
{
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
int retval = RIG_OK;
struct rig_state *rs = &rig->state;
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_VERBOSE, "%s %d \n", __func__, __LINE__);
priv->serial_USB_echo_off = 0;
retval = icom_get_usb_echo_off(rig);
retval = icom_transaction(rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval >= 0) { return RIG_OK; }
if (retval == RIG_OK)
// maybe we need power on?
rig_debug(RIG_DEBUG_VERBOSE, "%s trying power on\n", __func__);
retval = abs(rig_set_powerstat(rig, 1));
// this is only a fatal error if powerstat is implemented
// if not iplemented than we're at an error here
if (retval != RIG_OK && retval != RIG_ENIMPL && retval != RIG_ENAVAIL)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo on detected\n",
__func__);
return RIG_OK;
}
else
{
// maybe we need power on?
retval = abs(rig_set_powerstat(rig, 1));
rig_debug(RIG_DEBUG_WARN, "%s: unexpected retval here: %s\n",
__func__, rigerror(retval));
// this is only a fatal error if powerstat is implemented
if (retval != RIG_OK && retval != RIG_ENIMPL && retval != RIG_ENAVAIL)
{
rig_debug(RIG_DEBUG_WARN, "%s: unexpected retval here: %s\n",
__func__, rigerror(retval));
rig_debug(RIG_DEBUG_WARN, "%s: rig_set_powerstat failed: =%s\n", __func__,
rigerror(retval));
return retval;
}
// Now that we're powered up let's try again
retval =
icom_transaction(rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK)
{
priv->serial_USB_echo_off = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo on detected\n",
__func__);
return RIG_OK;
}
}
priv->serial_USB_echo_off = 1;
retval = icom_transaction(rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo off detected\n",
__func__);
return RIG_OK;
}
else
{
rig_debug(RIG_DEBUG_WARN, "%s: rig_set_powerstat failed: =%s\n", __func__,
rigerror(retval));
return retval;
}
// Now that we're powered up let's try again
retval = icom_get_usb_echo_off(rig);
if (retval >= 0) { return RIG_OK; }
rig_debug(RIG_DEBUG_ERR, "%s: Unable to determine USB echo status\n", __func__);
return retval;
}
@ -1226,7 +1247,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
unsigned char dm_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x04 :
S_MEM_DATA_MODE;
int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7300
|| rig->caps->rig_model == RIG_MODEL_IC7610;
|| rig->caps->rig_model == RIG_MODEL_IC7610;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1258,6 +1279,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
if (RIG_OK == retval)
{
unsigned char datamode[2];
switch (mode)
{
case RIG_MODE_PKTUSB:
@ -1275,20 +1297,22 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
break;
}
if (filter_byte) { // then we need the width byte too
if (filter_byte) // then we need the width byte too
{
unsigned char mode_icom; // not used as it will map to USB/LSB
signed char width_icom;
rig2icom_mode(rig, mode, width, &mode_icom, &width_icom);
rig2icom_mode(rig, mode, width, &mode_icom, &width_icom);
// since width_icom is 0-2 for rigs that need this here we have to make it 1-3
datamode[1] = datamode[0] ? width_icom : 0;
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2, ackbuf,
&ack_len);
&ack_len);
}
else {
else
{
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf,
&ack_len);
&ack_len);
}
if (retval != RIG_OK)
@ -3956,6 +3980,7 @@ int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = RIG_SPLIT_ON;
/* get it back to normal */
retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
if (retval != RIG_OK) return retval;
}
else if (retval == -RIG_ERJCTED)
{
@ -4965,6 +4990,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
int i;
int retry;
struct rig_state *rs = &rig->state;
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called status=%d\n", __func__,
(int) status);
@ -4988,6 +5014,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
fe_buf[0] = 0;
retry = rs->rigport.retry;
rs->rigport.retry = 0;
priv->serial_USB_echo_off = 1;
retval =
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
rs->rigport.retry = retry;
@ -5009,10 +5036,15 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
if (status == RIG_POWER_ON) // wait for wakeup only
{
for (i = 0; i < retry; ++i) // up to 10 attempts
{
freq_t freq;
sleep(1);
// need to see if echo is on or not first
// until such time as rig is awake we don't know
icom_get_usb_echo_off(rig);
// Use get_freq as all rigs should repond to this
retval = rig_get_freq(rig, RIG_VFO_CURR, &freq);

Wyświetl plik

@ -30,7 +30,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "0.21"
#define BACKEND_VER "0.22"
/*
* defines used by comp_cal_str in rig.c

Wyświetl plik

@ -792,8 +792,6 @@ static int optoscan_send_freq(RIG *rig, pltstate_t *state)
* chars, but the read will be blocking anyway. --SF
* */
return icom_transaction(rig, C_CTL_MISC, S_OPTO_NXT, buff, 6, NULL, NULL);
return RIG_OK;
}
static int optoscan_RTS_toggle(RIG *rig)

Wyświetl plik

@ -972,8 +972,8 @@ typedef uint64_t rmode_t;
#define RIG_MODE_PSKR CONSTANT_64BIT_FLAG (31) /*!< \c PSKR - Kenwood PSKR and others */
#ifndef SWIGLUA
/* hide the top 32 bits from the Lua binding as they will not work */
#define RIG_MODE_DD CONSTANT_64BIT_FLAG (32) /* DD Mode IC-9700 */
#define RIG_MODE_BIT33 CONSTANT_64BIT_FLAG (33) /* reserved for future expansion */
#define RIG_MODE_DD CONSTANT_64BIT_FLAG (32) /*!< \c DD Mode IC-9700 */
#define RIG_MODE_C4FM CONSTANT_64BIT_FLAG (33) /*!< \c Yaesu C4FM mode */
#define RIG_MODE_BIT34 CONSTANT_64BIT_FLAG (34) /* reserved for future expansion */
#define RIG_MODE_BIT35 CONSTANT_64BIT_FLAG (35) /* reserved for future expansion */
#define RIG_MODE_BIT36 CONSTANT_64BIT_FLAG (36) /* reserved for future expansion */

Wyświetl plik

@ -740,6 +740,12 @@ int ic10_set_channel(RIG *rig, const channel_t *chan)
md
);
retval = ic10_transaction(rig, membuf, len, ackbuf, &ack_len);
// I assume we need to check the retval here -- W9MDB
// This was found from cppcheck
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_ERR,"%s: transaction failed: %s\n", __func__, strerror(retval));
return retval;
}
return RIG_OK;
}
@ -821,8 +827,6 @@ int ic10_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
return ic10_transaction(rig, fctbuf, fct_len, ackbuf, &ack_len);
return RIG_OK;
}

Wyświetl plik

@ -344,8 +344,7 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = rig_passband_normal(rig, mode);
}
if ((width > flt->filt_list[0].width) || ((flt->filt_list[0].width >= width)
&& (width > flt->filt_list[1].width)))
if ((width > flt->filt_list[0].width) || (width > flt->filt_list[1].width))
{
width = flt->filt_list[0].width;
f = '1';

Wyświetl plik

@ -79,6 +79,7 @@ static const struct kenwood_id kenwood_id_list[] =
{ RIG_MODEL_TS850, 9 },
{ RIG_MODEL_TS450S, 10 },
{ RIG_MODEL_TS690S, 11 },
{ RIG_MODEL_TS50, 13 },
{ RIG_MODEL_TS870S, 15 },
{ RIG_MODEL_TRC80, 16 },
{ RIG_MODEL_TS570D, 17 }, /* Elecraft K2|K3 also returns 17 */
@ -105,6 +106,7 @@ static const struct kenwood_id_string kenwood_id_string_list[] =
{ RIG_MODEL_TS850, "009" },
{ RIG_MODEL_TS450S, "010" },
{ RIG_MODEL_TS690S, "011" },
{ RIG_MODEL_TS50, "013" },
{ RIG_MODEL_TS870S, "015" },
{ RIG_MODEL_TS570D, "017" }, /* Elecraft K2|K3 also returns 17 */
{ RIG_MODEL_TS570S, "018" },
@ -583,19 +585,19 @@ int kenwood_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s\n", __func__, BACKEND_VER);
priv = malloc(sizeof(struct kenwood_priv_data));
rig->state.priv = malloc(sizeof(struct kenwood_priv_data));
if (priv == NULL)
if (rig->state.priv == NULL)
{
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0x00, sizeof(struct kenwood_priv_data));
strcpy(priv->verify_cmd, RIG_MODEL_XG3 == rig->caps->rig_model ? ";" : "ID;");
priv->split = RIG_SPLIT_OFF;
priv->trn_state = -1;
priv->curr_mode = 0;
rig->state.priv = priv;
/* default mode_table */
if (caps->mode_table == NULL)
@ -676,7 +678,7 @@ int kenwood_open(RIG *rig)
if (RIG_MODEL_XG3 != rig->caps->rig_model && -RIG_ETIMEOUT == err)
{
/* Some Kenwood emulations have no ID command response :(
* Try an FA command to see is anyone is listening */
* Try an FA command to see if anyone is listening */
char buffer[KENWOOD_MAX_BUF_LEN];
err = kenwood_transaction(rig, "FA", buffer, sizeof(buffer));
@ -1773,7 +1775,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = rig_passband_normal(rig, mode);
}
err = kenwood_set_filter(rig, width);
kenwood_set_filter(rig, width);
/* non fatal */
}

Wyświetl plik

@ -274,7 +274,7 @@ static int thd74_get_freq_info(RIG *rig, vfo_t vfo, char *buf)
sprintf(cmd, "FO %c", c);
retval = kenwood_transaction(rig, cmd, buf, 73);
return RIG_OK;
return retval;
}
/* item is an offset into reply buf that is a single char */

Wyświetl plik

@ -483,7 +483,7 @@ int thg71_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
/* --------------------------------------------------------------------- */
int thg71_open(RIG *rig)
{
char ackbuf[ACKBUF_LEN], *strl;
char ackbuf[ACKBUF_LEN];
int retval, i;
const freq_range_t frend = RIG_FRNG_END;
@ -503,12 +503,12 @@ int thg71_open(RIG *rig)
return retval;
}
strl = strtok(ackbuf, " ");
strtok(ackbuf, " ");
for (i = 0; i < FRQRANGESIZ; i++)
{
freq_range_t frng;
char *stru;
char *strl,*stru;
strl = strtok(NULL, ",");
stru = strtok(NULL, ",");

Wyświetl plik

@ -1583,7 +1583,7 @@ int tmd710_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift)
* tmd710_set_rptr_offs
* Assumes rig!=NULL
*/
int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t freq)
int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offset)
{
int retval;
tmd710_fo fo_struct;
@ -1598,10 +1598,10 @@ int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t freq)
return retval;
}
freq5 = round(freq / 5000) * 5000;
freq625 = round(freq / 6250) * 6250;
freq5 = round(offset / 5000) * 5000;
freq625 = round(offset / 6250) * 6250;
if (abs((int)(freq5 - freq)) < abs((int)(freq625 - freq)))
if (abs((int)(freq5 - offset)) < abs((int)(freq625 - offset)))
{
freq_sent = freq5;
}
@ -1623,7 +1623,7 @@ int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t freq)
* tmd710_get_rptr_offs
* Assumes rig!=NULL, freq!=NULL
*/
int tmd710_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)
int tmd710_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *offset)
{
tmd710_fo fo_struct;
int retval;
@ -1634,7 +1634,7 @@ int tmd710_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)
if (retval == RIG_OK)
{
*rptr_offs = fo_struct.offset;
*offset = fo_struct.offset;
}

Wyświetl plik

@ -622,7 +622,7 @@ int tmv7_get_channel(RIG *rig, channel_t *chan)
{
strcpy(scf, req);
strcat(scf, ",%"SCNfreq",%d");
retval = num_sscanf(ackbuf, scf, &freq, &step);
num_sscanf(ackbuf, scf, &freq, &step);
chan->tx_freq = freq;
}
}

Wyświetl plik

@ -379,7 +379,7 @@ int ts2000_get_channel(RIG *rig, channel_t *chan)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rig || !chan || chan->vfo != RIG_VFO_MEM)
if (!chan || chan->vfo != RIG_VFO_MEM)
{
return -RIG_EINVAL;
}

Wyświetl plik

@ -71,7 +71,7 @@ static struct kenwood_priv_caps ts850_priv_caps =
/* forward definitions */
static int ts850_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ts850_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ts850_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit);
static int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ts850_set_channel(RIG *rig, const channel_t *chan);

Wyświetl plik

@ -506,25 +506,26 @@ int xg3_set_powerstat(RIG *rig, powerstat_t status)
int xg3_get_powerstat(RIG *rig, powerstat_t *status)
{
const char *cmd = "G"; // any command to test will do
char reply[32];
int retval = kenwood_transaction(rig, cmd, NULL, 0);
struct rig_state *rs = &rig->state;
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (retval == RIG_OK)
{
char reply[32];
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
if (retval != RIG_OK)
{
*status = RIG_POWER_OFF; // Error indicates power is off
rig_debug(RIG_DEBUG_VERBOSE, "%s read_string failed\n", __func__);
priv->powerstat = RIG_POWER_OFF;
}
else
{
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
return RIG_OK; // Always OK since it's a binary state
}

Wyświetl plik

@ -172,15 +172,15 @@ int dds60_init(RIG *rig)
{
struct dds60_priv_data *priv;
priv = (struct dds60_priv_data *)malloc(sizeof(struct dds60_priv_data));
rig->state.priv = (struct dds60_priv_data *)malloc(sizeof(struct dds60_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->osc_freq = OSCFREQ;
priv->if_mix_freq = IFMIXFREQ;

Wyświetl plik

@ -172,15 +172,15 @@ int drt1_init(RIG *rig)
{
struct drt1_priv_data *priv;
priv = (struct drt1_priv_data *)malloc(sizeof(struct drt1_priv_data));
rig->state.priv = (struct drt1_priv_data *)malloc(sizeof(struct drt1_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->osc_freq = OSCFREQ;
priv->ref_mult = REFMULT;

Wyświetl plik

@ -229,14 +229,16 @@ int dwtdll_init(RIG *rig)
{
struct dwtdll_priv_data *priv;
priv = (struct dwtdll_priv_data *)malloc(sizeof(struct dwtdll_priv_data));
rig->state.priv = (struct dwtdll_priv_data *)malloc(sizeof(struct dwtdll_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Try to load required dll */
priv->dll = LoadLibrary(DWTDLL);
@ -244,10 +246,12 @@ int dwtdll_init(RIG *rig)
{
rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n",
__func__, DWTDLL);
free(priv);
free(rig->state.priv);
return -RIG_EIO; /* huh! */
}
/* Get process addresses from dll for function access */
priv->FrontendOpen =
(FNCFrontendOpen) GetProcAddress(priv->dll, "FrontendOpen");
@ -288,8 +292,6 @@ int dwtdll_init(RIG *rig)
priv->FrontendGetFmMode =
(FNCFrontendGetFmMode) GetProcAddress(priv->dll, "FrontendGetFmMode");
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -164,16 +164,16 @@ int elektor304_init(RIG *rig)
{
struct elektor304_priv_data *priv;
priv = (struct elektor304_priv_data *)malloc(sizeof(struct
rig->state.priv = (struct elektor304_priv_data *)malloc(sizeof(struct
elektor304_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->osc_freq = OSCFREQ;
priv->if_mix_freq = IFMIXFREQ;

Wyświetl plik

@ -379,15 +379,17 @@ int elektor507_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct elektor507_priv_data *priv;
priv = (struct elektor507_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct elektor507_priv_data *)calloc(sizeof(struct
elektor507_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->xtal_cal = XTAL_CAL;
priv->osc_freq = OSCFREQ;
priv->ant = ANT_AUTO;
@ -403,8 +405,6 @@ int elektor507_init(RIG *rig)
rp->parm.usb.iface = 0;
rp->parm.usb.alt = 0; /* necessary ? */
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -332,15 +332,17 @@ int fifisdr_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct fifisdr_priv_instance_data *priv;
priv = (struct fifisdr_priv_instance_data *)calloc(sizeof(
rig->state.priv = (struct fifisdr_priv_instance_data *)calloc(sizeof(
struct fifisdr_priv_instance_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->multiplier = 4;
rp->parm.usb.vid = USBDEV_SHARED_VID;
@ -354,8 +356,6 @@ int fifisdr_init(RIG *rig)
rp->parm.usb.vendor_name = FIFISDR_VENDOR_NAME;
rp->parm.usb.product = FIFISDR_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -233,14 +233,16 @@ int funcube_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct funcube_priv_data *priv;
priv = (struct funcube_priv_data *)calloc(sizeof(struct funcube_priv_data), 1);
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(struct funcube_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->freq = 0;
rp->parm.usb.vid = VID;
@ -252,8 +254,6 @@ int funcube_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
@ -262,14 +262,16 @@ int funcubeplus_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct funcube_priv_data *priv;
priv = (struct funcube_priv_data *)calloc(sizeof(struct funcube_priv_data), 1);
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(struct funcube_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->freq = 0;
rp->parm.usb.vid = VID;
@ -281,8 +283,6 @@ int funcubeplus_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = PRODUCT_NAMEPLUS;
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -292,16 +292,16 @@ int hiqsdr_init(RIG *rig)
{
struct hiqsdr_priv_data *priv;
priv = (struct hiqsdr_priv_data *)malloc(sizeof(struct hiqsdr_priv_data));
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!priv)
rig->state.priv = (struct hiqsdr_priv_data *)malloc(sizeof(struct hiqsdr_priv_data));
if (!rig->state.priv)
{
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = rig->state.priv;
priv->split = RIG_SPLIT_OFF;
priv->ref_clock = REFCLOCK;

Wyświetl plik

@ -571,15 +571,17 @@ int si570avrusb_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct si570xxxusb_priv_data *priv;
priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
si570xxxusb_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
/* QSD/QSE */
priv->multiplier = 4;
@ -599,8 +601,6 @@ int si570avrusb_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = AVR_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
@ -612,15 +612,17 @@ int si570peaberry1_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct si570xxxusb_priv_data *priv;
priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
si570xxxusb_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
/* QSD/QSE */
priv->multiplier = 4;
@ -640,8 +642,6 @@ int si570peaberry1_init(RIG *rig)
rp->parm.usb.vendor_name = PEABERRY_VENDOR_NAME;
rp->parm.usb.product = PEABERRY_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
@ -653,15 +653,17 @@ int si570peaberry2_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct si570xxxusb_priv_data *priv;
priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
si570xxxusb_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
/* QSD/QSE */
priv->multiplier = 4;
@ -681,8 +683,6 @@ int si570peaberry2_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = PEABERRY_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
@ -694,15 +694,17 @@ int si570picusb_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct si570xxxusb_priv_data *priv;
priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
si570xxxusb_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
/* QSD/QSE */
priv->multiplier = 2;
@ -722,8 +724,6 @@ int si570picusb_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = PIC_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
/*
@ -735,15 +735,17 @@ int fasdr_init(RIG *rig)
hamlib_port_t *rp = &rig->state.rigport;
struct si570xxxusb_priv_data *priv;
priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
si570xxxusb_priv_data), 1);
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
/* QSD/QSE */
priv->multiplier = 4;
@ -763,8 +765,6 @@ int fasdr_init(RIG *rig)
rp->parm.usb.vendor_name = VENDOR_NAME;
rp->parm.usb.product = AVR_PRODUCT_NAME;
rig->state.priv = (void *)priv;
return RIG_OK;
}
@ -987,7 +987,7 @@ static int setBPF(RIG *rig, int enable)
(unsigned char *) FilterCrossOver, sizeof(FilterCrossOver),
rig->state.rigport.timeout);
if (retval < 1)
if (retval < 2)
{
return -RIG_EIO;
}

Wyświetl plik

@ -47,18 +47,12 @@ struct usrp_priv_data {
int usrp_init(RIG *rig)
{
struct usrp_priv_data *priv;
priv = (struct usrp_priv_data*)malloc(sizeof(struct usrp_priv_data));
if (!priv) {
rig->state.priv = (struct usrp_priv_data*)malloc(sizeof(struct usrp_priv_data));
if (!rig->state.priv) {
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void*)priv;
//priv->if_mix_freq = IFMIXFREQ;
return RIG_OK;
}

Wyświetl plik

@ -104,15 +104,15 @@ extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long (int argc, char *const *argv, const char *options,
const struct option *long_options, int *opt_index);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
const char *options,
const struct option *longopts, int *opt_index);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const char *optstring,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */

Wyświetl plik

@ -52,7 +52,7 @@ const struct rig_caps hf235_caps =
.rig_model = RIG_MODEL_HF235,
.model_name = "HF-235",
.mfg_name = "Lowe",
.version = "0.3",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA, /* and only basic support */
.rig_type = RIG_TYPE_RECEIVER,

Wyświetl plik

@ -298,12 +298,6 @@ const char *lowe_get_info(RIG *rig)
// non-fatal
}
if (retval != RIG_OK)
{
return NULL;
}
/* this is the real one */
retval = lowe_transaction(rig, "TYP?" EOM, 5, idbuf, &id_len);

Wyświetl plik

@ -165,15 +165,15 @@ static int meade_init(ROT *rot)
{
struct meade_priv_data *priv;
priv = (struct meade_priv_data *)
rot->state.priv = (struct meade_priv_data *)
calloc(1, sizeof(struct meade_priv_data));
if (!priv)
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.priv = (void *)priv;
priv = rot->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called version %s\n", __func__,
rot->caps->version);

Wyświetl plik

@ -61,15 +61,15 @@ int microtune_init(RIG *rig)
{
struct microtune_priv_data *priv;
priv = (struct microtune_priv_data*)malloc(sizeof(struct microtune_priv_data));
if (!priv) {
rig->state.priv = (struct microtune_priv_data*)malloc(sizeof(struct microtune_priv_data));
if (!rig->state.priv) {
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->actual_freq = RIG_FREQ_NONE;
rig->state.priv = (void*)priv;
return RIG_OK;
}

Wyświetl plik

@ -1,3 +0,0 @@
noinst_LTLIBRARIES = libhamlib-miniVNA.la
libhamlib_miniVNA_la_SOURCES = miniVNA.c miniVNA.h

Wyświetl plik

@ -1,115 +0,0 @@
/*
* Hamlib miniVNA backend - main file
* Copyright (c) 2001-2004 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <math.h>
#include "hamlib/rig.h"
#include "serial.h"
#include "misc.h"
#include "idx_builtin.h"
#include "register.h"
#include "miniVNA.h"
#define DDS_RATIO 10.73741824
static int miniVNA_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
char fstr[20];
char cmdstr[40];
int retval;
sprintf_freq(fstr, freq);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
rig_strvfo(vfo), fstr);
serial_flush(&rig->state.rigport);
sprintf(cmdstr, "0\r%ld\r1\r0\r", (long int)(freq * DDS_RATIO));
retval = write_block(&rig->state.rigport, cmdstr, strlen(cmdstr));
if (retval != RIG_OK)
{
return retval;
}
return RIG_OK;
}
#ifdef XXREMOVEDXX
static const char *miniVNA_get_info(RIG *rig)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
return "miniVNA";
}
#endif
const struct rig_caps miniVNA_caps =
{
.rig_model = RIG_MODEL_MINIVNA,
.model_name = "miniVNA",
.mfg_name = "mRS",
.version = "0.1",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 115200,
.serial_rate_max = 115200,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 1,
.timeout = 1000,
.retry = 3,
.rx_range_list1 = { {.start = kHz(100), .end = MHz(180), .modes = RIG_MODE_NONE, .low_power = -1, .high_power = -1, RIG_VFO_A},
RIG_FRNG_END,
},
.tx_range_list1 = { {.start = kHz(100), .end = MHz(180), .modes = RIG_MODE_NONE, .low_power = -1, .high_power = -1, RIG_VFO_A},
RIG_FRNG_END,
},
.tuning_steps = { {RIG_MODE_NONE, 1}, RIG_TS_END, },
.set_freq = miniVNA_set_freq,
};
DECLARE_INITRIG_BACKEND(miniVNA)
{
rig_debug(RIG_DEBUG_VERBOSE, "miniVNA: _init called\n");
rig_register(&miniVNA_caps);
return RIG_OK;
}

Wyświetl plik

@ -1,28 +0,0 @@
/*
* Hamlib miniVNA backend - main header
* Copyright (c) 2001,2002 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _MINIVNA_H
#define _MINIVNA_H 1
extern const struct rig_caps miniVNA_caps;
#endif /* _MINIVNA_H */

Wyświetl plik

@ -485,14 +485,16 @@ pcr_init(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct pcr_priv_data *) malloc(sizeof(struct pcr_priv_data));
rig->state.priv = (struct pcr_priv_data *) malloc(sizeof(struct pcr_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0x00, sizeof(struct pcr_priv_data));
/*
@ -518,7 +520,6 @@ pcr_init(RIG *rig)
priv->sub_rcvr = priv->main_rcvr;
priv->current_vfo = RIG_VFO_MAIN;
rig->state.priv = (rig_ptr_t) priv;
rig->state.transceive = RIG_TRN_OFF;
return RIG_OK;

Wyświetl plik

@ -224,15 +224,15 @@ int ra37xx_init(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct ra37xx_priv_data *)malloc(sizeof(struct ra37xx_priv_data));
rig->state.priv = (struct ra37xx_priv_data *)malloc(sizeof(struct ra37xx_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->receiver_id = -1;
@ -404,7 +404,7 @@ int ra37xx_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (width == RIG_PASSBAND_NORMAL)
{
width = rig_passband_normal(rig, mode);
rig_passband_normal(rig, mode);
}
rig_debug(RIG_DEBUG_TRACE, "%s: widthtype = %i, widthnum = %i not implemented\n", __func__, widthtype, widthnum);

Wyświetl plik

@ -128,15 +128,15 @@ int racal_init(RIG *rig)
return -RIG_EINVAL;
}
priv = (struct racal_priv_data *)malloc(sizeof(struct racal_priv_data));
rig->state.priv = (struct racal_priv_data *)malloc(sizeof(struct racal_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
rig->state.priv = (void *)priv;
priv = rig->state.priv;
priv->receiver_id = 0;
priv->bfo = 0;

Wyświetl plik

@ -358,8 +358,6 @@ const struct rot_caps rt21_rot_caps =
static int rotorez_rot_init(ROT *rot)
{
struct rotorez_rot_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
@ -367,19 +365,17 @@ static int rotorez_rot_init(ROT *rot)
return -RIG_EINVAL;
}
priv = (struct rotorez_rot_priv_data *)
rot->state.priv = (struct rotorez_rot_priv_data *)
malloc(sizeof(struct rotorez_rot_priv_data));
if (!priv)
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.priv = (void *)priv;
rot->state.rotport.type.rig = RIG_PORT_SERIAL;
priv->az = 0;
((struct rotorez_rot_priv_data*)rot->state.priv)->az = 0;
return RIG_OK;
}
@ -732,7 +728,7 @@ static int rt21_rot_get_position(ROT *rot, azimuth_t *azimuth,
{
struct rot_state *rs;
char az[8]; /* read azimuth string */
azimuth_t tmp = 0;
azimuth_t tmp;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

Wyświetl plik

@ -163,17 +163,6 @@ int cm108_close(hamlib_port_t *p)
*/
int cm108_ptt_set(hamlib_port_t *p, ptt_t pttx)
{
ssize_t nw;
char out_rep[] =
{
0x00, // report number
// HID output report
0x00,
(pttx == RIG_PTT_ON) ? (1 << p->parm.cm108.ptt_bitnum) : 0, // set GPIO
1 << p->parm.cm108.ptt_bitnum, // Data direction register (1=output)
0x00
};
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
// For a CM108 USB audio device PTT is wired up to one of the GPIO
@ -188,6 +177,16 @@ int cm108_ptt_set(hamlib_port_t *p, ptt_t pttx)
case RIG_PTT_CM108:
{
ssize_t nw;
char out_rep[] =
{
0x00, // report number
// HID output report
0x00,
(pttx == RIG_PTT_ON) ? (1 << p->parm.cm108.ptt_bitnum) : 0, // set GPIO
1 << p->parm.cm108.ptt_bitnum, // Data direction register (1=output)
0x00
};
// Build a packet for CM108 HID to turn GPIO bit on or off.
// Packet is 4 bytes, preceded by a 'report number' byte

Wyświetl plik

@ -38,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>

Wyświetl plik

@ -1121,9 +1121,6 @@ void uh_close_radio()
}
}
#ifdef XXREMOVEDXX
// Not referenced anywhere
void uh_close_wkey()
{
uh_wkey_in_use = 0;
@ -1133,43 +1130,37 @@ void uh_close_wkey()
close_microham();
}
}
#endif
int uh_open_ptt()
{
if (!uh_is_initialized)
{
start_thread();
}
if (!uh_is_initialized)
{
return -1;
if (!uh_is_initialized)
{
return -1;
}
}
uh_ptt_in_use = 1;
return uh_ptt_pair[1];
}
#ifdef XXREVMOVEDXX
// Not referenced anywhere
int uh_open_wkey()
{
if (!uh_is_initialized)
{
start_thread();
if (!uh_is_initialized)
{
return -1;
}
}
if (!uh_is_initialized)
{
return -1;
}
uh_wkey_in_use = 1;
return uh_wkey_pair[1];
}
#endif
//
@ -1186,11 +1177,10 @@ int uh_open_radio(int baud, int databits, int stopbits, int rtscts)
if (!uh_is_initialized)
{
start_thread();
}
if (!uh_is_initialized)
{
return -1;
if (!uh_is_initialized)
{
return -1;
}
}
baudrateConst = 11059200 / baud ;

Wyświetl plik

@ -26,6 +26,7 @@
extern int uh_open_radio(int baud, int databits, int stopbits, int rtscts);
extern int uh_open_ptt();
extern void uh_close_wkey();
extern void uh_set_ptt(int ptt);
extern int uh_get_ptt();
extern void uh_close_radio();

Wyświetl plik

@ -343,6 +343,7 @@ static struct
{ RIG_MODE_AMN, "AMN"},
{ RIG_MODE_PSK, "PSK"},
{ RIG_MODE_PSKR, "PSKR"},
{ RIG_MODE_C4FM, "C4FM"},
{ RIG_MODE_NONE, "" },
};

Wyświetl plik

@ -239,7 +239,7 @@ int network_open(hamlib_port_t *rp, int default_port)
return -RIG_EIO;
}
if ((status = connect(fd, res->ai_addr, res->ai_addrlen)) == 0)
if (connect(fd, res->ai_addr, res->ai_addrlen) == 0)
{
break;
}
@ -281,9 +281,9 @@ int network_open(hamlib_port_t *rp, int default_port)
void network_flush(hamlib_port_t *rp)
{
#ifdef __MINGW32__
ULONG len = 0;
ULONG len;
#else
uint len = 0;
uint len;
#endif
char buffer[NET_BUFFER_SIZE] = { 0 };

137
src/neverused.c 100644
Wyświetl plik

@ -0,0 +1,137 @@
// These function are not referenced anywhere inside hamlib
// according to cppcheck
// Some are marked with XXREMOVEDXX in the code are are
// subject to being deprecated in a future release
void used_externally()
{
uh_close_wkey(); // used by external programs
uh_open_wkey(); // used by external programs
}
void never_used()
{
adat_mode_anr2rnr();
adat_parse_vfo();
adat_ptt_rnr2anr();
amp_ext_level_foreach();
amp_ext_lookup_tok();
amp_ext_parm_foreach();
amp_ext_token_lookup();
amp_probe_all();
amp_set_powerstat();
amp_token_foreach();
amp_unregister();
cm108_dcd_get();
elad_close();
elad_get_channel();
elad_get_ctcss_sql();
elad_get_ctcss_tone();
elad_get_ext_parm();
elad_get_info();
elad_get_level();
elad_get_mem();
elad_get_mem_if();
elad_get_mode_if();
elad_open();
elad_send_morse();
elad_set_ant_no_ack();
elad_set_channel();
elad_set_ctcss_sql();
elad_set_ctcss_tone();
elad_set_ctcss_tone_tn();
elad_set_ext_parm();
elad_set_level();
elad_set_mem();
elad_set_ptt_safe();
elad_set_split();
elad_vfo_op();
flushBuffer();
foreach_opened_amp();
foreach_opened_rot();
get_output_freq();
getopt_long_only();
gp2000_get_func();
gp2000_set_func();
hzToPBS();
i2c_read();
ic10_set_ptt();
ic9100_get_level();
ic9100_set_level();
icmarine_open();
icom_get_vfo();
icom_set_dsp_flt();
int2BCD();
is_uh_radio_fd();
lt_dladdsearchdir();
lt_dlclose();
lt_dlerror();
lt_dlexit();
lt_dlinit();
lt_dlopen();
lt_dlopenext();
lt_dlsym();
miniVNA_get_info();
newcat_decode_event();
newcat_get_dcd();
newcat_get_dcs_code();
newcat_get_dcs_sql();
newcat_get_ext_level();
newcat_get_ext_parm();
newcat_get_parm();
newcat_get_rptr_offs();
newcat_get_split_freq();
newcat_get_split_mode();
newcat_get_tone();
newcat_get_tone_sql();
newcat_recv_dtmf();
newcat_reset();
newcat_scan();
newcat_send_dtmf();
newcat_send_morse();
newcat_set_bank();
newcat_set_dcs_code();
newcat_set_dcs_sql();
newcat_set_ext_level();
newcat_set_ext_parm();
newcat_set_parm();
newcat_set_rptr_offs();
newcat_set_split_freq();
newcat_set_split_mode();
newcat_set_tone();
newcat_set_tone_sql();
pll_locked_p();
readInt();
read_info();
rig_copy_channel();
rig_copyright();
rig_ext_token_lookup();
rig_get_mem_all();
rig_get_mem_all_cb();
rig_license();
rig_mem_count();
rig_parse_mtype();
rig_probe_all();
rig_set_bank();
rig_set_debug_callback();
rig_set_debug_file();
rig_set_mem_all();
rig_set_mem_all_cb();
rig_set_pltune_callback();
rig_unregister();
rig_version();
rot_probe_all();
rot_unregister();
set_parm_all_cb_generic();
tentec_trx_open();
thd72_get_chan_all_cb();
thd74_get_chan_all_cb();
writeInt();
write_both_dacs();
}
main()
{
used_externally();
never_used();
}

Wyświetl plik

@ -206,6 +206,7 @@ int par_open(hamlib_port_t *port)
}
#else
port->fd = fd = 0;
return -RIG_ENIMPL;
#endif
port->fd = fd;

Wyświetl plik

@ -294,13 +294,14 @@ int tt538_init(RIG *rig)
{
struct tt538_priv_data *priv;
priv = (struct tt538_priv_data *) malloc(sizeof(struct tt538_priv_data));
rig->state.priv = (struct tt538_priv_data *) malloc(sizeof(struct tt538_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tt538_priv_data));
@ -309,7 +310,6 @@ int tt538_init(RIG *rig)
*/
priv->ch = 0;
priv->vfo_curr = RIG_VFO_A;
rig->state.priv = (rig_ptr_t)priv;
return RIG_OK;
}

Wyświetl plik

@ -330,13 +330,14 @@ int tt588_init(RIG *rig)
struct tt588_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
priv = (struct tt588_priv_data *) malloc(sizeof(struct tt588_priv_data));
rig->state.priv = (struct tt588_priv_data *) malloc(sizeof(struct tt588_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tt588_priv_data));
@ -345,7 +346,6 @@ int tt588_init(RIG *rig)
*/
priv->ch = 0;
priv->vfo_curr = RIG_VFO_A;
rig->state.priv = (rig_ptr_t)priv;
return RIG_OK;
}

Wyświetl plik

@ -229,14 +229,14 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int tt565_init(RIG *rig)
{
struct tt565_priv_data *priv;
priv = (struct tt565_priv_data *)malloc(sizeof(struct tt565_priv_data));
rig->state.priv = (struct tt565_priv_data *)malloc(sizeof(struct tt565_priv_data));
if (!priv) { return -RIG_ENOMEM; } /* no memory available */
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tt565_priv_data));
priv->ch = 0; /* set arbitrary initial status */
priv->vfo_curr = RIG_VFO_A;
rig->state.priv = (rig_ptr_t)priv;
return RIG_OK;
}

Wyświetl plik

@ -214,17 +214,18 @@ int tt585_init(RIG *rig)
{
struct tt585_priv_data *priv;
priv = (struct tt585_priv_data *) malloc(sizeof(struct tt585_priv_data));
rig->state.priv = (struct tt585_priv_data *) malloc(sizeof(struct tt585_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tt585_priv_data));
rig->state.priv = priv;
return RIG_OK;
}

Wyświetl plik

@ -297,21 +297,17 @@ int rx331_init(RIG *rig)
{
struct rx331_priv_data *priv;
priv = (struct rx331_priv_data *)malloc(sizeof(struct rx331_priv_data));
rig->state.priv = (struct rx331_priv_data *)malloc(sizeof(struct rx331_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct rx331_priv_data));
/*
* set arbitrary initial status
*/
rig->state.priv = (rig_ptr_t)priv;
return RIG_OK;
}

Wyświetl plik

@ -111,14 +111,16 @@ int tentec_init(RIG *rig)
{
struct tentec_priv_data *priv;
priv = (struct tentec_priv_data *)malloc(sizeof(struct tentec_priv_data));
rig->state.priv = (struct tentec_priv_data *)malloc(sizeof(struct tentec_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tentec_priv_data));
/*
@ -132,8 +134,6 @@ int tentec_init(RIG *rig)
priv->agc = RIG_AGC_MEDIUM; /* medium */
priv->lnvol = priv->spkvol = 0.0; /* mute */
rig->state.priv = (rig_ptr_t)priv;
/* tentec_tuning_factor_calc needs rig->state.priv */
tentec_tuning_factor_calc(rig);

Wyświetl plik

@ -367,9 +367,9 @@ tt550_init(RIG *rig)
{
struct tt550_priv_data *priv;
priv = (struct tt550_priv_data *) malloc(sizeof(struct tt550_priv_data));
rig->state.priv = (struct tt550_priv_data *) malloc(sizeof(struct tt550_priv_data));
if (!priv)
if (!rig->state.priv)
{
/*
* whoops! memory shortage!
@ -377,6 +377,8 @@ tt550_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
memset(priv, 0, sizeof(struct tt550_priv_data));
/*
@ -393,7 +395,6 @@ tt550_init(RIG *rig)
priv->lineout = priv->spkvol = 0.0; /* mute */
priv->stepsize = 100; /* default to 100Hz tuning step */
rig->state.priv = (rig_ptr_t) priv;
return RIG_OK;
}

Wyświetl plik

@ -107,12 +107,6 @@ static struct option long_options[] =
#define MAXCONFLEN 128
/* variable for readline support */
#ifdef HAVE_LIBREADLINE
static const int have_rl = 1;
#endif
int interactive = 1; /* if no cmd on command line, switch to interactive */
int prompt = 1; /* Print prompt in ampctl */
@ -137,7 +131,6 @@ int main(int argc, char *argv[])
const char *hist_dir = NULL;
const char hist_file[] = "/.ampctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif /* HAVE_READLINE_HISTORY */
const char *amp_file = NULL;
@ -363,7 +356,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_LIBREADLINE
if (interactive && prompt && have_rl)
if (interactive && prompt)
{
rl_readline_name = "ampctl";
#ifdef HAVE_READLINE_HISTORY
@ -372,6 +365,8 @@ int main(int argc, char *argv[])
if (rd_hist || sv_hist)
{
int hist_path_size;
struct stat hist_dir_stat;
if (!(hist_dir = getenv("AMPCTL_HIST_DIR")))
{
hist_dir = getenv("HOME");
@ -417,9 +412,7 @@ int main(int argc, char *argv[])
}
while (retcode == 0 || retcode == 2);
#ifdef HAVE_LIBREADLINE
if (interactive && prompt && have_rl)
if (interactive && prompt)
{
#ifdef HAVE_READLINE_HISTORY
@ -442,7 +435,6 @@ int main(int argc, char *argv[])
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
amp_close(my_amp); /* close port */
amp_cleanup(my_amp); /* if you care about memory */

Wyświetl plik

@ -109,7 +109,7 @@ static const int have_rl = 1;
static char *rp_hist_buf = (char *)NULL;
#endif
#else /* no readline */
#else
static const int have_rl = 0;
#endif
@ -193,7 +193,7 @@ struct test_table *find_cmd_entry(int cmd)
break;
}
if (i >= MAXNBOPT || test_list[i].cmd == 0x00)
if (test_list[i].cmd == 0x00)
{
return NULL;
}
@ -300,11 +300,8 @@ static void rp_getline(const char *s)
/* Action! Returns typed line with newline stripped. */
input_line = readline(s);
}
#endif
/*
* TODO: use Lex?
*/
@ -472,8 +469,10 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
char arg2[MAXARGSZ + 1], *p2 = NULL;
char arg3[MAXARGSZ + 1], *p3 = NULL;
char arg4[MAXARGSZ + 1], *p4 = NULL;
char *p5 = NULL;
#ifdef __USEP5P6__ // to avoid cppcheck warning
char *p5 = NULL;
char *p6 = NULL;
#endif
/* cmd, internal, ampctld */
if (!(interactive && prompt && have_rl))
@ -848,7 +847,6 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
}
#ifdef HAVE_LIBREADLINE
if (interactive && prompt && have_rl)
{
int j, x;
@ -860,9 +858,6 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
rp_hist_buf = (char *)calloc(896, sizeof(char));
#endif
rl_instream = fin;
rl_outstream = fout;
rp_getline("\nAmplifier command: ");
/* EOF (Ctl-D) received on empty input line, bail out gracefully. */
@ -1329,9 +1324,7 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
#endif
}
#endif /* HAVE_LIBREADLINE */
#endif // HAVE_LIBREADLINE
/*
* mutex locking needed because ampctld is multithreaded
@ -1379,8 +1372,13 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
p2 ? p2 : "",
p3 ? p3 : "",
p4 ? p4 : "",
#ifdef __USEP5P6__
p5 ? p5 : "",
p6 ? p6 : "");
#else
"",
"");
#endif
#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&amp_mutex);
@ -1550,7 +1548,7 @@ void print_model_list()
for (s = models; s != NULL; s = (struct mod_lst *)(s->hh.next))
{
printf("%6d %-23s%-24s%-16s%s\n",
printf("%6u %-23s%-24s%-16s%s\n",
s->id,
s->mfg_name,
s->model_name,

Wyświetl plik

@ -176,8 +176,10 @@ int main(int argc, char *argv[])
pthread_attr_t attr;
#endif
struct handle_data *arg;
#ifdef SIGPIPE
#if HAVE_SIGACTION
struct sigaction act;
#endif
#endif
while (1)

Wyświetl plik

@ -136,7 +136,6 @@ int main(int argc, char *argv[])
const char *hist_dir = NULL;
const char hist_file[] = "/.rigctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif /* HAVE_READLINE_HISTORY */
const char *rig_file = NULL, *ptt_file = NULL, *dcd_file = NULL;
@ -573,6 +572,8 @@ int main(int argc, char *argv[])
if (rd_hist || sv_hist)
{
int hist_path_size;
struct stat hist_dir_stat;
if (!(hist_dir = getenv("RIGCTL_HIST_DIR")))
{
hist_dir = getenv("HOME");
@ -618,8 +619,6 @@ int main(int argc, char *argv[])
}
while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL);
#ifdef HAVE_LIBREADLINE
if (interactive && prompt)
{
#ifdef HAVE_READLINE_HISTORY
@ -643,7 +642,6 @@ int main(int argc, char *argv[])
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
rig_close(my_rig); /* close port */
rig_cleanup(my_rig); /* if you care about memory */

Wyświetl plik

@ -321,7 +321,7 @@ static struct test_table *find_cmd_entry(int cmd)
}
}
if (i >= MAXNBOPT || test_list[i].cmd == 0x00)
if (test_list[i].cmd == 0x00)
{
return NULL;
}
@ -380,7 +380,13 @@ int hash_model_id_sort(struct mod_lst *a, struct mod_lst *b)
void hash_sort_by_model_id()
{
HASH_SORT(models, hash_model_id_sort);
if (models != NULL)
{
HASH_SORT(models, hash_model_id_sort);
}
else {
rig_debug(RIG_DEBUG_ERR,"%s: models empty?\n", __func__);
}
}
@ -396,7 +402,6 @@ void hash_delete_all()
}
}
#ifdef HAVE_LIBREADLINE
/* Frees allocated memory and sets pointers to NULL before calling readline
* and then parses the input into space separated tokens.
@ -425,11 +430,8 @@ static void rp_getline(const char *s)
/* Action! Returns typed line with newline stripped. */
input_line = readline(s);
}
#endif
/*
* TODO: use Lex?
*/
@ -576,11 +578,10 @@ static int next_word(char *buffer, int argc, char *argv[], int newline)
}
#define fprintf_flush(f, a...) \
({ int __ret; \
__ret = fprintf((f), a); \
fflush((f)); \
__ret; \
#define fprintf_flush(f, a...) \
({ fprintf((f), a); \
fflush((f)); \
\
})
@ -1014,9 +1015,6 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
rp_hist_buf = (char *)calloc(512, sizeof(char));
#endif
rl_instream = fin;
rl_outstream = fout;
rp_getline("\nRig command: ");
/* EOF (Ctl-D) received on empty input line, bail out gracefully. */
@ -1530,8 +1528,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
#endif
}
#endif /* HAVE_LIBREADLINE */
#endif // HAVE_LIBREADLINE
if (sync_cb) { sync_cb(1); } /* lock if necessary */
@ -3713,14 +3710,14 @@ int dump_chan(FILE *fout, RIG *rig, channel_t *chan)
sprintf_freq(freqbuf, chan->xit);
fprintf(fout, "XIT: %s%s\n", chan->xit > 0 ? "+" : "", freqbuf);
fprintf(fout, "CTCSS: %d.%dHz, ", chan->ctcss_tone / 10, chan->ctcss_tone % 10);
fprintf(fout, "CTCSS: %u.%uHz, ", chan->ctcss_tone / 10, chan->ctcss_tone % 10);
fprintf(fout,
"CTCSSsql: %d.%dHz, ",
"CTCSSsql: %u.%uHz, ",
chan->ctcss_sql / 10,
chan->ctcss_sql % 10);
fprintf(fout, "DCS: %d.%d, ", chan->dcs_code / 10, chan->dcs_code % 10);
fprintf(fout, "DCSsql: %d.%d\n", chan->dcs_sql / 10, chan->dcs_sql % 10);
fprintf(fout, "DCS: %u.%u, ", chan->dcs_code / 10, chan->dcs_code % 10);
fprintf(fout, "DCSsql: %u.%u\n", chan->dcs_sql / 10, chan->dcs_sql % 10);
sprintf_func(prntbuf, chan->funcs);
fprintf(fout, "Functions: %s\n", prntbuf);

Wyświetl plik

@ -101,7 +101,10 @@ int main(int argc, char *argv[])
int retcode; /* generic return code from functions */
int verbose = 0, xml = 0;
int verbose = 0;
#ifdef HAVE_XML2
int xml = 0;
#endif
const char *rig_file = NULL;
int serial_rate = 0;
char *civaddr = NULL; /* NULL means no need to set conf */
@ -311,44 +314,52 @@ int main(int argc, char *argv[])
if (!strcmp(argv[optind], "save"))
{
#ifdef HAVE_XML2
if (xml)
{
retcode = xml_save(rig, argv[optind + 1]);
}
else
#endif
{
retcode = csv_save(rig, argv[optind + 1]);
}
}
else if (!strcmp(argv[optind], "load"))
{
#ifdef HAVE_XML2
if (xml)
{
retcode = xml_load(rig, argv[optind + 1]);
}
else
#endif
{
retcode = csv_load(rig, argv[optind + 1]);
}
}
else if (!strcmp(argv[optind], "save_parm"))
{
#ifdef HAVE_XML2
if (xml)
{
retcode = xml_parm_save(rig, argv[optind + 1]);
}
else
#endif
{
retcode = csv_parm_save(rig, argv[optind + 1]);
}
}
else if (!strcmp(argv[optind], "load_parm"))
{
#ifdef HAVE_XML2
if (xml)
{
retcode = xml_parm_load(rig, argv[optind + 1]);
}
else
#endif
{
retcode = csv_parm_load(rig, argv[optind + 1]);
}

Wyświetl plik

@ -429,12 +429,12 @@ void usage()
int set_conf_rig(RIG *rig, char *conf_parms)
{
char *p;
int ret;
p = conf_parms;
while (p && *p != '\0')
{
int ret;
char *q, *n = NULL;
/* FIXME: left hand value of = cannot be null */
q = strchr(p, '=');

Wyświetl plik

@ -369,15 +369,15 @@ void usage()
int set_conf(RIG *rig, char *conf_parms)
{
char *p, *q, *n;
int ret;
char *p, *n;
p = conf_parms;
while (p && *p != '\0')
{
int ret;
/* FIXME: left hand value of = cannot be null */
q = strchr(p, '=');
char *q = strchr(p, '=');
if (!q)
{

Wyświetl plik

@ -131,7 +131,6 @@ int main(int argc, char *argv[])
const char *hist_dir = NULL;
const char hist_file[] = "/.rotctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif /* HAVE_READLINE_HISTORY */
const char *rot_file = NULL;
@ -391,6 +390,8 @@ int main(int argc, char *argv[])
if (rd_hist || sv_hist)
{
int hist_path_size;
struct stat hist_dir_stat;
if (!(hist_dir = getenv("ROTCTL_HIST_DIR")))
{
hist_dir = getenv("HOME");

Wyświetl plik

@ -120,15 +120,12 @@ static char *input_line = (char *)NULL;
static char *result = (char *)NULL;
static char *parsed_input[sizeof(char *) * 7];
static const int have_rl = 1;
#endif
#ifdef HAVE_READLINE_HISTORY
static char *rp_hist_buf = (char *)NULL;
#endif
#else /* no readline */
static const int have_rl = 0;
#endif
struct test_table
{
unsigned char cmd;
@ -240,7 +237,7 @@ struct test_table *find_cmd_entry(int cmd)
break;
}
if (i >= MAXNBOPT || test_list[i].cmd == 0x00)
if (test_list[i].cmd == 0x00)
{
return NULL;
}
@ -347,8 +344,6 @@ static void rp_getline(const char *s)
/* Action! Returns typed line with newline stripped. */
input_line = readline(s);
}
#endif
@ -517,11 +512,15 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
char arg2[MAXARGSZ + 1], *p2 = NULL;
char arg3[MAXARGSZ + 1], *p3 = NULL;
char arg4[MAXARGSZ + 1], *p4 = NULL;
#ifdef __USEP5P6__
char *p5 = NULL;
char *p6 = NULL;
#endif
/* cmd, internal, rotctld */
#ifdef HAVE_LIBREADLINE
if (!(interactive && prompt && have_rl))
#endif
{
if (interactive)
{
@ -894,7 +893,6 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
}
#ifdef HAVE_LIBREADLINE
if (interactive && prompt && have_rl)
{
int j, x;
@ -906,9 +904,6 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
rp_hist_buf = (char *)calloc(896, sizeof(char));
#endif
rl_instream = fin;
rl_outstream = fout;
rp_getline("\nRotator command: ");
/* EOF (Ctl-D) received on empty input line, bail out gracefully. */
@ -1374,9 +1369,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
#endif
}
#endif /* HAVE_LIBREADLINE */
#endif // HAVE_LIBREADLINE
/*
* mutex locking needed because rotctld is multithreaded
@ -1428,8 +1421,13 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
p2 ? p2 : "",
p3 ? p3 : "",
p4 ? p4 : "",
#ifdef __USEP5P6__
p5 ? p5 : "",
p6 ? p6 : "");
#else
"",
"");
#endif
#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&rot_mutex);
@ -1443,16 +1441,13 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
if (interactive && !prompt)
{
fprintf(fout, NETROTCTL_RET "%d\n", retcode);
ext_resp = 0;
// ext_resp = 0; // not used ?
resp_sep = '\n';
}
else
{
if (cmd_entry != NULL)
{
if (cmd_entry->name != NULL) {
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
}
if (cmd_entry->name != NULL) {
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
}
}
}
@ -1471,7 +1466,6 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
else if (ext_resp && cmd != 0xf0)
{
fprintf(fout, NETROTCTL_RET "0\n");
ext_resp = 0;
resp_sep = '\n';
}
}

Wyświetl plik

@ -193,7 +193,6 @@ do {
*/
#define HASH_DELETE(hh,head,delptr) \
do { \
unsigned _hd_bkt; \
struct UT_hash_handle *_hd_hh_del; \
if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \
uthash_free((head)->hh.tbl->buckets, \
@ -202,6 +201,7 @@ do {
uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
head = NULL; \
} else { \
unsigned _hd_bkt; \
_hd_hh_del = &((delptr)->hh); \
if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \
(head)->hh.tbl->tail = \
@ -271,12 +271,12 @@ do {
} \
_count += _bkt_count; \
if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \
HASH_OOPS("invalid bucket count %d, actual %d\n", \
HASH_OOPS("invalid bucket count %u, actual %u\n", \
(head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \
} \
} \
if (_count != (head)->hh.tbl->num_items) { \
HASH_OOPS("invalid hh item count %d, actual %d\n", \
HASH_OOPS("invalid hh item count %u, actual %u\n", \
(head)->hh.tbl->num_items, _count ); \
} \
/* traverse hh in app order; check next/prev integrity, count */ \
@ -294,7 +294,7 @@ do {
(head)->hh.tbl->hho) : NULL ); \
} \
if (_count != (head)->hh.tbl->num_items) { \
HASH_OOPS("invalid app item count %d, actual %d\n", \
HASH_OOPS("invalid app item count %u, actual %u\n", \
(head)->hh.tbl->num_items, _count ); \
} \
} \
@ -689,19 +689,19 @@ do {
#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn)
#define HASH_SRT(hh,head,cmpfcn) \
do { \
unsigned _hs_i; \
unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \
struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \
if (head) { \
unsigned _hs_looping,_hs_insize,_hs_psize,_hs_qsize; \
_hs_insize = 1; \
_hs_looping = 1; \
_hs_list = &((head)->hh); \
while (_hs_looping) { \
int _hs_nmerges = 0; \
_hs_p = _hs_list; \
_hs_list = NULL; \
_hs_tail = NULL; \
_hs_nmerges = 0; \
while (_hs_p) { \
int _hs_i; \
_hs_nmerges++; \
_hs_q = _hs_p; \
_hs_psize = 0; \
@ -754,7 +754,7 @@ do {
} \
_hs_p = _hs_q; \
} \
_hs_tail->next = NULL; \
if (_hs_tail) _hs_tail->next = NULL; \
if ( _hs_nmerges <= 1 ) { \
_hs_looping=0; \
(head)->hh.tbl->tail = _hs_tail; \

Wyświetl plik

@ -104,6 +104,7 @@ int main(int argc, char **argv)
if (start == MAP_FAILED)
{
perror("mmap:");
close(fd);
return 0;
}

Wyświetl plik

@ -53,17 +53,18 @@ static int ts7400_rot_init(ROT *rot)
{
struct ts7400_rot_priv_data *priv;
priv = (struct ts7400_rot_priv_data *)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct ts7400_rot_priv_data *)
malloc(sizeof(struct ts7400_rot_priv_data));
if (!priv)
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.priv = (void *)priv;
priv = rot->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.rotport.type.rig = RIG_PORT_NONE;
priv->az = priv->el = 0;

Wyświetl plik

@ -229,7 +229,8 @@ transaction_write:
#endif
/* Special case for SQuelch */
if (replystr && !memcmp(cmdstr, "SQ", 2) && (replystr[0] == '-' || replystr[0] == '+'))
if (replystr && !memcmp(cmdstr, "SQ", 2) && (replystr[0] == '-'
|| replystr[0] == '+'))
{
retval = RIG_OK;
goto transaction_quit;
@ -653,7 +654,9 @@ int uniden_set_channel(RIG *rig, const channel_t *chan)
char cmdbuf[BUFSZ], membuf[BUFSZ];
size_t cmd_len = BUFSZ, mem_len = BUFSZ;
int ret;
#if 0 // deprecated
int trunked = 0;
#endif
if (chan->vfo != RIG_VFO_MEM)
{
@ -662,7 +665,11 @@ int uniden_set_channel(RIG *rig, const channel_t *chan)
/* PM089T08511625 */
cmd_len = sprintf(cmdbuf, "PM%03d%c%08u" EOM, chan->channel_num,
#if 0
trunked ? 'T' : ' ',
#else
' ',
#endif
(unsigned)(chan->freq / 100));
ret = uniden_transaction(rig, cmdbuf, cmd_len, NULL, membuf, &mem_len);
@ -672,7 +679,7 @@ int uniden_set_channel(RIG *rig, const channel_t *chan)
return ret;
}
if (chan->vfo == RIG_VFO_MEM && rig->caps->chan_desc_sz != 0)
if (rig->caps->chan_desc_sz != 0)
{
/* only BC780 BC250 BC785 */
cmd_len = sprintf(cmdbuf, "TA C %03d %s" EOM,

Wyświetl plik

@ -190,14 +190,16 @@ int g3_init(RIG *rig)
{
struct g3_priv_data *priv;
priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
rig->state.priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Try to load required dll */
priv->dll = LoadLibrary(WRG3DLL);
@ -232,8 +234,6 @@ int g3_init(RIG *rig)
(FNCGetRawSignalStrength) GetProcAddress(priv->dll, "GetRawSignalStrength");
priv->G3GetInfo = (FNCG3GetInfo) GetProcAddress(priv->dll, "G3GetInfo");
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -191,14 +191,16 @@ int g3_init(RIG *rig)
{
struct g3_priv_data *priv;
priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
rig->state.priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Try to load required dll */
priv->dll = LoadLibrary(WRG3DLL);
@ -233,8 +235,6 @@ int g3_init(RIG *rig)
(FNCGetRawSignalStrength) GetProcAddress(priv->dll, "GetRawSignalStrength");
priv->G3GetInfo = (FNCG3GetInfo) GetProcAddress(priv->dll, "G3GetInfo");
rig->state.priv = (void *)priv;
return RIG_OK;
}

Wyświetl plik

@ -233,14 +233,16 @@ int g313_init(RIG *rig)
{
struct g313_priv_data *priv;
priv = (struct g313_priv_data *)malloc(sizeof(struct g313_priv_data));
rig->state.priv = (struct g313_priv_data *)malloc(sizeof(struct g313_priv_data));
if (!priv)
if (!rig->state.priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv->WaveOutDeviceID = -1;
priv->Opened = 0;
@ -341,8 +343,6 @@ int g313_init(RIG *rig)
"waveOutGetNumDevs");
rig->state.priv = (void *)priv;
return RIG_OK;
}

Some files were not shown because too many files have changed in this diff Show More