astyle files for 4.5 release

pull/1095/head
Mike Black W9MDB 2022-07-27 17:16:17 -05:00
rodzic 44ad5c6363
commit a83eb3bf42
79 zmienionych plików z 2201 dodań i 1659 usunięć

Wyświetl plik

@ -68,7 +68,7 @@ int kpa_init(AMP *amp)
}
amp->state.priv = (struct kpa_priv_data *)
calloc(1,sizeof(struct kpa_priv_data));
calloc(1, sizeof(struct kpa_priv_data));
if (!amp->state.priv)
{

Wyświetl plik

@ -44,7 +44,7 @@ int gemini_init(AMP *amp)
}
amp->state.priv = (struct gemini_priv_data *)
calloc(1,sizeof(struct gemini_priv_data));
calloc(1, sizeof(struct gemini_priv_data));
if (!amp->state.priv)
{
@ -207,20 +207,23 @@ int gemini_set_freq(AMP *amp, freq_t freq)
char *cmd;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (freq < 1.0) cmd = "B472KHZ\n";
else if (freq < 2.0) cmd = "B1.8MHZ\n";
else if (freq < 4.0) cmd = "B3.5MHZ\n";
else if (freq < 6.0) cmd = "B50MHZ\n";
else if (freq < 9.0) cmd = "B70MHZ\n";
else if (freq < 12.0) cmd = "B10MHZ\n";
else if (freq < 16.0) cmd = "B14MHZ\n";
else if (freq < 19.0) cmd = "B18MHZ\n";
else if (freq < 22.0) cmd = "B21MHZ\n";
else if (freq < 26.0) cmd = "B24MHZ\n";
else cmd = "B50MHZ\n";
if (freq < 1.0) { cmd = "B472KHZ\n"; }
else if (freq < 2.0) { cmd = "B1.8MHZ\n"; }
else if (freq < 4.0) { cmd = "B3.5MHZ\n"; }
else if (freq < 6.0) { cmd = "B50MHZ\n"; }
else if (freq < 9.0) { cmd = "B70MHZ\n"; }
else if (freq < 12.0) { cmd = "B10MHZ\n"; }
else if (freq < 16.0) { cmd = "B14MHZ\n"; }
else if (freq < 19.0) { cmd = "B18MHZ\n"; }
else if (freq < 22.0) { cmd = "B21MHZ\n"; }
else if (freq < 26.0) { cmd = "B24MHZ\n"; }
else { cmd = "B50MHZ\n"; }
retval = gemini_transaction(amp, cmd, NULL, 0);
if (retval != RIG_OK) { return retval; }
return RIG_OK;
}

Wyświetl plik

@ -62,7 +62,7 @@ char *getlibpath(void)
if (!c) { continue; }
libpath = calloc(1,strlen(c) + 1);
libpath = calloc(1, strlen(c) + 1);
strcpy(libpath, c);
break;
}
@ -115,7 +115,7 @@ lt_dlhandle adlopen(const char *filename)
if (libpath == NULL || filename == NULL) { return NULL; }
c = calloc(1,strlen(libpath) + strlen(APREFIX) + strlen(filename) + strlen(
c = calloc(1, strlen(libpath) + strlen(APREFIX) + strlen(filename) + strlen(
ASUFFIX) + 1);
strcpy(c, libpath);
strcat(c, APREFIX);

Wyświetl plik

@ -168,7 +168,7 @@ typedef struct internal_hooks
/* work around MSVC error C2322: '...' address of dllimport '...' is not static */
static void *CJSON_CDECL internal_malloc(size_t size)
{
return calloc(1,size);
return calloc(1, size);
}
static void CJSON_CDECL internal_free(void *pointer)
{

Wyświetl plik

@ -96,7 +96,7 @@ int getaddrinfo(const char *node, const char *service,
return -1;
}
p = calloc(1,sizeof(struct addrinfo));
p = calloc(1, sizeof(struct addrinfo));
if (!p)
{
@ -108,7 +108,7 @@ int getaddrinfo(const char *node, const char *service,
p->ai_socktype = ai_socktype;
p->ai_protocol = ai_protocol;
p->ai_addrlen = sizeof(struct sockaddr_in);
p->ai_addr = calloc(1,p->ai_addrlen);
p->ai_addr = calloc(1, p->ai_addrlen);
if (!p->ai_addr)
{

Wyświetl plik

@ -223,7 +223,7 @@ exchange(argv)
char **argv;
{
int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char *);
char **temp = (char **) calloc(1,nonopts_size);
char **temp = (char **) calloc(1, nonopts_size);
/* Interchange the two blocks of data in ARGV. */

Wyświetl plik

@ -1208,7 +1208,7 @@ static struct termios_list *add_port(const char *filename)
ENTER("add_port");
port = calloc(1,sizeof(struct termios_list));
port = calloc(1, sizeof(struct termios_list));
if (!port)
{
@ -1217,7 +1217,7 @@ static struct termios_list *add_port(const char *filename)
memset(port, 0, sizeof(struct termios_list));
port->ttyset = calloc(1,sizeof(struct termios));
port->ttyset = calloc(1, sizeof(struct termios));
if (! port->ttyset)
{
@ -1226,7 +1226,7 @@ static struct termios_list *add_port(const char *filename)
memset(port->ttyset, 0, sizeof(struct termios));
port->sstruct = calloc(1,sizeof(struct serial_struct));
port->sstruct = calloc(1, sizeof(struct serial_struct));
if (! port->sstruct)
{
@ -1234,7 +1234,7 @@ static struct termios_list *add_port(const char *filename)
}
memset(port->sstruct, 0, sizeof(struct serial_struct));
port->sis = calloc(1,sizeof(struct serial_icounter_struct));
port->sis = calloc(1, sizeof(struct serial_icounter_struct));
if (! port->sis)
{
@ -3407,7 +3407,7 @@ int win32_serial_ioctl(int fd, int request, ...)
case TIOCGSERIAL:
report("TIOCGSERIAL\n");
dcb = calloc(1,sizeof(DCB));
dcb = calloc(1, sizeof(DCB));
if (!dcb)
{
@ -3438,7 +3438,7 @@ int win32_serial_ioctl(int fd, int request, ...)
case TIOCSSERIAL:
report("TIOCSSERIAL\n");
dcb = calloc(1,sizeof(DCB));
dcb = calloc(1, sizeof(DCB));
if (!dcb)
{

Wyświetl plik

@ -282,7 +282,7 @@ int ar3030_init(RIG *rig)
{
struct ar3030_priv_data *priv;
rig->state.priv = calloc(1,sizeof(struct ar3030_priv_data));
rig->state.priv = calloc(1, sizeof(struct ar3030_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -257,7 +257,7 @@ static int ar7030p_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ar7030p_priv_data *)
calloc(1,sizeof(struct ar7030p_priv_data));
calloc(1, sizeof(struct ar7030p_priv_data));
if (!priv)
{

Wyświetl plik

@ -102,7 +102,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int drake_init(RIG *rig)
{
struct drake_priv_data *priv;
rig->state.priv = calloc(1,sizeof(struct drake_priv_data));
rig->state.priv = calloc(1, sizeof(struct drake_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -56,7 +56,7 @@ static int dummy_amp_init(AMP *amp)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
amp->state.priv = (struct dummy_amp_priv_data *)
calloc(1,sizeof(struct dummy_amp_priv_data));
calloc(1, sizeof(struct dummy_amp_priv_data));
if (!amp->state.priv)
{

Wyświetl plik

@ -222,7 +222,7 @@ static int dummy_init(RIG *rig)
int i;
ENTERFUNC;
priv = (struct dummy_priv_data *)calloc(1,sizeof(struct dummy_priv_data));
priv = (struct dummy_priv_data *)calloc(1, sizeof(struct dummy_priv_data));
if (!priv)
{

Wyświetl plik

@ -613,7 +613,7 @@ static int flrig_init(RIG *rig)
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
rig->state.priv = (struct flrig_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct flrig_priv_data *)calloc(1, sizeof(
struct flrig_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -168,7 +168,7 @@ static int netrigctl_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct netrigctl_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct netrigctl_priv_data *)calloc(1, sizeof(
struct netrigctl_priv_data));
if (!rig->state.priv)
@ -296,7 +296,7 @@ static int netrigctl_open(RIG *rig)
if (ret <= 0)
{
RETURNFUNC( (ret < 0) ? ret : -RIG_EPROTO);
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
}
prot_ver = atoi(buf);
@ -304,7 +304,7 @@ static int netrigctl_open(RIG *rig)
if (prot_ver < RIGCTLD_PROT_VER)
{
RETURNFUNC( -RIG_EPROTO);
RETURNFUNC(-RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
@ -2387,7 +2387,7 @@ static int netrigctl_send_dtmf(RIG *rig, vfo_t vfo, const char *digits)
// allocate memory for size of (cmd + digits + \n + \0)
len = strlen(cmd) + strlen(digits) + 2;
cmdp = calloc(1,len);
cmdp = calloc(1, len);
if (cmdp == NULL)
{
@ -2470,7 +2470,7 @@ static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg)
// allocate memory for size of (cmd + msg + \n + \0)
len = strlen(cmd) + strlen(msg) + 2;
cmdp = calloc(1,len);
cmdp = calloc(1, len);
if (cmdp == NULL)
{
@ -2656,6 +2656,7 @@ int netrigctl_set_lock_mode(RIG *rig, int lock)
{
return -RIG_EPROTO;
}
return (RIG_OK);
}
@ -2666,11 +2667,13 @@ int netrigctl_get_lock_mode(RIG *rig, int *lock)
int ret;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\get_lock_mode\n");
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (ret == 0)
{
return -RIG_EPROTO;
}
sscanf(buf,"%d", lock);
sscanf(buf, "%d", lock);
return (RIG_OK);
}

Wyświetl plik

@ -121,7 +121,7 @@ static int dummy_rot_init(ROT *rot)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct dummy_rot_priv_data *)
calloc(1,sizeof(struct dummy_rot_priv_data));
calloc(1, sizeof(struct dummy_rot_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -424,7 +424,7 @@ static int tci1x_init(RIG *rig)
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
rig->state.priv = (struct tci1x_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct tci1x_priv_data *)calloc(1, sizeof(
struct tci1x_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -263,7 +263,7 @@ static int trxmanager_init(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
rig->state.priv = (struct trxmanager_priv_data *)calloc(1,
sizeof(struct trxmanager_priv_data));
sizeof(struct trxmanager_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -203,7 +203,7 @@ transaction_write:
len = strlen(cmdstr);
cmd = calloc(1,len + 2);
cmd = calloc(1, len + 2);
if (cmd == NULL)
{
@ -515,7 +515,7 @@ int elad_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.priv = calloc(1,sizeof(struct elad_priv_data));
rig->state.priv = calloc(1, sizeof(struct elad_priv_data));
if (rig->state.priv == NULL)
{
@ -917,9 +917,12 @@ int elad_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
if (split == tsplit)
{
rig_debug(RIG_DEBUG_TRACE, "%s: No change detected...ignoring request\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: No change detected...ignoring request\n",
__func__);
}
rig_debug(RIG_DEBUG_TRACE, "%s: Change detected requested split %d!=%d\n", __func__, split, tsplit);
rig_debug(RIG_DEBUG_TRACE, "%s: Change detected requested split %d!=%d\n",
__func__, split, tsplit);
if (split)
{

Wyświetl plik

@ -195,7 +195,7 @@ int sdr1k_init(RIG *rig)
{
struct sdr1k_priv_data *priv;
rig->state.priv = (struct sdr1k_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct sdr1k_priv_data *)calloc(1, sizeof(
struct sdr1k_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -114,7 +114,7 @@ static int gs100_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
priv = (struct gs100_priv_data *)calloc(1,sizeof(struct gs100_priv_data));
priv = (struct gs100_priv_data *)calloc(1, sizeof(struct gs100_priv_data));
if (!priv)
{

Wyświetl plik

@ -132,7 +132,7 @@ int icmarine_init(RIG *rig)
priv_caps = (const struct icmarine_priv_caps *) caps->priv;
rig->state.priv = (struct icmarine_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct icmarine_priv_data *)calloc(1, sizeof(
struct icmarine_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -588,22 +588,26 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
case RIG_MODE_USB: icmode = S_USB; break;
case RIG_MODE_PKTUSB:
icmode = S_USB;
case RIG_MODE_PKTUSB:
icmode = S_USB;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
icmode = S_PSK;
}
break;
case RIG_MODE_LSB: icmode = S_LSB; break;
case RIG_MODE_PKTLSB:
case RIG_MODE_PKTLSB:
icmode = S_LSB;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
icmode = S_PSKR;
}
break;
case RIG_MODE_RTTY: icmode = S_RTTY; break;
@ -746,20 +750,24 @@ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode,
case S_RTTYR: *mode = RIG_MODE_RTTYR; break;
case S_PSK:
*mode = RIG_MODE_PSK;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
*mode = RIG_MODE_PKTUSB;
}
break;
*mode = RIG_MODE_PSK;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
*mode = RIG_MODE_PKTUSB;
}
break;
case S_PSKR:
*mode = RIG_MODE_PSKR;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
*mode = RIG_MODE_PKTLSB;
}
break;
*mode = RIG_MODE_PSKR;
if (rig->caps->rig_model == RIG_MODEL_IC7800)
{
*mode = RIG_MODE_PKTLSB;
}
break;
case S_DSTAR: *mode = RIG_MODE_DSTAR; break;

Wyświetl plik

@ -932,9 +932,11 @@ static void icom_satmode_fix(RIG *rig, int satmode)
{
if (rig->caps->rig_model == RIG_MODEL_IC9700)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: toggling IC9700 targetable for satmode=%d\n", __func__, satmode);
if (satmode) rig->caps->targetable_vfo = 0;
else rig->caps->targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE;
rig_debug(RIG_DEBUG_VERBOSE, "%s: toggling IC9700 targetable for satmode=%d\n",
__func__, satmode);
if (satmode) { rig->caps->targetable_vfo = 0; }
else { rig->caps->targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE; }
}
}
@ -2675,7 +2677,7 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
}
}
if (*mode == RIG_MODE_FM) *width = 12000;
if (*mode == RIG_MODE_FM) { *width = 12000; }
RETURNFUNC2(RIG_OK);
}
@ -5270,7 +5272,7 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
{
// satmode defaults to 0 -- only call if we need to
rig_get_func((RIG *)rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
icom_satmode_fix(rig,satmode);
icom_satmode_fix(rig, satmode);
}
rig->state.cache.satmode = satmode;
@ -5376,7 +5378,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
icom_satmode_fix(rig,satmode);
icom_satmode_fix(rig, satmode);
}
rig->state.cache.satmode = satmode;
@ -5606,7 +5608,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
icom_satmode_fix(rig,satmode);
icom_satmode_fix(rig, satmode);
}
rig->state.cache.satmode = satmode;
@ -5619,8 +5621,9 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
int retry_save = rs->rigport.retry;
rs->rigport.retry = 0;
cmd = C_SEND_SEL_FREQ;
// when transmitting in split mode the split VFO is active
subcmd = (rig->state.cache.split && rig->state.cache.ptt)? 0x00 : 0x01; // get the unselected vfo
// when transmitting in split mode the split VFO is active
subcmd = (rig->state.cache.split
&& rig->state.cache.ptt) ? 0x00 : 0x01; // get the unselected vfo
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf,
&ack_len);
@ -6320,7 +6323,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
"%s: VFO_SUB and satmode is off so turning satmode on\n",
__func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 1);
icom_satmode_fix(rig,1);
icom_satmode_fix(rig, 1);
rig->state.cache.satmode = 1;
priv->tx_vfo = RIG_VFO_SUB;
}
@ -6331,7 +6334,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
"%s: VFO_B and satmode is on so turning satmode off\n",
__func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0);
icom_satmode_fix(rig,0);
icom_satmode_fix(rig, 0);
rig->state.cache.satmode = 0;
priv->tx_vfo = RIG_VFO_B;
}
@ -6597,7 +6600,7 @@ int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
icom_satmode_fix(rig,satmode);
icom_satmode_fix(rig, satmode);
if (satmode != rig->state.cache.satmode)
{
@ -7008,7 +7011,7 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
status; // we reset this to current status -- fails in SATMODE
priv->x1cx03cmdfails = 0; // we reset this to try it again
rig->state.cache.satmode = status;
icom_satmode_fix(rig,status);
icom_satmode_fix(rig, status);
break;

Wyświetl plik

@ -70,7 +70,7 @@ int optoscan_open(RIG *rig)
rs = &rig->state;
priv = (struct icom_priv_data *)rs->priv;
pltstate = calloc(1,sizeof(pltstate_t));
pltstate = calloc(1, sizeof(pltstate_t));
if (!pltstate)
{

Wyświetl plik

@ -281,7 +281,7 @@ const struct rig_caps jst245_caps =
static int jst145_init(RIG *rig)
{
struct jst145_priv_data *priv;
priv = (struct jst145_priv_data *)calloc(1,sizeof(struct jst145_priv_data));
priv = (struct jst145_priv_data *)calloc(1, sizeof(struct jst145_priv_data));
if (!priv)
{

Wyświetl plik

@ -298,7 +298,7 @@ transaction_write:
len = strlen(cmdstr);
cmd = calloc(1,len + 2);
cmd = calloc(1, len + 2);
if (cmd == NULL)
{
@ -489,7 +489,8 @@ transaction_read:
if (retry_read++ < rs->rigport.retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly %d of %d\n", __func__, retry_read, rs->rigport.retry);
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly %d of %d\n", __func__,
retry_read, rs->rigport.retry);
hl_usleep(rig->caps->timeout * 1000);
goto transaction_write;
}
@ -724,7 +725,7 @@ int kenwood_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s/%s\n", __func__,
BACKEND_VER, rig->caps->version);
rig->state.priv = calloc(1,sizeof(struct kenwood_priv_data));
rig->state.priv = calloc(1, sizeof(struct kenwood_priv_data));
if (rig->state.priv == NULL)
{
@ -1101,7 +1102,9 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
struct kenwood_priv_data *priv = rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, is_emulation=%d, curr_mode=%s\n", __func__, rig_strvfo(vfo), priv->is_emulation, rig_strrmode(priv->curr_mode));
rig_debug(RIG_DEBUG_VERBOSE,
"%s called vfo=%s, is_emulation=%d, curr_mode=%s\n", __func__, rig_strvfo(vfo),
priv->is_emulation, rig_strrmode(priv->curr_mode));
/* Emulations do not need to set VFO since VFOB is a copy of VFOA
@ -1116,12 +1119,14 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
}
#if 0
if (rig->state.current_vfo == vfo)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo already is %s...skipping\n", __func__,
rig_strvfo(vfo));
RETURNFUNC2(RIG_OK);
}
#endif
switch (vfo)
@ -1631,12 +1636,14 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split,
if (rig->state.rx_vfo == RIG_VFO_A)
{
HAMLIB_TRACE;
*txvfo = rig->state.tx_vfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
*txvfo = rig->state.tx_vfo = priv->tx_vfo = (*split
&& !transmitting) ? RIG_VFO_B : RIG_VFO_A;
}
else if (rig->state.rx_vfo == RIG_VFO_B)
{
HAMLIB_TRACE;
*txvfo = rig->state.tx_vfo = priv->tx_vfo = (*split && !transmitting) ? RIG_VFO_B : RIG_VFO_A;
*txvfo = rig->state.tx_vfo = priv->tx_vfo = (*split
&& !transmitting) ? RIG_VFO_B : RIG_VFO_A;
}
else
{
@ -1958,6 +1965,7 @@ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL);
}
if (rig->caps->rig_model == RIG_MODEL_MALACHITE && vfo == RIG_VFO_B)
{
// Malachite does not have VFOB so we'll just return VFOA
@ -2875,14 +2883,16 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
expected_length = 18;
}
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, expected_length + 1,
NULL, 0, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) levelbuf,
expected_length + 1,
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
if (retval != expected_length)
{
rig_debug(RIG_DEBUG_ERR, "%s: expected %d, got %d in '%s'\n", __func__, expected_length,
rig_debug(RIG_DEBUG_ERR, "%s: expected %d, got %d in '%s'\n", __func__,
expected_length,
retval,
levelbuf);
RETURNFUNC(-RIG_EPROTO);

Plik diff jest za duży Load Diff

Wyświetl plik

@ -178,7 +178,7 @@ int xg3_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct xg3_priv_data *)calloc(1,sizeof(struct xg3_priv_data));
priv = (struct xg3_priv_data *)calloc(1, sizeof(struct xg3_priv_data));
if (!priv)
{

Wyświetl plik

@ -171,7 +171,7 @@ int dds60_init(RIG *rig)
{
struct dds60_priv_data *priv;
rig->state.priv = (struct dds60_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct dds60_priv_data *)calloc(1, sizeof(
struct dds60_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -171,7 +171,7 @@ int drt1_init(RIG *rig)
{
struct drt1_priv_data *priv;
rig->state.priv = (struct drt1_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct drt1_priv_data *)calloc(1, sizeof(
struct drt1_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -228,7 +228,7 @@ int dwtdll_init(RIG *rig)
{
struct dwtdll_priv_data *priv;
rig->state.priv = (struct dwtdll_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct dwtdll_priv_data *)calloc(1, sizeof(
struct dwtdll_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -163,7 +163,7 @@ int elektor304_init(RIG *rig)
{
struct elektor304_priv_data *priv;
rig->state.priv = (struct elektor304_priv_data *)calloc(1,sizeof(struct
rig->state.priv = (struct elektor304_priv_data *)calloc(1, sizeof(struct
elektor304_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -296,7 +296,7 @@ int hiqsdr_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.priv = (struct hiqsdr_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct hiqsdr_priv_data *)calloc(1, sizeof(
struct hiqsdr_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -481,7 +481,8 @@ pcr_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct pcr_priv_data *) calloc(1,sizeof(struct pcr_priv_data));
rig->state.priv = (struct pcr_priv_data *) calloc(1,
sizeof(struct pcr_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -219,7 +219,7 @@ int ra37xx_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ra37xx_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct ra37xx_priv_data *)calloc(1, sizeof(
struct ra37xx_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -124,7 +124,7 @@ int racal_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct racal_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct racal_priv_data *)calloc(1, sizeof(
struct racal_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -217,7 +217,7 @@ static int cu_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
rig->state.priv = calloc(1,sizeof(struct cu_priv_data));
rig->state.priv = calloc(1, sizeof(struct cu_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -293,7 +293,7 @@ int tt538_init(RIG *rig)
{
struct tt538_priv_data *priv;
rig->state.priv = (struct tt538_priv_data *) calloc(1,sizeof(
rig->state.priv = (struct tt538_priv_data *) calloc(1, sizeof(
struct tt538_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -295,7 +295,8 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
{
return RIG_OK;
}
if (retval == -RIG_ETIMEOUT) return retval;
if (retval == -RIG_ETIMEOUT) { return retval; }
rig_debug(RIG_DEBUG_ERR, "%s: read_string failed, try#%d\n", __func__, i + 1);
}
@ -332,7 +333,7 @@ int tt588_init(RIG *rig)
struct tt588_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
rig->state.priv = (struct tt588_priv_data *) calloc(1,sizeof(
rig->state.priv = (struct tt588_priv_data *) calloc(1, sizeof(
struct tt588_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -225,7 +225,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int tt565_init(RIG *rig)
{
struct tt565_priv_data *priv;
rig->state.priv = (struct tt565_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct tt565_priv_data *)calloc(1, sizeof(
struct tt565_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
@ -1210,20 +1210,23 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (rig->caps->rig_model == RIG_MODEL_TT599)
{
ii = (int)(val.f * 10);
if (ii > 9) ii=9; // cannot set NR level 10 apparently
if (ii > 9) { ii = 9; } // cannot set NR level 10 apparently
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*RMNN%c" EOM, ii);
}
else
{
/* Noise Reduction (blanking) Float 0.0 - 1.0
For some reason NB setting is supported in 1.372, but
NR, NOTCH, and AN are not.
FOR NOW -- RIG_LEVEL_NR controls the Orion NB setting
*/
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cNB%d" EOM,
which_receiver(rig, vfo),
(int)(val.f * 9));
/* Noise Reduction (blanking) Float 0.0 - 1.0
For some reason NB setting is supported in 1.372, but
NR, NOTCH, and AN are not.
FOR NOW -- RIG_LEVEL_NR controls the Orion NB setting
*/
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cNB%d" EOM,
which_receiver(rig, vfo),
(int)(val.f * 9));
}
break;
case RIG_LEVEL_VOXDELAY:
@ -1692,15 +1695,16 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
case RIG_LEVEL_NR:
/* RIG_LEVEL_NR controls Orion NB setting - TEMP */
if (rig->caps->rig_model == RIG_MODEL_TT599)
{
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?RMNN" EOM)
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?RMNN" EOM)
}
else
{
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cNB" EOM,
which_receiver(rig, vfo));
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cNB" EOM,
which_receiver(rig, vfo));
}
lvl_len = sizeof(lvlbuf);
@ -1717,6 +1721,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
__func__, lvlbuf);
return -RIG_EPROTO;
}
sscanf(lvlbuf + 5, "%f", &val->f);
val->f /= 10.0;
break;

Wyświetl plik

@ -212,7 +212,7 @@ int tt585_init(RIG *rig)
{
struct tt585_priv_data *priv;
rig->state.priv = (struct tt585_priv_data *) calloc(1,sizeof(
rig->state.priv = (struct tt585_priv_data *) calloc(1, sizeof(
struct tt585_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -295,7 +295,7 @@ int rx331_init(RIG *rig)
{
struct rx331_priv_data *priv;
rig->state.priv = (struct rx331_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct rx331_priv_data *)calloc(1, sizeof(
struct rx331_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -239,7 +239,7 @@ int rx340_init(RIG *rig)
{
struct rx340_priv_data *priv;
priv = (struct rx340_priv_data *)calloc(1,sizeof(struct rx340_priv_data));
priv = (struct rx340_priv_data *)calloc(1, sizeof(struct rx340_priv_data));
if (!priv)
{

Wyświetl plik

@ -109,7 +109,7 @@ int tentec_init(RIG *rig)
{
struct tentec_priv_data *priv;
rig->state.priv = (struct tentec_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct tentec_priv_data *)calloc(1, sizeof(
struct tentec_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -360,7 +360,7 @@ tt550_init(RIG *rig)
{
struct tt550_priv_data *priv;
rig->state.priv = (struct tt550_priv_data *) calloc(1,sizeof(
rig->state.priv = (struct tt550_priv_data *) calloc(1, sizeof(
struct tt550_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -190,7 +190,7 @@ int g3_init(RIG *rig)
{
struct g3_priv_data *priv;
rig->state.priv = (struct g3_priv_data *)calloc(1,sizeof(struct g3_priv_data));
rig->state.priv = (struct g3_priv_data *)calloc(1, sizeof(struct g3_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -191,7 +191,7 @@ int g3_init(RIG *rig)
{
struct g3_priv_data *priv;
rig->state.priv = (struct g3_priv_data *)calloc(1,sizeof(struct g3_priv_data));
rig->state.priv = (struct g3_priv_data *)calloc(1, sizeof(struct g3_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -112,7 +112,7 @@ int g313_init(RIG *rig)
{
struct g313_priv_data *priv;
priv = (struct g313_priv_data *)calloc(1,sizeof(struct g313_priv_data));
priv = (struct g313_priv_data *)calloc(1, sizeof(struct g313_priv_data));
if (!priv)
{

Wyświetl plik

@ -234,7 +234,7 @@ int g313_init(RIG *rig)
{
struct g313_priv_data *priv;
rig->state.priv = (struct g313_priv_data *)calloc(1,sizeof(
rig->state.priv = (struct g313_priv_data *)calloc(1, sizeof(
struct g313_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -211,7 +211,7 @@ int wj_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct wj_priv_data *)calloc(1,sizeof(struct wj_priv_data));
rig->state.priv = (struct wj_priv_data *)calloc(1, sizeof(struct wj_priv_data));
if (!rig->state.priv)
{

Wyświetl plik

@ -730,7 +730,9 @@ int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
}
int factor = 10;
if (p->fm_status[3]==1) factor = 100;
if (p->fm_status[3] == 1) { factor = 100; }
*freq = from_bcd_be(p->fm_status, 8) * factor;
return RIG_OK;

285
rigs/yaesu/ft990v12.c 100755 → 100644
Wyświetl plik

@ -30,11 +30,11 @@
* G0OAN
*/
/* MODIFIED VERSION for FT-990 with ROM v1.2 : June 2022
* The standard version was written for FT-990 with ROM v1.3 and as the CAT spec was different to ROM v1.2 CAT
* The standard version was written for FT-990 with ROM v1.3 and as the CAT spec was different to ROM v1.2 CAT
* would not work with the older ROM. This version enables ROM v1.2 to work although it is necessary to accept
* that frequent polling functionality is not feasible with this older ROM. With ROM v1.2 polling fetches 1492
* bytes which at 4800 Baud takes about 3.8 seconds during which the FT-990 has a CAT blackout. The longest poll
* interval available in WSJT-X is 99 seconds.
* interval available in WSJT-X is 99 seconds.
* Collaboration between M0EZP David Brewerton and K1MMI Edmund Hajjar
*/
@ -117,19 +117,23 @@ static int ft990v12_open(RIG *rig);
static int ft990v12_close(RIG *rig);
static int ft990v12_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
static int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
static int ft990v12_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
static int ft990v12_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
static int ft990v12_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t width);
static int ft990v12_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
static int ft990v12_set_vfo(RIG *rig, vfo_t vfo);
static int ft990v12_get_vfo(RIG *rig, vfo_t *vfo);
static int ft990v12_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
static int ft990v12_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
static int ft990v12_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft990v12_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift);
static int ft990v12_set_rptr_shift(RIG *rig, vfo_t vfo,
rptr_shift_t rptr_shift);
static int ft990v12_get_rptr_shift(RIG *rig, vfo_t vfo,
rptr_shift_t *rptr_shift);
static int ft990v12_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
static int ft990v12_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo);
vfo_t tx_vfo);
static int ft990v12_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo);
vfo_t *tx_vfo);
static int ft990v12_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft990v12_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
static int ft990v12_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
@ -137,29 +141,32 @@ static int ft990v12_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
static int ft990v12_set_parm(RIG *rig, setting_t parm, value_t val);
static int ft990v12_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit);
static int ft990v12_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit);
static int ft990v12_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ft990v12_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *val);
static int ft990v12_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
static int ft990v12_set_mem(RIG *rig, vfo_t vfo, int ch);
static int ft990v12_get_mem(RIG *rig, vfo_t vfo, int *ch);
static int ft990v12_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan);
static int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
int read_only);
int read_only);
/* Private helper function prototypes */
static int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch);
static int ft990v12_get_update_data(RIG *rig, unsigned char ci,
unsigned short ch);
static int ft990v12_send_static_cmd(RIG *rig, unsigned char ci);
static int ft990v12_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4);
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4);
static int ft990v12_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq);
static int ft990v12_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit);
static const yaesu_cmd_set_t ncmd[] =
{ /* ci */
{
/* ci */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* 00 00 Split (OFF) */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* 01 01 Split (On) */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* 02 02 Recall Memory */
@ -218,7 +225,7 @@ static const yaesu_cmd_set_t ncmd[] =
/*
* Private data
*/
// M0EZP: status 0=uni first call, 1=uni after first call
// M0EZP: status 0=uni first call, 1=uni after first call
int ft990uni_get_freq_state = 0;
struct ft990v12_priv_data
@ -242,7 +249,7 @@ struct ft990v12_priv_data
.flags = 1, \
}
// Old FT990 ROM has to read all 1492 to get frequency
// Old FT990 ROM has to read all 1492 to get frequency
// So for this model we just use the cache to read freq
const struct rig_caps ft990uni_caps =
{
@ -473,7 +480,8 @@ int ft990v12_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE,
"%s: read pacing = %i\n", __func__, priv->pacing);
err = ft990v12_send_dynamic_cmd(rig, FT990_NATIVE_PACING, priv->pacing, 0, 0, 0);
err = ft990v12_send_dynamic_cmd(rig, FT990_NATIVE_PACING, priv->pacing, 0, 0,
0);
if (err != RIG_OK)
{
@ -482,7 +490,7 @@ int ft990v12_open(RIG *rig)
// Get current rig settings and status
// err = ft990v12_get_update_data(rig, FT990_NATIVE_UPDATE_OP_DATA, 0);
// M0EZP read flags instead of update
// M0EZP read flags instead of update
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
if (err != RIG_OK)
@ -619,23 +627,26 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: ft990uni_get_freq_state = 0x%02x\n", __func__, ft990uni_get_freq_state);
rig_debug(RIG_DEBUG_TRACE, "%s: ft990uni_get_freq_state = 0x%02x\n", __func__,
ft990uni_get_freq_state);
if (ft990uni_get_freq_state < 2) {
// M0EZP: UNI first call needs UPDATE_ALL
if (ft990uni_get_freq_state < 2)
{
// M0EZP: UNI first call needs UPDATE_ALL
ft990uni_get_freq_state = ft990uni_get_freq_state + 1;
if (!rig)
{
return -RIG_EINVAL;
}
priv = (struct ft990v12_priv_data *)rig->state.priv;
if (vfo == RIG_VFO_CURR)
{
vfo = priv->current_vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: priv->current.vfo = 0x%02x\n",
__func__, vfo);
__func__, vfo);
}
switch (vfo)
@ -660,7 +671,7 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
default:
return -RIG_EINVAL;
}
ci = FT990_NATIVE_UPDATE_ALL_DATA; /* M0EZP: inserted to override CI */
err = ft990v12_get_update_data(rig, ci, 0);
@ -673,9 +684,9 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
f = ((((p[0] << 8) + p[1]) << 8) + p[2]) * 10;
rig_debug(RIG_DEBUG_TRACE, "%s: p0=0x%02x p1=0x%02x p2=0x%02x\n",
__func__, p[0], p[1], p[2]);
__func__, p[0], p[1], p[2]);
rig_debug(RIG_DEBUG_TRACE,
"%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo);
"%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo);
// Frequency sanity check
if (f < 100000 || f > 30000000)
@ -686,11 +697,13 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*freq = f;
return RIG_OK;
} else {
// M0EZP: Uni use cache
}
else
{
// M0EZP: Uni use cache
// *freq = vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB;
return (RIG_OK);
}
return (RIG_OK);
}
}
/*
@ -1088,7 +1101,7 @@ int ft990v12_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
__func__, bcd[0], bcd[1], bcd[2]);
err = ft990v12_send_dynamic_cmd(rig, FT990_NATIVE_RPTR_OFFSET, 0,
bcd[2], bcd[1], bcd[0]);
bcd[2], bcd[1], bcd[0]);
if (err != RIG_OK)
{
@ -1861,7 +1874,7 @@ int ft990v12_set_parm(RIG *rig, setting_t parm, value_t val)
{
case RIG_PARM_BACKLIGHT:
err = ft990v12_send_dynamic_cmd(rig, FT990_NATIVE_DIM_LEVEL,
(unsigned char)(0x0d * val.f), 0, 0, 0);
(unsigned char)(0x0d * val.f), 0, 0, 0);
break;
default:
@ -2282,7 +2295,7 @@ int ft990v12_set_vfo(RIG *rig, vfo_t vfo)
if (vfo == RIG_VFO_MEM)
{
err = ft990v12_send_dynamic_cmd(rig, ci,
priv->update_data.channelnumber + 1, 0, 0, 0);
priv->update_data.channelnumber + 1, 0, 0, 0);
rig_debug(RIG_DEBUG_TRACE, "%s: set mem channel = 0x%02x\n",
__func__, priv->update_data.channelnumber + 1);
@ -2334,8 +2347,8 @@ int ft990v12_get_vfo(RIG *rig, vfo_t *vfo)
priv = (struct ft990v12_priv_data *)rig->state.priv;
/* Get flags for VFO status
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
/* Get flags for VFO status
err = ft990v12_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0);
if (err != RIG_OK)
{
@ -2590,7 +2603,7 @@ int ft990v12_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
if (op == RIG_OP_TO_VFO || op == RIG_OP_FROM_VFO)
err = ft990v12_send_dynamic_cmd(rig, ci,
priv->update_data.channelnumber + 1, 0, 0, 0);
priv->update_data.channelnumber + 1, 0, 0, 0);
else
{
err = ft990v12_send_static_cmd(rig, ci);
@ -3031,7 +3044,8 @@ int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
if (chan->split & RIG_SPLIT_ON)
{
// Get data for the transmit VFO
p = (ft990v12_op_data_t *) &priv->update_data.current_front; /* M0EZP: was current_rear */
p = (ft990v12_op_data_t *)
&priv->update_data.current_front; /* M0EZP: was current_rear */
/* FT1000D
@ -3267,95 +3281,77 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
priv = (struct ft990v12_priv_data *)rig->state.priv;
switch (ci)
{
case FT990_NATIVE_UPDATE_ALL_DATA:
case FT990_NATIVE_UPDATE_MEM_CHNL:
case FT990_NATIVE_UPDATE_OP_DATA:
case FT990_NATIVE_UPDATE_VFO_DATA:
case FT990_NATIVE_UPDATE_MEM_CHNL_DATA:
if (ft990uni_get_freq_state < 2)
{
case FT990_NATIVE_UPDATE_ALL_DATA:
case FT990_NATIVE_UPDATE_MEM_CHNL:
case FT990_NATIVE_UPDATE_OP_DATA:
case FT990_NATIVE_UPDATE_VFO_DATA:
case FT990_NATIVE_UPDATE_MEM_CHNL_DATA:
if (ft990uni_get_freq_state < 2) {
//
if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA)
// P4 = 0x01 to 0x5a for channel 1 - 90
{
/* err = ft990v12_send_dynamic_cmd(rig, ci, 4, 0, 0, ch);
M0EZP: dont send command, rely on the assignment from memory below*/
} else {
// err = RIG_OK; K1MMI
err = ft990v12_send_static_cmd(rig, ci); // K1MMI: only send for ALL DATA 1492 bytes or READ FLAGS 5 bytes
}
if (err != RIG_OK)
{
return err;
}
switch (ci)
{
case FT990_NATIVE_UPDATE_ALL_DATA:
rl = FT990_ALL_DATA_LENGTH; // K1MMI: prepare to receive 1492 bytes back
p = (unsigned char *)&priv->update_data; // K1MMI: This seems like 1492 will be saved here
n = read_block(&rig->state.rigport, p, rl); /* M0EZP: copied here from below */
return RIG_OK;
break;
case FT990_NATIVE_UPDATE_MEM_CHNL:
// we already have the channelnumber in the previously saved 1492 bytes
p = (unsigned char *) &priv->update_data.channelnumber;
rl = FT990_MEM_CHNL_LENGTH; // 1
break;
case FT990_NATIVE_UPDATE_OP_DATA:
// we already have the current OP and VFOA in the 1492 bytes
p = (unsigned char *) &priv->update_data.current_front;
rl = FT990_OP_DATA_LENGTH; // 32
break;
case FT990_NATIVE_UPDATE_VFO_DATA:
// we already have the VFOA and VFOB in the 1492 bytes
p = (unsigned char *) &priv->update_data.vfoa;
rl = FT990_VFO_DATA_LENGTH; // 32
break;
case FT990_NATIVE_UPDATE_MEM_CHNL_DATA:
// we already have the 16 structure for the memory channel number
p = (unsigned char *) &priv->update_data.channel[ch];
rl = FT990_MEM_CHNL_DATA_LENGTH; // 16
break;
default:
// M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__, ci); // M0EZP
return -RIG_EINVAL;
}
ft990uni_get_freq_state = ft990uni_get_freq_state + 1;
if (n < 0)
{
return n; /* die returning read_block error */
}
rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n);
memcpy(&priv->update_data, p, FT990_ALL_DATA_LENGTH);
return RIG_OK;
} else {
return RIG_OK;
//
if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA)
// P4 = 0x01 to 0x5a for channel 1 - 90
{
/* err = ft990v12_send_dynamic_cmd(rig, ci, 4, 0, 0, ch);
M0EZP: dont send command, rely on the assignment from memory below*/
}
else
{
// err = RIG_OK; K1MMI
err = ft990v12_send_static_cmd(rig,
ci); // K1MMI: only send for ALL DATA 1492 bytes or READ FLAGS 5 bytes
}
case FT990_NATIVE_READ_FLAGS:
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci 0x%02x\n", __func__, ci);
err = ft990v12_send_static_cmd(rig, ci); // K1MMI: only send for ALL DATA 1492 bytes
if (err != RIG_OK)
{
return err;
}
p = (unsigned char *)&priv->update_data;
rl = FT990_STATUS_FLAGS_LENGTH; // 5
n = read_block(&rig->state.rigport, (unsigned char*)&temp, rl); /* M0EZP: copied here from below */
switch (ci)
{
case FT990_NATIVE_UPDATE_ALL_DATA:
rl = FT990_ALL_DATA_LENGTH; // K1MMI: prepare to receive 1492 bytes back
p = (unsigned char *)
&priv->update_data; // K1MMI: This seems like 1492 will be saved here
n = read_block(&rig->state.rigport, p, rl); /* M0EZP: copied here from below */
return RIG_OK;
break;
case FT990_NATIVE_UPDATE_MEM_CHNL:
// we already have the channelnumber in the previously saved 1492 bytes
p = (unsigned char *) &priv->update_data.channelnumber;
rl = FT990_MEM_CHNL_LENGTH; // 1
break;
case FT990_NATIVE_UPDATE_OP_DATA:
// we already have the current OP and VFOA in the 1492 bytes
p = (unsigned char *) &priv->update_data.current_front;
rl = FT990_OP_DATA_LENGTH; // 32
break;
case FT990_NATIVE_UPDATE_VFO_DATA:
// we already have the VFOA and VFOB in the 1492 bytes
p = (unsigned char *) &priv->update_data.vfoa;
rl = FT990_VFO_DATA_LENGTH; // 32
break;
case FT990_NATIVE_UPDATE_MEM_CHNL_DATA:
// we already have the 16 structure for the memory channel number
p = (unsigned char *) &priv->update_data.channel[ch];
rl = FT990_MEM_CHNL_DATA_LENGTH; // 16
break;
default:
// M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__,
ci); // M0EZP
return -RIG_EINVAL;
}
ft990uni_get_freq_state = ft990uni_get_freq_state + 1;
if (n < 0)
{
@ -3364,17 +3360,50 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n);
memcpy(&priv->update_data, p, FT990_STATUS_FLAGS_LENGTH - 2); /* just overwrite first 3 bytes */
memcpy(&priv->update_data, p, FT990_ALL_DATA_LENGTH);
return RIG_OK;
break;
default:
// M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__, ci); // M0EZP
return -RIG_EINVAL;
}
else
{
return RIG_OK;
}
case FT990_NATIVE_READ_FLAGS:
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci 0x%02x\n", __func__, ci);
err = ft990v12_send_static_cmd(rig,
ci); // K1MMI: only send for ALL DATA 1492 bytes
if (err != RIG_OK)
{
return err;
}
p = (unsigned char *)&priv->update_data;
rl = FT990_STATUS_FLAGS_LENGTH; // 5
n = read_block(&rig->state.rigport, (unsigned char *)&temp,
rl); /* M0EZP: copied here from below */
if (n < 0)
{
return n; /* die returning read_block error */
}
rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n);
memcpy(&priv->update_data, p,
FT990_STATUS_FLAGS_LENGTH - 2); /* just overwrite first 3 bytes */
return RIG_OK;
break;
default:
// M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__,
ci); // M0EZP
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
@ -3430,8 +3459,8 @@ int ft990v12_send_static_cmd(RIG *rig, unsigned char ci)
* otherwise returns error from called functiion
*/
int ft990v12_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct ft990v12_priv_data *priv;
int err;

Wyświetl plik

@ -414,7 +414,8 @@ ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (rig->state.cache.freqMainB == tx_freq)
{
rig_debug(RIG_DEBUG_TRACE, "%s: freq %.0f already set on VFOB\n", __func__, tx_freq);
rig_debug(RIG_DEBUG_TRACE, "%s: freq %.0f already set on VFOB\n", __func__,
tx_freq);
return RIG_OK;
}
@ -590,7 +591,8 @@ static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
if (rig->state.cache.modeMainB == tx_mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s already set on VFOB\n", __func__, rig_strrmode(tx_mode));
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s already set on VFOB\n", __func__,
rig_strrmode(tx_mode));
return RIG_OK;
}

Wyświetl plik

@ -601,9 +601,11 @@ int newcat_open(RIG *rig)
int err;
// set the CAT TIME OUT TIMER to 100ms
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0331");
if (RIG_OK != (err = newcat_set_cmd(rig)))
{
rig_debug(RIG_DEBUG_ERR, "%s: FTDX5000 CAT RATE error: %s\n", __func__, rigerror(err));
rig_debug(RIG_DEBUG_ERR, "%s: FTDX5000 CAT RATE error: %s\n", __func__,
rigerror(err));
}
}
@ -750,9 +752,11 @@ int newcat_60m_exception(RIG *rig, freq_t freq)
// can we improve this to set memory mode and pick the memory slot?
if (is_ftdx10 && freq > 5.2 && freq < 5.5)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", __func__);
rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n",
__func__);
return 1;
}
return 0;
}
@ -767,7 +771,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
ENTERFUNC;
if (newcat_60m_exception(rig,freq)) RETURNFUNC(RIG_OK); // we don't set freq in this case
if (newcat_60m_exception(rig, freq)) { RETURNFUNC(RIG_OK); } // we don't set freq in this case
if (!newcat_valid_command(rig, "FA"))
{
@ -1286,7 +1290,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ENTERFUNC;
if (newcat_60m_exception(rig,rig->state.cache.freqMainA)) RETURNFUNC(RIG_OK); // we don't set mode in this case
if (newcat_60m_exception(rig, rig->state.cache.freqMainA)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case
if (!newcat_valid_command(rig, "MD"))
{
@ -1340,10 +1344,15 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
RETURNFUNC(err);
}
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = mode;
{
rig->state.cache.modeMainA = mode;
}
else
rig->state.cache.modeMainB = mode;
{
rig->state.cache.modeMainB = mode;
}
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(err); }
@ -1701,11 +1710,13 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
err = newcat_set_cmd(rig);
break;
case RIG_PTT_ON_DATA:
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX1031;");
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
err = newcat_set_cmd(rig);
break;
case RIG_PTT_ON:
/* Build the command string */
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", txon);
@ -2378,7 +2389,8 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tmp_width;
int err;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, tx_mode=%s, tx_width=%d\n", __func__, rig_strvfo(vfo), rig_strrmode(tx_mode), (int)tx_width);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, tx_mode=%s, tx_width=%d\n", __func__,
rig_strvfo(vfo), rig_strrmode(tx_mode), (int)tx_width);
err = newcat_get_mode(rig, RIG_VFO_B, &tmp_mode, &tmp_width);
if (err < 0)
@ -2398,10 +2410,15 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
{
RETURNFUNC(err);
}
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = tx_mode;
{
rig->state.cache.modeMainA = tx_mode;
}
else
rig->state.cache.modeMainB = tx_mode;
{
rig->state.cache.modeMainB = tx_mode;
}
RETURNFUNC(-RIG_ENAVAIL);

Wyświetl plik

@ -147,7 +147,8 @@ ars_init(ROT *rot)
return -RIG_EINVAL;
}
rot->state.priv = (struct ars_priv_data *)calloc(1,sizeof(struct ars_priv_data));
rot->state.priv = (struct ars_priv_data *)calloc(1,
sizeof(struct ars_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -118,7 +118,7 @@ static int hd1780_rot_init(ROT *rot)
}
rot->state.priv = (struct hd1780_rot_priv_data *)
calloc(1,sizeof(struct hd1780_rot_priv_data));
calloc(1, sizeof(struct hd1780_rot_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -364,7 +364,7 @@ static int rotorez_rot_init(ROT *rot)
}
rot->state.priv = (struct rotorez_rot_priv_data *)
calloc(1,sizeof(struct rotorez_rot_priv_data));
calloc(1, sizeof(struct rotorez_rot_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -55,7 +55,7 @@ static int spid_rot_init(ROT *rot)
{
struct spid_rot2prog_priv_data *priv;
priv = (struct spid_rot2prog_priv_data *)calloc(1,sizeof(struct
priv = (struct spid_rot2prog_priv_data *)calloc(1, sizeof(struct
spid_rot2prog_priv_data));
if (!priv)

Wyświetl plik

@ -51,7 +51,7 @@ static int ts7400_rot_init(ROT *rot)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct ts7400_rot_priv_data *)
calloc(1,sizeof(struct ts7400_rot_priv_data));
calloc(1, sizeof(struct ts7400_rot_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -2,7 +2,7 @@
char *make_digest(const unsigned char *digest, int len) /* {{{ */
{
char *md5str = (char *) calloc(1,sizeof(char) * (len * 2 + 1));
char *md5str = (char *) calloc(1, sizeof(char) * (len * 2 + 1));
static const char hexits[17] = "0123456789abcdef";
int i;

Wyświetl plik

@ -108,6 +108,7 @@ int main(int argc, char *argv[])
buf[0] = 0;
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
// else { return 0; }
if (strcmp(buf, "RM5;") == 0)
@ -137,7 +138,7 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
usleep(50 * 1000);
pbuf = "IF000503130001000+0000000000030000000;";
sprintf(ifbuf,"IF%011d0001000+0000000000030000000;",freqa);
sprintf(ifbuf, "IF%011d0001000+0000000000030000000;", freqa);
//pbuf = "IF00010138698 +00000000002000000 ;
n = write(fd, ifbuf, strlen(pbuf));
// printf("n=%d\n", n);

Wyświetl plik

@ -152,7 +152,7 @@ int HAMLIB_API amp_register(const struct amp_caps *caps)
#endif
p = (struct amp_list *)calloc(1,sizeof(struct amp_list));
p = (struct amp_list *)calloc(1, sizeof(struct amp_list));
if (!p)
{

Wyświetl plik

@ -87,7 +87,7 @@ static struct opened_amp_l *opened_amp_list = { NULL };
static int add_opened_amp(AMP *amp)
{
struct opened_amp_l *p;
p = (struct opened_amp_l *)calloc(1,sizeof(struct opened_amp_l));
p = (struct opened_amp_l *)calloc(1, sizeof(struct opened_amp_l));
if (!p)
{

Wyświetl plik

@ -46,7 +46,8 @@ int rig_set_cache_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (vfo == RIG_VFO_NONE || vfo == RIG_VFO_CURR) { vfo = RIG_VFO_A; }
if (vfo == RIG_VFO_SUB && rig->state.cache.satmode) { vfo = RIG_VFO_SUB_A; };
if (vfo == RIG_VFO_OTHER) vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
if (vfo == RIG_VFO_OTHER) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
switch (vfo)
{

Wyświetl plik

@ -253,7 +253,7 @@ static int generic_retr_extl(RIG *rig,
if (chan->ext_levels == NULL)
{
p = chan->ext_levels = calloc(1,2 * sizeof(struct ext_list));
p = chan->ext_levels = calloc(1, 2 * sizeof(struct ext_list));
}
else
{

Wyświetl plik

@ -2094,6 +2094,7 @@ int HAMLIB_API rig_flush(hamlib_port_t *port)
{
return RIG_OK;
}
if (port->type.rig == RIG_PORT_NETWORK
|| port->type.rig == RIG_PORT_UDP_NETWORK)
{

Wyświetl plik

@ -976,7 +976,8 @@ int network_multicast_publisher_start(RIG *rig, const char *multicast_addr,
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):multicast address=%s, port=%d\n", __FILE__, __LINE__,
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):multicast address=%s, port=%d\n", __FILE__,
__LINE__,
multicast_addr, multicast_port);
if (strcmp(multicast_addr, "0.0.0.0") == 0)

Wyświetl plik

@ -205,7 +205,7 @@ int HAMLIB_API rig_register(const struct rig_caps *caps)
caps->rig_model);
#endif
p = (struct rig_list *)calloc(1,sizeof(struct rig_list));
p = (struct rig_list *)calloc(1, sizeof(struct rig_list));
if (!p)
{
@ -305,12 +305,14 @@ int HAMLIB_API rig_check_backend(rig_model_t rig_model)
}
#if 0 // this stopped a 2nd rig_init call with a valid model to fail -- reversing
if (n > 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig model %u not found and rig count=%d\n",
__func__, rig_model, n);
return -RIG_ENAVAIL;
}
#endif
be_idx = rig_lookup_backend(rig_model);

Wyświetl plik

@ -240,7 +240,7 @@ static int add_opened_rig(RIG *rig)
{
struct opened_rig_l *p;
p = (struct opened_rig_l *)calloc(1,sizeof(struct opened_rig_l));
p = (struct opened_rig_l *)calloc(1, sizeof(struct opened_rig_l));
if (!p)
{
@ -850,7 +850,7 @@ int HAMLIB_API rig_open(RIG *rig)
rig_settings_load_all(NULL); // load default .hamlib_settings
// Read in our settings
char *cwd = calloc(1,4096);
char *cwd = calloc(1, 4096);
if (getcwd(cwd, 4096) == NULL)
{
@ -859,11 +859,12 @@ int HAMLIB_API rig_open(RIG *rig)
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: cwd=%s\n", __func__, cwd);
char *path = calloc(1,4096);
char *path = calloc(1, 4096);
extern char *settings_file;
char *xdgpath = getenv("XDG_CONFIG_HOME");
settings_file = "hamlib_settings";
if (xdgpath)
{
sprintf(path, "%s/%s/%s", xdgpath, cwd, settings_file);
@ -1243,6 +1244,7 @@ int HAMLIB_API rig_open(RIG *rig)
*/
int retry_save = rs->rigport.retry;
rs->rigport.retry = 1;
if (caps->rig_open != NULL)
{
status = caps->rig_open(rig);
@ -1317,26 +1319,30 @@ int HAMLIB_API rig_open(RIG *rig)
// freq_t freq;
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_A, &freq);
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_B, &freq);
// prime the freq and mode settings
// don't care about the return here -- if it doesn't work so be it
freq_t freq;
if (rig->caps->get_freq)
{
int retval = rig_get_freq(rig, RIG_VFO_A, &freq);
if (retval == RIG_OK && rig->caps->rig_model != RIG_MODEL_F6K)
{
vfo_t tx_vfo;
split_t split;
rig_get_freq(rig, RIG_VFO_B, &freq);
rig_get_split_vfo(rig, RIG_VFO_RX, &tx_vfo, &split);
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Current split=%d, tx_vfo=%s\n", __func__, __LINE__, split, rig_strvfo(tx_vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Current split=%d, tx_vfo=%s\n", __func__,
__LINE__, split, rig_strvfo(tx_vfo));
rmode_t mode;
pbwidth_t width;
rig_get_mode(rig, RIG_VFO_A, &mode, &width);
rig_get_mode(rig, RIG_VFO_B, &mode, &width);
}
}
rs->rigport.retry = retry_save;
memcpy(&rs->rigport_deprecated, &rs->rigport, sizeof(hamlib_port_t_deprecated));
@ -2198,7 +2204,8 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
rig_get_lock_mode(rig, &locked_mode);
if (locked_mode) { return(RIG_OK); }
if (locked_mode) { return (RIG_OK); }
// do not mess with mode while PTT is on
if (rig->state.cache.ptt)
@ -2256,7 +2263,8 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
curr_vfo = rig->state.current_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): curr_vfo=%s, vfo=%s\n", __func__, __LINE__, rig_strvfo(curr_vfo), rig_strvfo(vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): curr_vfo=%s, vfo=%s\n", __func__,
__LINE__, rig_strvfo(curr_vfo), rig_strvfo(vfo));
HAMLIB_TRACE;
retcode = caps->set_vfo(rig, vfo);
@ -2656,7 +2664,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
if (retcode != RIG_OK)
{
rig_debug(RIG_DEBUG_WARN, "%s: rig_get_vfo error=%s\n", __func__,
rigerror(retcode));
rigerror(retcode));
}
if (curr_vfo == vfo) { RETURNFUNC(RIG_OK); }
@ -4184,14 +4192,18 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
// we check both VFOs are in the same tx mode -- then we can ignore
// this could be make more intelligent but this should cover all cases where we can skip this
if (tx_mode == rig->state.cache.modeMainA && tx_mode == rig->state.cache.modeMainB)
if (tx_mode == rig->state.cache.modeMainA
&& tx_mode == rig->state.cache.modeMainB)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode already %s so no change required\n", __func__, rig_strrmode(tx_mode));
rig_debug(RIG_DEBUG_TRACE, "%s: mode already %s so no change required\n",
__func__, rig_strrmode(tx_mode));
RETURNFUNC(RIG_OK);
}
else
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s is different from A=%s and B=%s\n", __func__, rig_strrmode(tx_mode), rig_strrmode(rig->state.cache.modeMainA), rig_strrmode(rig->state.cache.modeMainB));
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s is different from A=%s and B=%s\n",
__func__, rig_strrmode(tx_mode), rig_strrmode(rig->state.cache.modeMainA),
rig_strrmode(rig->state.cache.modeMainB));
}
// do not mess with mode while PTT is on
@ -4347,9 +4359,13 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
rig_set_split_vfo(rig, rx_vfo, RIG_SPLIT_ON, tx_vfo);
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = tx_mode;
{
rig->state.cache.modeMainA = tx_mode;
}
else
rig->state.cache.modeMainB = tx_mode;
{
rig->state.cache.modeMainB = tx_mode;
}
ELAPSED2;

Wyświetl plik

@ -204,7 +204,7 @@ int HAMLIB_API rot_register(const struct rot_caps *caps)
#endif
p = (struct rot_list *)calloc(1,sizeof(struct rot_list));
p = (struct rot_list *)calloc(1, sizeof(struct rot_list));
if (!p)
{

Wyświetl plik

@ -108,7 +108,7 @@ static struct opened_rot_l *opened_rot_list = { NULL };
static int add_opened_rot(ROT *rot)
{
struct opened_rot_l *p;
p = (struct opened_rot_l *)calloc(1,sizeof(struct opened_rot_l));
p = (struct opened_rot_l *)calloc(1, sizeof(struct opened_rot_l));
if (!p)
{

Wyświetl plik

@ -618,7 +618,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
#endif
// Store a copy of the original options for this FD, to be restored on close.
term_backup = calloc(1,sizeof(term_options_backup_t));
term_backup = calloc(1, sizeof(term_options_backup_t));
term_backup-> fd = fd;
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
memcpy(&term_backup->options, &orig_options, sizeof(orig_options));

Wyświetl plik

@ -1002,23 +1002,25 @@ HAMLIB_EXPORT(int) rig_settings_get_path(char *path, int pathlen)
char *xdgpath = getenv("XDG_CONFIG_HOME");
char *home = getenv("HOME");
snprintf(path, pathlen, "%s/.config", home);
if (xdgpath)
{
snprintf(path, pathlen-1, "%s/%s/%s", xdgpath, cwd, HAMLIB_SETTINGS_FILE);
snprintf(path, pathlen - 1, "%s/%s/%s", xdgpath, cwd, HAMLIB_SETTINGS_FILE);
}
else if (home && access(path, F_OK) != -1)
{
snprintf(path, pathlen-1, "%s/.config/%s", home, HAMLIB_SETTINGS_FILE);
snprintf(path, pathlen - 1, "%s/.config/%s", home, HAMLIB_SETTINGS_FILE);
}
else if (home)
{
// we add a leading period to hide the file
snprintf(path, pathlen-1, "%s/.%s", home, HAMLIB_SETTINGS_FILE);
snprintf(path, pathlen - 1, "%s/.%s", home, HAMLIB_SETTINGS_FILE);
}
else
{
snprintf(path, pathlen-1, ".%s", HAMLIB_SETTINGS_FILE);
snprintf(path, pathlen - 1, ".%s", HAMLIB_SETTINGS_FILE);
}
rig_debug(RIG_DEBUG_TRACE, "%s: path=%s\n", __func__, path);
return RIG_OK;
}
@ -1040,19 +1042,22 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
char buf[4096];
char *cvalue = (char *)value;
int *ivalue = (int *)value;
int n=0;
int n = 0;
long *lvalue = (long *) value;
float *fvalue = (float *) value;
double *dvalue = (double *) value;
char *vformat = "Unknown format??";
char template[64];
rig_settings_get_path(path,sizeof(path));
rig_settings_get_path(path, sizeof(path));
fp = fopen(path, "r");
if (fp == NULL) {
if (fp == NULL)
{
rig_debug(RIG_DEBUG_WARN, "%s: %s not found\n", __func__, path);
return -RIG_EIO;
}
strcpy(template, "hamlib_settings_XXXXXX");
switch (valuetype)
@ -1112,7 +1117,9 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
{
char *tmp = strdup(buf);
char *s = strtok(tmp, "=");
if (buf[0] == '#') {
if (buf[0] == '#')
{
fprintf(fptmp, "%s\n", buf);
continue;
}
@ -1125,6 +1132,7 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
fclose(fptmp);
return -RIG_EINTERNAL;
}
++n;
char *v = strtok(NULL, "\r\n");
@ -1137,6 +1145,7 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
fclose(fptmp);
return -RIG_EINTERNAL;
}
rig_debug(RIG_DEBUG_TRACE, "%s: parsing setting %s=%s\n", __func__, s, v);
fprintf(fptmp, vformat, s, value);
}
@ -1161,18 +1170,21 @@ HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file)
char buf[4096];
char settingstmp[4096];
if (settings_file == NULL) {
if (settings_file == NULL)
{
rig_settings_get_path(settingstmp, sizeof(settingstmp));
settings_file = settingstmp;
}
fp = fopen(settings_file, "r");
if (fp == NULL)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: settings_file (%s): %s\n", __func__,
settings_file, strerror(errno));
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_TRACE, "%s: opened %s\n", __func__, settings_file);
while (fgets(buf, sizeof(buf), fp))

Wyświetl plik

@ -232,7 +232,7 @@ void hash_add_model(int id,
{
struct mod_lst *s;
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
s = (struct mod_lst *)calloc(1, sizeof(struct mod_lst));
s->id = id;
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
@ -1692,7 +1692,7 @@ declare_proto_amp(set_level)
}
fputc('\n', fout);
return(RIG_OK);
return (RIG_OK);
}
level = rig_parse_level(arg1);
@ -1710,7 +1710,7 @@ declare_proto_amp(set_level)
if (!cfp)
{
return(-RIG_ENAVAIL); /* no such parameter */
return (-RIG_ENAVAIL); /* no such parameter */
}
switch (cfp->type)
@ -1734,10 +1734,10 @@ declare_proto_amp(set_level)
break;
default:
return(-RIG_ECONF);
return (-RIG_ECONF);
}
return(amp_set_ext_level(amp, cfp->token, val));
return (amp_set_ext_level(amp, cfp->token, val));
}
if (RIG_LEVEL_IS_FLOAT(level))
@ -1749,7 +1749,7 @@ declare_proto_amp(set_level)
CHKSCN1ARG(sscanf(arg2, "%d", &val.i));
}
return(amp_set_level(amp, level, val));
return (amp_set_level(amp, level, val));
}
/* 'l' */

Wyświetl plik

@ -540,7 +540,7 @@ int main(int argc, char *argv[])
*/
do
{
arg = calloc(1,sizeof(struct handle_data));
arg = calloc(1, sizeof(struct handle_data));
if (!arg)
{

Wyświetl plik

@ -426,7 +426,7 @@ void hash_add_model(int id,
{
struct mod_lst *s;
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
s = (struct mod_lst *)calloc(1, sizeof(struct mod_lst));
s->id = id;
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
@ -1725,40 +1725,46 @@ readline_repeat:
}
else
{
{
if ((rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_powerstat is not on = %d\n", __func__, rig_powerstat);
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_powerstat is not on = %d\n", __func__,
rig_powerstat);
// Update power status
powerstat_t stat = RIG_POWER_ON;
retcode = rig_get_powerstat(my_rig, &stat);
if (retcode == RIG_OK) rig_powerstat = stat;
if (retcode == RIG_OK) { rig_powerstat = stat; }
}
// only command allows when powered off is 0x87=set_powerstat
if (retcode == RIG_OK && (rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY)
&& cmd_entry->cmd != 0x01 // dump_caps
&& cmd_entry->cmd != 0xf0 // chk_vfo
&& cmd_entry->cmd != 0x87) // set_powerstat
if (retcode == RIG_OK && (rig_powerstat == RIG_POWER_OFF
|| rig_powerstat == RIG_POWER_STANDBY)
&& cmd_entry->cmd != 0x01 // dump_caps
&& cmd_entry->cmd != 0xf0 // chk_vfo
&& cmd_entry->cmd != 0x87) // set_powerstat
{
//rig_debug(RIG_DEBUG_WARN, "%s: %s - only \\set_powerstat can be run \n", __func__, rigerror(-RIG_EPOWER));
rig_debug(RIG_DEBUG_WARN, "%s: only \\set_powerstat can be run when rig powered off\n", __func__);
rig_debug(RIG_DEBUG_WARN,
"%s: only \\set_powerstat can be run when rig powered off\n", __func__);
retcode = -RIG_EPOWER;
}
else {
retcode = (*cmd_entry->rig_routine)(my_rig,
fout,
fin,
interactive,
prompt,
vfo_opt,
send_cmd_term,
*ext_resp_ptr,
*resp_sep_ptr,
cmd_entry,
vfo,
p1,
p2 ? p2 : "",
p3 ? p3 : "");
else
{
retcode = (*cmd_entry->rig_routine)(my_rig,
fout,
fin,
interactive,
prompt,
vfo_opt,
send_cmd_term,
*ext_resp_ptr,
*resp_sep_ptr,
cmd_entry,
vfo,
p1,
p2 ? p2 : "",
p3 ? p3 : "");
}
}
@ -2259,12 +2265,16 @@ declare_proto_rig(set_vfo)
}
vfo = rig_parse_vfo(arg1);
if (vfo == RIG_VFO_NONE)
if (vfo == RIG_VFO_NONE)
{
int c;
while((c = fgetc(fin)) != '\n' && c != '\r' && c > 0);
while ((c = fgetc(fin)) != '\n' && c != '\r' && c > 0);
return -RIG_EINVAL;
}
retval = rig_set_vfo(rig, vfo);
#if 0 // see if we can make this dynamic
@ -4682,7 +4692,7 @@ declare_proto_rig(set_powerstat)
retval = rig_set_powerstat(rig, (powerstat_t) stat);
rig->state.powerstat = stat;
rig_powerstat = stat; // update our global so others can see powerstat
rig_powerstat = stat; // update our global so others can see powerstat
fflush(fin);
RETURNFUNC(retval);
}

Wyświetl plik

@ -974,7 +974,9 @@ int main(int argc, char *argv[])
/*
* main loop accepting connections
*/
rig_debug(RIG_DEBUG_TRACE, "%s: rigctld listening on port %s\n", __func__, portno);
rig_debug(RIG_DEBUG_TRACE, "%s: rigctld listening on port %s\n", __func__,
portno);
do
{
fd_set set;
@ -1239,12 +1241,15 @@ void *handle_socket(void *arg)
handle_data_arg->use_password);
if (retcode != 0) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rigctl_parse retcode=%d\n", __func__, retcode); }
// update our power stat in case power gets turned off
if (retcode == -RIG_ETIMEOUT && my_rig->caps->get_powerstat) // if we get a timeout we might be powered off
if (retcode == -RIG_ETIMEOUT
&& my_rig->caps->get_powerstat) // if we get a timeout we might be powered off
{
rig_get_powerstat(my_rig, &powerstat);
rig_powerstat = powerstat;
if (powerstat == RIG_POWER_OFF) retcode = -RIG_EPOWER;
if (powerstat == RIG_POWER_OFF) { retcode = -RIG_EPOWER; }
}
}
else

Wyświetl plik

@ -291,7 +291,7 @@ void hash_add_model(int id,
{
struct mod_lst *s;
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
s = (struct mod_lst *)calloc(1, sizeof(struct mod_lst));
s->id = id;
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);

Wyświetl plik

@ -570,7 +570,7 @@ int main(int argc, char *argv[])
*/
do
{
arg = calloc(1,sizeof(struct handle_data));
arg = calloc(1, sizeof(struct handle_data));
if (!arg)
{