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 *) 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) if (!amp->state.priv)
{ {

Wyświetl plik

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

Wyświetl plik

@ -62,7 +62,7 @@ char *getlibpath(void)
if (!c) { continue; } if (!c) { continue; }
libpath = calloc(1,strlen(c) + 1); libpath = calloc(1, strlen(c) + 1);
strcpy(libpath, c); strcpy(libpath, c);
break; break;
} }
@ -115,7 +115,7 @@ lt_dlhandle adlopen(const char *filename)
if (libpath == NULL || filename == NULL) { return NULL; } 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); ASUFFIX) + 1);
strcpy(c, libpath); strcpy(c, libpath);
strcat(c, APREFIX); 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 */ /* work around MSVC error C2322: '...' address of dllimport '...' is not static */
static void *CJSON_CDECL internal_malloc(size_t size) 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) 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; return -1;
} }
p = calloc(1,sizeof(struct addrinfo)); p = calloc(1, sizeof(struct addrinfo));
if (!p) if (!p)
{ {
@ -108,7 +108,7 @@ int getaddrinfo(const char *node, const char *service,
p->ai_socktype = ai_socktype; p->ai_socktype = ai_socktype;
p->ai_protocol = ai_protocol; p->ai_protocol = ai_protocol;
p->ai_addrlen = sizeof(struct sockaddr_in); 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) if (!p->ai_addr)
{ {

Wyświetl plik

@ -223,7 +223,7 @@ exchange(argv)
char **argv; char **argv;
{ {
int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char *); 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. */ /* 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"); ENTER("add_port");
port = calloc(1,sizeof(struct termios_list)); port = calloc(1, sizeof(struct termios_list));
if (!port) if (!port)
{ {
@ -1217,7 +1217,7 @@ static struct termios_list *add_port(const char *filename)
memset(port, 0, sizeof(struct termios_list)); memset(port, 0, sizeof(struct termios_list));
port->ttyset = calloc(1,sizeof(struct termios)); port->ttyset = calloc(1, sizeof(struct termios));
if (! port->ttyset) if (! port->ttyset)
{ {
@ -1226,7 +1226,7 @@ static struct termios_list *add_port(const char *filename)
memset(port->ttyset, 0, sizeof(struct termios)); 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) if (! port->sstruct)
{ {
@ -1234,7 +1234,7 @@ static struct termios_list *add_port(const char *filename)
} }
memset(port->sstruct, 0, sizeof(struct serial_struct)); 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) if (! port->sis)
{ {
@ -3407,7 +3407,7 @@ int win32_serial_ioctl(int fd, int request, ...)
case TIOCGSERIAL: case TIOCGSERIAL:
report("TIOCGSERIAL\n"); report("TIOCGSERIAL\n");
dcb = calloc(1,sizeof(DCB)); dcb = calloc(1, sizeof(DCB));
if (!dcb) if (!dcb)
{ {
@ -3438,7 +3438,7 @@ int win32_serial_ioctl(int fd, int request, ...)
case TIOCSSERIAL: case TIOCSSERIAL:
report("TIOCSSERIAL\n"); report("TIOCSSERIAL\n");
dcb = calloc(1,sizeof(DCB)); dcb = calloc(1, sizeof(DCB));
if (!dcb) if (!dcb)
{ {

Wyświetl plik

@ -282,7 +282,7 @@ int ar3030_init(RIG *rig)
{ {
struct ar3030_priv_data *priv; 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) 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ar7030p_priv_data *) priv = (struct ar7030p_priv_data *)
calloc(1,sizeof(struct ar7030p_priv_data)); calloc(1, sizeof(struct ar7030p_priv_data));
if (!priv) 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) int drake_init(RIG *rig)
{ {
struct drake_priv_data *priv; 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) 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
amp->state.priv = (struct dummy_amp_priv_data *) 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) if (!amp->state.priv)
{ {

Wyświetl plik

@ -222,7 +222,7 @@ static int dummy_init(RIG *rig)
int i; int i;
ENTERFUNC; 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) if (!priv)
{ {

Wyświetl plik

@ -613,7 +613,7 @@ static int flrig_init(RIG *rig)
ENTERFUNC; ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version); 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)); struct flrig_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -168,7 +168,7 @@ static int netrigctl_init(RIG *rig)
return -RIG_EINVAL; 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)); struct netrigctl_priv_data));
if (!rig->state.priv) if (!rig->state.priv)
@ -296,7 +296,7 @@ static int netrigctl_open(RIG *rig)
if (ret <= 0) if (ret <= 0)
{ {
RETURNFUNC( (ret < 0) ? ret : -RIG_EPROTO); RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
} }
prot_ver = atoi(buf); prot_ver = atoi(buf);
@ -304,7 +304,7 @@ static int netrigctl_open(RIG *rig)
if (prot_ver < RIGCTLD_PROT_VER) 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, 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) // allocate memory for size of (cmd + digits + \n + \0)
len = strlen(cmd) + strlen(digits) + 2; len = strlen(cmd) + strlen(digits) + 2;
cmdp = calloc(1,len); cmdp = calloc(1, len);
if (cmdp == NULL) 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) // allocate memory for size of (cmd + msg + \n + \0)
len = strlen(cmd) + strlen(msg) + 2; len = strlen(cmd) + strlen(msg) + 2;
cmdp = calloc(1,len); cmdp = calloc(1, len);
if (cmdp == NULL) if (cmdp == NULL)
{ {
@ -2656,6 +2656,7 @@ int netrigctl_set_lock_mode(RIG *rig, int lock)
{ {
return -RIG_EPROTO; return -RIG_EPROTO;
} }
return (RIG_OK); return (RIG_OK);
} }
@ -2666,11 +2667,13 @@ int netrigctl_get_lock_mode(RIG *rig, int *lock)
int ret; int ret;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\get_lock_mode\n"); SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\get_lock_mode\n");
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (ret == 0) if (ret == 0)
{ {
return -RIG_EPROTO; return -RIG_EPROTO;
} }
sscanf(buf,"%d", lock);
sscanf(buf, "%d", lock);
return (RIG_OK); 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct dummy_rot_priv_data *) 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) if (!rot->state.priv)
{ {

Wyświetl plik

@ -424,7 +424,7 @@ static int tci1x_init(RIG *rig)
ENTERFUNC; ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version); 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)); struct tci1x_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -203,7 +203,7 @@ transaction_write:
len = strlen(cmdstr); len = strlen(cmdstr);
cmd = calloc(1,len + 2); cmd = calloc(1, len + 2);
if (cmd == NULL) if (cmd == NULL)
{ {
@ -515,7 +515,7 @@ int elad_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); 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) 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) 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) if (split)
{ {

Wyświetl plik

@ -195,7 +195,7 @@ int sdr1k_init(RIG *rig)
{ {
struct sdr1k_priv_data *priv; 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)); struct sdr1k_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -114,7 +114,7 @@ static int gs100_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL); 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) if (!priv)
{ {

Wyświetl plik

@ -132,7 +132,7 @@ int icmarine_init(RIG *rig)
priv_caps = (const struct icmarine_priv_caps *) caps->priv; 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)); struct icmarine_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -590,20 +590,24 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
case RIG_MODE_PKTUSB: case RIG_MODE_PKTUSB:
icmode = S_USB; icmode = S_USB;
if (rig->caps->rig_model == RIG_MODEL_IC7800) if (rig->caps->rig_model == RIG_MODEL_IC7800)
{ {
icmode = S_PSK; icmode = S_PSK;
} }
break; break;
case RIG_MODE_LSB: icmode = S_LSB; break; case RIG_MODE_LSB: icmode = S_LSB; break;
case RIG_MODE_PKTLSB: case RIG_MODE_PKTLSB:
icmode = S_LSB; icmode = S_LSB;
if (rig->caps->rig_model == RIG_MODEL_IC7800) if (rig->caps->rig_model == RIG_MODEL_IC7800)
{ {
icmode = S_PSKR; icmode = S_PSKR;
} }
break; break;
case RIG_MODE_RTTY: icmode = S_RTTY; break; case RIG_MODE_RTTY: icmode = S_RTTY; break;
@ -747,18 +751,22 @@ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode,
case S_PSK: case S_PSK:
*mode = RIG_MODE_PSK; *mode = RIG_MODE_PSK;
if (rig->caps->rig_model == RIG_MODEL_IC7800) if (rig->caps->rig_model == RIG_MODEL_IC7800)
{ {
*mode = RIG_MODE_PKTUSB; *mode = RIG_MODE_PKTUSB;
} }
break; break;
case S_PSKR: case S_PSKR:
*mode = RIG_MODE_PSKR; *mode = RIG_MODE_PSKR;
if (rig->caps->rig_model == RIG_MODEL_IC7800) if (rig->caps->rig_model == RIG_MODEL_IC7800)
{ {
*mode = RIG_MODE_PKTLSB; *mode = RIG_MODE_PKTLSB;
} }
break; break;
case S_DSTAR: *mode = RIG_MODE_DSTAR; 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) if (rig->caps->rig_model == RIG_MODEL_IC9700)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: toggling IC9700 targetable for satmode=%d\n", __func__, satmode); rig_debug(RIG_DEBUG_VERBOSE, "%s: toggling IC9700 targetable for satmode=%d\n",
if (satmode) rig->caps->targetable_vfo = 0; __func__, satmode);
else rig->caps->targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE;
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); 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 // satmode defaults to 0 -- only call if we need to
rig_get_func((RIG *)rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); 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; 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) if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{ {
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &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; 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) if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{ {
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &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; rig->state.cache.satmode = satmode;
@ -5620,7 +5622,8 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
rs->rigport.retry = 0; rs->rigport.retry = 0;
cmd = C_SEND_SEL_FREQ; cmd = C_SEND_SEL_FREQ;
// when transmitting in split mode the split VFO is active // 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 subcmd = (rig->state.cache.split
&& rig->state.cache.ptt) ? 0x00 : 0x01; // get the unselected vfo
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf, retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf,
&ack_len); &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", "%s: VFO_SUB and satmode is off so turning satmode on\n",
__func__); __func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 1); 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; rig->state.cache.satmode = 1;
priv->tx_vfo = RIG_VFO_SUB; 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", "%s: VFO_B and satmode is on so turning satmode off\n",
__func__); __func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0); 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; rig->state.cache.satmode = 0;
priv->tx_vfo = RIG_VFO_B; 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) if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{ {
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &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) 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 status; // we reset this to current status -- fails in SATMODE
priv->x1cx03cmdfails = 0; // we reset this to try it again priv->x1cx03cmdfails = 0; // we reset this to try it again
rig->state.cache.satmode = status; rig->state.cache.satmode = status;
icom_satmode_fix(rig,status); icom_satmode_fix(rig, status);
break; break;

Wyświetl plik

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

Wyświetl plik

@ -281,7 +281,7 @@ const struct rig_caps jst245_caps =
static int jst145_init(RIG *rig) static int jst145_init(RIG *rig)
{ {
struct jst145_priv_data *priv; 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) if (!priv)
{ {

Wyświetl plik

@ -298,7 +298,7 @@ transaction_write:
len = strlen(cmdstr); len = strlen(cmdstr);
cmd = calloc(1,len + 2); cmd = calloc(1, len + 2);
if (cmd == NULL) if (cmd == NULL)
{ {
@ -489,7 +489,8 @@ transaction_read:
if (retry_read++ < rs->rigport.retry) 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); hl_usleep(rig->caps->timeout * 1000);
goto transaction_write; goto transaction_write;
} }
@ -724,7 +725,7 @@ int kenwood_init(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s/%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s/%s\n", __func__,
BACKEND_VER, rig->caps->version); 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) 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; struct kenwood_priv_data *priv = rig->state.priv;
ENTERFUNC; 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 /* 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 0
if (rig->state.current_vfo == vfo) if (rig->state.current_vfo == vfo)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo already is %s...skipping\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo already is %s...skipping\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
RETURNFUNC2(RIG_OK); RETURNFUNC2(RIG_OK);
} }
#endif #endif
switch (vfo) 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) if (rig->state.rx_vfo == RIG_VFO_A)
{ {
HAMLIB_TRACE; 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) else if (rig->state.rx_vfo == RIG_VFO_B)
{ {
HAMLIB_TRACE; 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 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)); rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__, rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL); RETURNFUNC(-RIG_EINVAL);
} }
if (rig->caps->rig_model == RIG_MODEL_MALACHITE && vfo == RIG_VFO_B) if (rig->caps->rig_model == RIG_MODEL_MALACHITE && vfo == RIG_VFO_B)
{ {
// Malachite does not have VFOB so we'll just return VFOA // 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; expected_length = 18;
} }
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, expected_length + 1, retval = read_string(&rs->rigport, (unsigned char *) levelbuf,
expected_length + 1,
NULL, 0, 0, 1); NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval); rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
if (retval != expected_length) 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, retval,
levelbuf); levelbuf);
RETURNFUNC(-RIG_EPROTO); 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__); 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) if (!priv)
{ {

Wyświetl plik

@ -171,7 +171,7 @@ int dds60_init(RIG *rig)
{ {
struct dds60_priv_data *priv; 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)); struct dds60_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -171,7 +171,7 @@ int drt1_init(RIG *rig)
{ {
struct drt1_priv_data *priv; 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)); struct drt1_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -228,7 +228,7 @@ int dwtdll_init(RIG *rig)
{ {
struct dwtdll_priv_data *priv; 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)); struct dwtdll_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -163,7 +163,7 @@ int elektor304_init(RIG *rig)
{ {
struct elektor304_priv_data *priv; 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)); elektor304_priv_data));
if (!rig->state.priv) 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_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)); struct hiqsdr_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -481,7 +481,8 @@ pcr_init(RIG *rig)
return -RIG_EINVAL; 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) if (!rig->state.priv)
{ {

Wyświetl plik

@ -219,7 +219,7 @@ int ra37xx_init(RIG *rig)
return -RIG_EINVAL; 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)); struct ra37xx_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -124,7 +124,7 @@ int racal_init(RIG *rig)
return -RIG_EINVAL; 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)); struct racal_priv_data));
if (!rig->state.priv) 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_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) if (!rig->state.priv)
{ {

Wyświetl plik

@ -293,7 +293,7 @@ int tt538_init(RIG *rig)
{ {
struct tt538_priv_data *priv; 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)); struct tt538_priv_data));
if (!rig->state.priv) 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; 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); 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; struct tt588_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__); 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)); struct tt588_priv_data));
if (!rig->state.priv) 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) int tt565_init(RIG *rig)
{ {
struct tt565_priv_data *priv; 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)); struct tt565_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */ if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
@ -1210,7 +1210,9 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (rig->caps->rig_model == RIG_MODEL_TT599) if (rig->caps->rig_model == RIG_MODEL_TT599)
{ {
ii = (int)(val.f * 10); 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); SNPRINTF(cmdbuf, sizeof(cmdbuf), "*RMNN%c" EOM, ii);
} }
else else
@ -1224,6 +1226,7 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
which_receiver(rig, vfo), which_receiver(rig, vfo),
(int)(val.f * 9)); (int)(val.f * 9));
} }
break; break;
case RIG_LEVEL_VOXDELAY: case RIG_LEVEL_VOXDELAY:
@ -1692,6 +1695,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break; break;
case RIG_LEVEL_NR: case RIG_LEVEL_NR:
/* RIG_LEVEL_NR controls Orion NB setting - TEMP */ /* RIG_LEVEL_NR controls Orion NB setting - TEMP */
if (rig->caps->rig_model == RIG_MODEL_TT599) if (rig->caps->rig_model == RIG_MODEL_TT599)
{ {
@ -1717,6 +1721,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
__func__, lvlbuf); __func__, lvlbuf);
return -RIG_EPROTO; return -RIG_EPROTO;
} }
sscanf(lvlbuf + 5, "%f", &val->f); sscanf(lvlbuf + 5, "%f", &val->f);
val->f /= 10.0; val->f /= 10.0;
break; break;

Wyświetl plik

@ -212,7 +212,7 @@ int tt585_init(RIG *rig)
{ {
struct tt585_priv_data *priv; 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)); struct tt585_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -295,7 +295,7 @@ int rx331_init(RIG *rig)
{ {
struct rx331_priv_data *priv; 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)); struct rx331_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -239,7 +239,7 @@ int rx340_init(RIG *rig)
{ {
struct rx340_priv_data *priv; 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) if (!priv)
{ {

Wyświetl plik

@ -109,7 +109,7 @@ int tentec_init(RIG *rig)
{ {
struct tentec_priv_data *priv; 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)); struct tentec_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -360,7 +360,7 @@ tt550_init(RIG *rig)
{ {
struct tt550_priv_data *priv; 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)); struct tt550_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -190,7 +190,7 @@ int g3_init(RIG *rig)
{ {
struct g3_priv_data *priv; 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) if (!rig->state.priv)
{ {

Wyświetl plik

@ -191,7 +191,7 @@ int g3_init(RIG *rig)
{ {
struct g3_priv_data *priv; 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) if (!rig->state.priv)
{ {

Wyświetl plik

@ -112,7 +112,7 @@ int g313_init(RIG *rig)
{ {
struct g313_priv_data *priv; 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) if (!priv)
{ {

Wyświetl plik

@ -234,7 +234,7 @@ int g313_init(RIG *rig)
{ {
struct g313_priv_data *priv; 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)); struct g313_priv_data));
if (!rig->state.priv) if (!rig->state.priv)

Wyświetl plik

@ -211,7 +211,7 @@ int wj_init(RIG *rig)
return -RIG_EINVAL; 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) 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; 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; *freq = from_bcd_be(p->fm_status, 8) * factor;
return RIG_OK; return RIG_OK;

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

@ -117,14 +117,18 @@ static int ft990v12_open(RIG *rig);
static int ft990v12_close(RIG *rig); static int ft990v12_close(RIG *rig);
static int ft990v12_set_freq(RIG *rig, vfo_t vfo, freq_t freq); 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_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_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
static int ft990v12_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); 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_set_vfo(RIG *rig, vfo_t vfo);
static int ft990v12_get_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_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_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_set_rptr_shift(RIG *rig, vfo_t vfo,
static int ft990v12_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift); 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_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
static int ft990v12_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, static int ft990v12_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
vfo_t tx_vfo); vfo_t tx_vfo);
@ -137,7 +141,8 @@ 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_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_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_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_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_set_mem(RIG *rig, vfo_t vfo, int ch);
static int ft990v12_get_mem(RIG *rig, vfo_t vfo, int *ch); static int ft990v12_get_mem(RIG *rig, vfo_t vfo, int *ch);
@ -150,7 +155,8 @@ static int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
/* Private helper function prototypes */ /* 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_static_cmd(RIG *rig, unsigned char ci);
static int ft990v12_send_dynamic_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 p1, unsigned char p2,
@ -159,7 +165,8 @@ 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 int ft990v12_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit);
static const yaesu_cmd_set_t ncmd[] = static const yaesu_cmd_set_t ncmd[] =
{ /* ci */ {
/* ci */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* 00 00 Split (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* 00 00 Split (OFF) */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* 01 01 Split (On) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* 01 01 Split (On) */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* 02 02 Recall Memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* 02 02 Recall Memory */
@ -218,7 +225,7 @@ static const yaesu_cmd_set_t ncmd[] =
/* /*
* Private data * 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; int ft990uni_get_freq_state = 0;
struct ft990v12_priv_data struct ft990v12_priv_data
@ -473,7 +480,8 @@ int ft990v12_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, rig_debug(RIG_DEBUG_TRACE,
"%s: read pacing = %i\n", __func__, priv->pacing); "%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) if (err != RIG_OK)
{ {
@ -619,9 +627,11 @@ 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_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); 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) { if (ft990uni_get_freq_state < 2)
{
// M0EZP: UNI first call needs UPDATE_ALL // M0EZP: UNI first call needs UPDATE_ALL
ft990uni_get_freq_state = ft990uni_get_freq_state + 1; ft990uni_get_freq_state = ft990uni_get_freq_state + 1;
@ -631,6 +641,7 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
} }
priv = (struct ft990v12_priv_data *)rig->state.priv; priv = (struct ft990v12_priv_data *)rig->state.priv;
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = priv->current_vfo; vfo = priv->current_vfo;
@ -686,7 +697,9 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*freq = f; *freq = f;
return RIG_OK; return RIG_OK;
} else { }
else
{
// M0EZP: Uni use cache // M0EZP: Uni use cache
// *freq = vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB; // *freq = vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB;
return (RIG_OK); return (RIG_OK);
@ -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) if (chan->split & RIG_SPLIT_ON)
{ {
// Get data for the transmit VFO // 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 /* FT1000D
@ -3273,16 +3287,20 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
case FT990_NATIVE_UPDATE_OP_DATA: case FT990_NATIVE_UPDATE_OP_DATA:
case FT990_NATIVE_UPDATE_VFO_DATA: case FT990_NATIVE_UPDATE_VFO_DATA:
case FT990_NATIVE_UPDATE_MEM_CHNL_DATA: case FT990_NATIVE_UPDATE_MEM_CHNL_DATA:
if (ft990uni_get_freq_state < 2) { if (ft990uni_get_freq_state < 2)
{
// //
if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA) if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA)
// P4 = 0x01 to 0x5a for channel 1 - 90 // P4 = 0x01 to 0x5a for channel 1 - 90
{ {
/* err = ft990v12_send_dynamic_cmd(rig, ci, 4, 0, 0, ch); /* err = ft990v12_send_dynamic_cmd(rig, ci, 4, 0, 0, ch);
M0EZP: dont send command, rely on the assignment from memory below*/ M0EZP: dont send command, rely on the assignment from memory below*/
} else { }
else
{
// err = RIG_OK; K1MMI // err = RIG_OK; K1MMI
err = ft990v12_send_static_cmd(rig, ci); // K1MMI: only send for ALL DATA 1492 bytes or READ FLAGS 5 bytes err = ft990v12_send_static_cmd(rig,
ci); // K1MMI: only send for ALL DATA 1492 bytes or READ FLAGS 5 bytes
} }
@ -3295,7 +3313,8 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
{ {
case FT990_NATIVE_UPDATE_ALL_DATA: case FT990_NATIVE_UPDATE_ALL_DATA:
rl = FT990_ALL_DATA_LENGTH; // K1MMI: prepare to receive 1492 bytes back 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 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 */ n = read_block(&rig->state.rigport, p, rl); /* M0EZP: copied here from below */
return RIG_OK; return RIG_OK;
@ -3324,9 +3343,11 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
p = (unsigned char *) &priv->update_data.channel[ch]; p = (unsigned char *) &priv->update_data.channel[ch];
rl = FT990_MEM_CHNL_DATA_LENGTH; // 16 rl = FT990_MEM_CHNL_DATA_LENGTH; // 16
break; break;
default: default:
// M0EZP: shouldn't be here! // M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__, ci); // M0EZP rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__,
ci); // M0EZP
return -RIG_EINVAL; return -RIG_EINVAL;
} }
@ -3341,13 +3362,17 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
memcpy(&priv->update_data, p, FT990_ALL_DATA_LENGTH); memcpy(&priv->update_data, p, FT990_ALL_DATA_LENGTH);
return RIG_OK; return RIG_OK;
} else { }
else
{
return RIG_OK; return RIG_OK;
} }
case FT990_NATIVE_READ_FLAGS: case FT990_NATIVE_READ_FLAGS:
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci 0x%02x\n", __func__, ci); 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 err = ft990v12_send_static_cmd(rig,
ci); // K1MMI: only send for ALL DATA 1492 bytes
if (err != RIG_OK) if (err != RIG_OK)
{ {
return err; return err;
@ -3355,7 +3380,8 @@ int ft990v12_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
p = (unsigned char *)&priv->update_data; p = (unsigned char *)&priv->update_data;
rl = FT990_STATUS_FLAGS_LENGTH; // 5 rl = FT990_STATUS_FLAGS_LENGTH; // 5
n = read_block(&rig->state.rigport, (unsigned char*)&temp, rl); /* M0EZP: copied here from below */ n = read_block(&rig->state.rigport, (unsigned char *)&temp,
rl); /* M0EZP: copied here from below */
if (n < 0) if (n < 0)
{ {
@ -3364,16 +3390,19 @@ 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); 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_STATUS_FLAGS_LENGTH - 2); /* just overwrite first 3 bytes */
return RIG_OK; return RIG_OK;
break; break;
default: default:
// M0EZP: shouldn't be here! // M0EZP: shouldn't be here!
rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__, ci); // M0EZP rig_debug(RIG_DEBUG_TRACE, "%s: Default clause ci 0x%02x\n", __func__,
ci); // M0EZP
return -RIG_EINVAL; return -RIG_EINVAL;
} }
return RIG_OK; return RIG_OK;
} }

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) 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; 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) 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; return RIG_OK;
} }

Wyświetl plik

@ -601,9 +601,11 @@ int newcat_open(RIG *rig)
int err; int err;
// set the CAT TIME OUT TIMER to 100ms // set the CAT TIME OUT TIMER to 100ms
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0331"); SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0331");
if (RIG_OK != (err = newcat_set_cmd(rig))) 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? // can we improve this to set memory mode and pick the memory slot?
if (is_ftdx10 && freq > 5.2 && freq < 5.5) 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 1;
} }
return 0; return 0;
} }
@ -767,7 +771,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
ENTERFUNC; 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")) 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; 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")) 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); RETURNFUNC(err);
} }
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
{
rig->state.cache.modeMainA = mode; rig->state.cache.modeMainA = mode;
}
else else
{
rig->state.cache.modeMainB = mode; rig->state.cache.modeMainB = mode;
}
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(err); } 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); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
err = newcat_set_cmd(rig); err = newcat_set_cmd(rig);
break; break;
case RIG_PTT_ON_DATA: case RIG_PTT_ON_DATA:
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX1031;"); SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX1031;");
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
err = newcat_set_cmd(rig); err = newcat_set_cmd(rig);
break; break;
case RIG_PTT_ON: case RIG_PTT_ON:
/* Build the command string */ /* Build the command string */
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", txon); 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; pbwidth_t tmp_width;
int err; 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); err = newcat_get_mode(rig, RIG_VFO_B, &tmp_mode, &tmp_width);
if (err < 0) if (err < 0)
@ -2398,10 +2410,15 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
{ {
RETURNFUNC(err); RETURNFUNC(err);
} }
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
{
rig->state.cache.modeMainA = tx_mode; rig->state.cache.modeMainA = tx_mode;
}
else else
{
rig->state.cache.modeMainB = tx_mode; rig->state.cache.modeMainB = tx_mode;
}
RETURNFUNC(-RIG_ENAVAIL); RETURNFUNC(-RIG_ENAVAIL);

Wyświetl plik

@ -147,7 +147,8 @@ ars_init(ROT *rot)
return -RIG_EINVAL; 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) 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 *) 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) 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 *) 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) if (!rot->state.priv)
{ {

Wyświetl plik

@ -55,7 +55,7 @@ static int spid_rot_init(ROT *rot)
{ {
struct spid_rot2prog_priv_data *priv; 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)); spid_rot2prog_priv_data));
if (!priv) 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct ts7400_rot_priv_data *) 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) if (!rot->state.priv)
{ {

Wyświetl plik

@ -2,7 +2,7 @@
char *make_digest(const unsigned char *digest, int len) /* {{{ */ 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"; static const char hexits[17] = "0123456789abcdef";
int i; int i;

Wyświetl plik

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

Wyświetl plik

@ -152,7 +152,7 @@ int HAMLIB_API amp_register(const struct amp_caps *caps)
#endif #endif
p = (struct amp_list *)calloc(1,sizeof(struct amp_list)); p = (struct amp_list *)calloc(1, sizeof(struct amp_list));
if (!p) 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) static int add_opened_amp(AMP *amp)
{ {
struct opened_amp_l *p; 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) 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_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_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) switch (vfo)
{ {

Wyświetl plik

@ -253,7 +253,7 @@ static int generic_retr_extl(RIG *rig,
if (chan->ext_levels == NULL) 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 else
{ {

Wyświetl plik

@ -2094,6 +2094,7 @@ int HAMLIB_API rig_flush(hamlib_port_t *port)
{ {
return RIG_OK; return RIG_OK;
} }
if (port->type.rig == RIG_PORT_NETWORK if (port->type.rig == RIG_PORT_NETWORK
|| port->type.rig == RIG_PORT_UDP_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; 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); multicast_addr, multicast_port);
if (strcmp(multicast_addr, "0.0.0.0") == 0) 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); caps->rig_model);
#endif #endif
p = (struct rig_list *)calloc(1,sizeof(struct rig_list)); p = (struct rig_list *)calloc(1, sizeof(struct rig_list));
if (!p) 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 0 // this stopped a 2nd rig_init call with a valid model to fail -- reversing
if (n > 1) if (n > 1)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: rig model %u not found and rig count=%d\n", rig_debug(RIG_DEBUG_ERR, "%s: rig model %u not found and rig count=%d\n",
__func__, rig_model, n); __func__, rig_model, n);
return -RIG_ENAVAIL; return -RIG_ENAVAIL;
} }
#endif #endif
be_idx = rig_lookup_backend(rig_model); 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; 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) if (!p)
{ {
@ -850,7 +850,7 @@ int HAMLIB_API rig_open(RIG *rig)
rig_settings_load_all(NULL); // load default .hamlib_settings rig_settings_load_all(NULL); // load default .hamlib_settings
// Read in our settings // Read in our settings
char *cwd = calloc(1,4096); char *cwd = calloc(1, 4096);
if (getcwd(cwd, 4096) == NULL) if (getcwd(cwd, 4096) == NULL)
{ {
@ -859,11 +859,12 @@ int HAMLIB_API rig_open(RIG *rig)
else else
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: cwd=%s\n", __func__, cwd); 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; extern char *settings_file;
char *xdgpath = getenv("XDG_CONFIG_HOME"); char *xdgpath = getenv("XDG_CONFIG_HOME");
settings_file = "hamlib_settings"; settings_file = "hamlib_settings";
if (xdgpath) if (xdgpath)
{ {
sprintf(path, "%s/%s/%s", xdgpath, cwd, settings_file); 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; int retry_save = rs->rigport.retry;
rs->rigport.retry = 1; rs->rigport.retry = 1;
if (caps->rig_open != NULL) if (caps->rig_open != NULL)
{ {
status = caps->rig_open(rig); status = caps->rig_open(rig);
@ -1321,22 +1323,26 @@ int HAMLIB_API rig_open(RIG *rig)
// prime the freq and mode settings // prime the freq and mode settings
// don't care about the return here -- if it doesn't work so be it // don't care about the return here -- if it doesn't work so be it
freq_t freq; freq_t freq;
if (rig->caps->get_freq) if (rig->caps->get_freq)
{ {
int retval = rig_get_freq(rig, RIG_VFO_A, &freq); int retval = rig_get_freq(rig, RIG_VFO_A, &freq);
if (retval == RIG_OK && rig->caps->rig_model != RIG_MODEL_F6K) if (retval == RIG_OK && rig->caps->rig_model != RIG_MODEL_F6K)
{ {
vfo_t tx_vfo; vfo_t tx_vfo;
split_t split; split_t split;
rig_get_freq(rig, RIG_VFO_B, &freq); rig_get_freq(rig, RIG_VFO_B, &freq);
rig_get_split_vfo(rig, RIG_VFO_RX, &tx_vfo, &split); 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; rmode_t mode;
pbwidth_t width; pbwidth_t width;
rig_get_mode(rig, RIG_VFO_A, &mode, &width); rig_get_mode(rig, RIG_VFO_A, &mode, &width);
rig_get_mode(rig, RIG_VFO_B, &mode, &width); rig_get_mode(rig, RIG_VFO_B, &mode, &width);
} }
} }
rs->rigport.retry = retry_save; rs->rigport.retry = retry_save;
memcpy(&rs->rigport_deprecated, &rs->rigport, sizeof(hamlib_port_t_deprecated)); 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); 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 // do not mess with mode while PTT is on
if (rig->state.cache.ptt) 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; 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; HAMLIB_TRACE;
retcode = caps->set_vfo(rig, vfo); retcode = caps->set_vfo(rig, vfo);
@ -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 // 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 // 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); RETURNFUNC(RIG_OK);
} }
else 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 // 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); rig_set_split_vfo(rig, rx_vfo, RIG_SPLIT_ON, tx_vfo);
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
{
rig->state.cache.modeMainA = tx_mode; rig->state.cache.modeMainA = tx_mode;
}
else else
{
rig->state.cache.modeMainB = tx_mode; rig->state.cache.modeMainB = tx_mode;
}
ELAPSED2; ELAPSED2;

Wyświetl plik

@ -204,7 +204,7 @@ int HAMLIB_API rot_register(const struct rot_caps *caps)
#endif #endif
p = (struct rot_list *)calloc(1,sizeof(struct rot_list)); p = (struct rot_list *)calloc(1, sizeof(struct rot_list));
if (!p) 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) static int add_opened_rot(ROT *rot)
{ {
struct opened_rot_l *p; 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) if (!p)
{ {

Wyświetl plik

@ -618,7 +618,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
#endif #endif
// Store a copy of the original options for this FD, to be restored on close. // 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; term_backup-> fd = fd;
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H) #if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
memcpy(&term_backup->options, &orig_options, sizeof(orig_options)); 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 *xdgpath = getenv("XDG_CONFIG_HOME");
char *home = getenv("HOME"); char *home = getenv("HOME");
snprintf(path, pathlen, "%s/.config", home); snprintf(path, pathlen, "%s/.config", home);
if (xdgpath) 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) 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) else if (home)
{ {
// we add a leading period to hide the file // 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 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); rig_debug(RIG_DEBUG_TRACE, "%s: path=%s\n", __func__, path);
return RIG_OK; return RIG_OK;
} }
@ -1040,19 +1042,22 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
char buf[4096]; char buf[4096];
char *cvalue = (char *)value; char *cvalue = (char *)value;
int *ivalue = (int *)value; int *ivalue = (int *)value;
int n=0; int n = 0;
long *lvalue = (long *) value; long *lvalue = (long *) value;
float *fvalue = (float *) value; float *fvalue = (float *) value;
double *dvalue = (double *) value; double *dvalue = (double *) value;
char *vformat = "Unknown format??"; char *vformat = "Unknown format??";
char template[64]; char template[64];
rig_settings_get_path(path,sizeof(path)); rig_settings_get_path(path, sizeof(path));
fp = fopen(path, "r"); fp = fopen(path, "r");
if (fp == NULL) {
if (fp == NULL)
{
rig_debug(RIG_DEBUG_WARN, "%s: %s not found\n", __func__, path); rig_debug(RIG_DEBUG_WARN, "%s: %s not found\n", __func__, path);
return -RIG_EIO; return -RIG_EIO;
} }
strcpy(template, "hamlib_settings_XXXXXX"); strcpy(template, "hamlib_settings_XXXXXX");
switch (valuetype) switch (valuetype)
@ -1112,7 +1117,9 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
{ {
char *tmp = strdup(buf); char *tmp = strdup(buf);
char *s = strtok(tmp, "="); char *s = strtok(tmp, "=");
if (buf[0] == '#') {
if (buf[0] == '#')
{
fprintf(fptmp, "%s\n", buf); fprintf(fptmp, "%s\n", buf);
continue; continue;
} }
@ -1125,6 +1132,7 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
fclose(fptmp); fclose(fptmp);
return -RIG_EINTERNAL; return -RIG_EINTERNAL;
} }
++n; ++n;
char *v = strtok(NULL, "\r\n"); char *v = strtok(NULL, "\r\n");
@ -1137,6 +1145,7 @@ HAMLIB_EXPORT(int) rig_settings_save(char *setting, void *value,
fclose(fptmp); fclose(fptmp);
return -RIG_EINTERNAL; return -RIG_EINTERNAL;
} }
rig_debug(RIG_DEBUG_TRACE, "%s: parsing setting %s=%s\n", __func__, s, v); rig_debug(RIG_DEBUG_TRACE, "%s: parsing setting %s=%s\n", __func__, s, v);
fprintf(fptmp, vformat, s, value); fprintf(fptmp, vformat, s, value);
} }
@ -1161,18 +1170,21 @@ HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file)
char buf[4096]; char buf[4096];
char settingstmp[4096]; char settingstmp[4096];
if (settings_file == NULL) { if (settings_file == NULL)
{
rig_settings_get_path(settingstmp, sizeof(settingstmp)); rig_settings_get_path(settingstmp, sizeof(settingstmp));
settings_file = settingstmp; settings_file = settingstmp;
} }
fp = fopen(settings_file, "r"); fp = fopen(settings_file, "r");
if (fp == NULL) if (fp == NULL)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: settings_file (%s): %s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: settings_file (%s): %s\n", __func__,
settings_file, strerror(errno)); settings_file, strerror(errno));
return -RIG_EINVAL; return -RIG_EINVAL;
} }
rig_debug(RIG_DEBUG_TRACE, "%s: opened %s\n", __func__, settings_file); rig_debug(RIG_DEBUG_TRACE, "%s: opened %s\n", __func__, settings_file);
while (fgets(buf, sizeof(buf), fp)) while (fgets(buf, sizeof(buf), fp))

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -426,7 +426,7 @@ void hash_add_model(int id,
{ {
struct mod_lst *s; 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; s->id = id;
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name); SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
@ -1728,23 +1728,29 @@ readline_repeat:
{ {
if ((rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY)) 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 // Update power status
powerstat_t stat = RIG_POWER_ON; powerstat_t stat = RIG_POWER_ON;
retcode = rig_get_powerstat(my_rig, &stat); 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 // only command allows when powered off is 0x87=set_powerstat
if (retcode == RIG_OK && (rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY) if (retcode == RIG_OK && (rig_powerstat == RIG_POWER_OFF
|| rig_powerstat == RIG_POWER_STANDBY)
&& cmd_entry->cmd != 0x01 // dump_caps && cmd_entry->cmd != 0x01 // dump_caps
&& cmd_entry->cmd != 0xf0 // chk_vfo && cmd_entry->cmd != 0xf0 // chk_vfo
&& cmd_entry->cmd != 0x87) // set_powerstat && 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: %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; retcode = -RIG_EPOWER;
} }
else { else
{
retcode = (*cmd_entry->rig_routine)(my_rig, retcode = (*cmd_entry->rig_routine)(my_rig,
fout, fout,
fin, fin,
@ -2259,12 +2265,16 @@ declare_proto_rig(set_vfo)
} }
vfo = rig_parse_vfo(arg1); vfo = rig_parse_vfo(arg1);
if (vfo == RIG_VFO_NONE) if (vfo == RIG_VFO_NONE)
{ {
int c; int c;
while((c = fgetc(fin)) != '\n' && c != '\r' && c > 0);
while ((c = fgetc(fin)) != '\n' && c != '\r' && c > 0);
return -RIG_EINVAL; return -RIG_EINVAL;
} }
retval = rig_set_vfo(rig, vfo); retval = rig_set_vfo(rig, vfo);
#if 0 // see if we can make this dynamic #if 0 // see if we can make this dynamic

Wyświetl plik

@ -974,7 +974,9 @@ int main(int argc, char *argv[])
/* /*
* main loop accepting connections * 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 do
{ {
fd_set set; fd_set set;
@ -1239,12 +1241,15 @@ void *handle_socket(void *arg)
handle_data_arg->use_password); handle_data_arg->use_password);
if (retcode != 0) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rigctl_parse retcode=%d\n", __func__, retcode); } 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 // 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_get_powerstat(my_rig, &powerstat);
rig_powerstat = powerstat; rig_powerstat = powerstat;
if (powerstat == RIG_POWER_OFF) retcode = -RIG_EPOWER;
if (powerstat == RIG_POWER_OFF) { retcode = -RIG_EPOWER; }
} }
} }
else else

Wyświetl plik

@ -291,7 +291,7 @@ void hash_add_model(int id,
{ {
struct mod_lst *s; 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; s->id = id;
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name); 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 do
{ {
arg = calloc(1,sizeof(struct handle_data)); arg = calloc(1, sizeof(struct handle_data));
if (!arg) if (!arg)
{ {