Disable auto information mode on open

The current version  of hamlib cannot cope  with unsolicited responses
from rigs  therefore AI  mode should  be turned off  on any  rigs that
support it in case a previous program left it on.
Hamlib-3.0
Bill Somerville 2014-10-13 02:03:53 +01:00
rodzic 3f0ca34760
commit 013d9b4e4f
2 zmienionych plików z 63 dodań i 65 usunięć

Wyświetl plik

@ -85,7 +85,7 @@ const struct rig_caps ft950_caps = {
.max_ifshift = Hz(1000),
.vfo_ops = FT950_VFO_OPS,
.targetable_vfo = RIG_TARGETABLE_FREQ,
.transceive = RIG_TRN_RIG, /* May enable later as the 950 has an Auto Info command */
.transceive = RIG_TRN_OFF, /* May enable later as the 950 has an Auto Info command */
.bank_qty = 0,
.chan_desc_sz = 0,
.str_cal = FT950_STR_CAL,

Wyświetl plik

@ -276,7 +276,7 @@ int newcat_init(RIG *rig) {
priv->rig_id = NC_RIGID_NONE;
priv->current_mem = NC_MEM_CHANNEL_NONE;
return RIG_OK;
return -RIG_OK;
}
@ -298,7 +298,7 @@ int newcat_cleanup(RIG *rig) {
free(rig->state.priv);
rig->state.priv = NULL;
return RIG_OK;
return -RIG_OK;
}
@ -325,7 +325,9 @@ int newcat_open(RIG *rig) {
rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n",
__func__, rig_s->rigport.post_write_delay);
return RIG_OK;
/* Currently we cannot cope with AI mode so turn it off in case
last client left it on */
return newcat_set_trn (rig, RIG_TRN_OFF);
}
@ -341,7 +343,7 @@ int newcat_close(RIG *rig) {
if (!rig)
return -RIG_EINVAL;
return RIG_OK;
return -RIG_OK;
}
/*
@ -475,7 +477,7 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
rig_debug(RIG_DEBUG_TRACE,
"%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, freq, vfo);
return RIG_OK;
return -RIG_OK;
}
@ -553,7 +555,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
if (RIG_PASSBAND_NORMAL == width)
@ -657,14 +659,14 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
case 'B':
*mode = RIG_MODE_FM; /* narrow */
*width = rig_passband_narrow(rig, *mode);
return RIG_OK;
return -RIG_OK;
case 'C':
*mode = RIG_MODE_PKTUSB; /* FT450 USER-U */
break;
case 'D':
*mode = RIG_MODE_AM; /* narrow, FT950 */
*width = rig_passband_narrow(rig, *mode);
return RIG_OK;
return -RIG_OK;
default:
return -RIG_EPROTO;
}
@ -672,11 +674,7 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (RIG_PASSBAND_NORMAL == *width)
*width = rig_passband_normal(rig, *mode);
err = newcat_get_rx_bandwidth(rig, vfo, *mode, width);
if (err < 0)
return err;
return RIG_OK;
return newcat_get_rx_bandwidth(rig, vfo, *mode, width);
}
/*
@ -731,12 +729,12 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo) {
/* get current memory channel */
err = newcat_get_mem(rig, vfo, &mem);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
/* turn on memory channel */
err = newcat_set_mem(rig, vfo, mem);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
/* Set current_mem now */
@ -744,7 +742,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo) {
}
/* Set current_vfo now */
state->current_vfo = vfo;
return RIG_OK;
return -RIG_OK;
default:
return -RIG_ENIMPL; /* sorry, VFO not implemented */
}
@ -755,14 +753,14 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo) {
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str);
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
state->current_vfo = vfo; /* if set_vfo worked, set current_vfo */
rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = 0x%02x\n", __func__, vfo);
return RIG_OK;
return -RIG_OK;
}
@ -829,7 +827,7 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo) {
rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = 0x%02x\n", __func__, state->current_vfo);
return RIG_OK;
return -RIG_OK;
}
@ -891,7 +889,7 @@ int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt)
return -RIG_EPROTO;
}
return RIG_OK;
return -RIG_OK;
}
@ -990,7 +988,7 @@ int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift)
return -RIG_EINVAL;
}
return RIG_OK;
return -RIG_OK;
}
@ -1054,29 +1052,29 @@ int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return err;
err = newcat_get_vfo(rig, &rx_vfo); /* sync to rig current vfo */
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
switch (split) {
case RIG_SPLIT_OFF:
err = newcat_set_tx_vfo(rig, vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
if (rx_vfo != vfo) {
err = newcat_set_vfo(rig, vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
}
break;
case RIG_SPLIT_ON:
err = newcat_set_tx_vfo(rig, tx_vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
if (rx_vfo != vfo) {
err = newcat_set_vfo(rig, vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
}
break;
@ -1084,7 +1082,7 @@ int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return -RIG_EINVAL;
}
return RIG_OK;
return -RIG_OK;
}
@ -1095,11 +1093,11 @@ int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
err = newcat_set_vfo_from_alias(rig, &vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
err = newcat_get_tx_vfo(rig, tx_vfo);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
if (*tx_vfo != vfo)
@ -1109,7 +1107,7 @@ int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "SPLIT = %d, vfo = %d, TX_vfo = %d\n", *split, vfo, *tx_vfo);
return RIG_OK;
return -RIG_OK;
}
@ -1170,7 +1168,7 @@ int newcat_get_rit(RIG * rig, vfo_t vfo, shortfreq_t * rit)
if (rit_on == '1')
*rit = (shortfreq_t) atoi(retval);
return RIG_OK;
return -RIG_OK;
}
@ -1231,7 +1229,7 @@ int newcat_get_xit(RIG * rig, vfo_t vfo, shortfreq_t * xit)
if (xit_on == '1')
*xit = (shortfreq_t) atoi(retval);
return RIG_OK;
return -RIG_OK;
}
@ -1256,7 +1254,7 @@ int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts)
else
err = newcat_set_faststep(rig, TRUE);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
ts_match = TRUE;
break;
@ -1265,7 +1263,7 @@ int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts)
rig_debug(RIG_DEBUG_TRACE, "ts_match = %d, i = %d, ts = %d\n", ts_match, i, ts);
if (ts_match)
return RIG_OK;
return -RIG_OK;
else
return -RIG_ENAVAIL;
}
@ -1304,7 +1302,7 @@ int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts)
rig_debug(RIG_DEBUG_TRACE, "ts_match = %d, i = %d, i+1 = %d, *ts = %d\n", ts_match, i, i+1, *ts);
if (ts_match)
return RIG_OK;
return -RIG_OK;
else
return -RIG_ENAVAIL;
}
@ -1435,7 +1433,7 @@ int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone)
*tone = rig->caps->ctcss_list[t];
return RIG_OK;
return -RIG_OK;
}
@ -1478,17 +1476,17 @@ int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
err = newcat_set_ctcss_tone(rig, vfo, tone);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
/* Change to sql */
if (tone) {
err = newcat_set_func(rig, vfo, RIG_FUNC_TSQL, TRUE);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
}
return RIG_OK;
return -RIG_OK;
}
@ -1559,7 +1557,7 @@ int newcat_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq,
rig_debug(RIG_DEBUG_TRACE, "default - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower);
}
return RIG_OK;
return -RIG_OK;
}
@ -1618,7 +1616,7 @@ int newcat_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq,
rig_debug(RIG_DEBUG_TRACE, "default - rig_id = %d, *power = %f\n", rig_id, *power);
}
return RIG_OK;
return -RIG_OK;
}
@ -1694,7 +1692,7 @@ int newcat_get_powerstat(RIG * rig, powerstat_t * status)
return -RIG_ENAVAIL;
}
return RIG_OK;
return -RIG_OK;
}
@ -1807,7 +1805,7 @@ int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t * ant)
return -RIG_EPROTO;
}
return RIG_OK;
return -RIG_OK;
}
@ -1906,7 +1904,7 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
case RIG_METER_ALC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS1;"); break;
case RIG_METER_PO:
if (newcat_is_rig(rig, RIG_MODEL_FT950))
return RIG_OK;
return -RIG_OK;
else
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS2;");
break;
@ -2342,7 +2340,7 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
return -RIG_EINVAL;
}
return RIG_OK;
return -RIG_OK;
}
@ -2558,7 +2556,7 @@ int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status)
return -RIG_EINVAL;
}
return RIG_OK;
return -RIG_OK;
}
@ -2725,17 +2723,17 @@ int newcat_set_mem(RIG * rig, vfo_t vfo, int ch)
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
/* Restore VFO even if setting to blank memory channel */
if (restore_vfo) {
err = newcat_vfomem_toggle(rig);
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
}
return RIG_OK;
return -RIG_OK;
}
@ -2761,7 +2759,7 @@ int newcat_get_mem(RIG * rig, vfo_t vfo, int *ch)
*ch = atoi(priv->ret_data + 2);
return RIG_OK;
return -RIG_OK;
}
int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op)
@ -2891,7 +2889,7 @@ int newcat_get_trn(RIG * rig, int *trn)
else
*trn = RIG_TRN_RIG;
return RIG_OK;
return -RIG_OK;
}
@ -3024,7 +3022,7 @@ int newcat_set_channel(RIG * rig, const channel_t * chan)
/* Set Memory Channel */
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
if (err != RIG_OK)
if (err != -RIG_OK)
return err;
/* Restore VFO ********************************** */
@ -3033,7 +3031,7 @@ int newcat_set_channel(RIG * rig, const channel_t * chan)
return err;
}
return RIG_OK;
return -RIG_OK;
}
@ -3165,7 +3163,7 @@ int newcat_get_channel(RIG * rig, channel_t * chan)
retval = priv->ret_data + 5;
chan->freq = atof(retval);
return RIG_OK;
return -RIG_OK;
}
@ -3331,7 +3329,7 @@ int newcat_set_tx_vfo(RIG * rig, vfo_t tx_vfo) {
case RIG_VFO_MEM:
/* VFO A */
if (priv->current_mem == NC_MEM_CHANNEL_NONE)
return RIG_OK;
return -RIG_OK;
else /* Memory Channel mode */
p1 = '0';
break;
@ -3399,7 +3397,7 @@ int newcat_get_tx_vfo(RIG * rig, vfo_t * tx_vfo) {
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo = 0x%02x\n", __func__, *tx_vfo);
return RIG_OK;
return -RIG_OK;
}
@ -3432,7 +3430,7 @@ int newcat_set_vfo_from_alias(RIG * rig, vfo_t * vfo) {
return -RIG_EINVAL;
}
return RIG_OK;
return -RIG_OK;
}
/*
@ -3529,7 +3527,7 @@ int newcat_get_narrow(RIG * rig, vfo_t vfo, ncboolean * narrow)
else
*narrow = FALSE;
return RIG_OK;
return -RIG_OK;
}
@ -3760,7 +3758,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
case RIG_MODE_AM:
case RIG_MODE_PKTFM:
case RIG_MODE_FM:
return RIG_OK;
return -RIG_OK;
default:
return -RIG_EINVAL;
} /* end switch(mode) */
@ -3787,13 +3785,13 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
case RIG_MODE_AM:
case RIG_MODE_PKTFM:
case RIG_MODE_FM:
return RIG_OK;
return -RIG_OK;
default:
return -RIG_EINVAL;
} /* end switch (mode) */
} /* end else */
return RIG_OK;
return -RIG_OK;
}
@ -3846,7 +3844,7 @@ int newcat_get_faststep(RIG * rig, ncboolean * fast_step)
else
*fast_step = FALSE;
return RIG_OK;
return -RIG_OK;
}
@ -3876,7 +3874,7 @@ int newcat_get_rigid(RIG * rig)
* input: RIG *, vfo_t *
* output: VFO mode: RIG_VFO_VFO for VFO A and B
* RIG_VFO_MEM for VFO MEM
* return: RIG_OK or error
* return: -RIG_OK or error
*/
int newcat_get_vfo_mode(RIG * rig, vfo_t * vfo_mode)
{
@ -3919,7 +3917,7 @@ int newcat_get_vfo_mode(RIG * rig, vfo_t * vfo_mode)
* Writed data and waits for responce
* input: complete CAT command string including termination in cmd_str
* output: complete CAT command answer string in ret_data
* return: RIG_OK or error
* return: -RIG_OK or error
*/