kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files
rodzic
4d06d195e5
commit
35fffc4f38
|
@ -1020,10 +1020,12 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
priv = (struct icom_priv_data *) rs->priv;
|
||||
|
||||
#if 0 // disabled to test if IC9700 satmode/gpredict still works OK
|
||||
|
||||
if (priv->curr_vfo == RIG_VFO_NONE)
|
||||
{
|
||||
icom_set_default_vfo(rig);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
cmd = C_RD_FREQ;
|
||||
|
@ -1037,7 +1039,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
cmd = 0x1c;
|
||||
subcmd = 0x03;
|
||||
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf,
|
||||
&ack_len);
|
||||
&ack_len);
|
||||
|
||||
if (retval == RIG_OK) // then we're done!!
|
||||
{
|
||||
|
@ -3674,7 +3676,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
cmd = C_SEND_SEL_FREQ;
|
||||
subcmd = 0x01; // set the unselected vfo
|
||||
retval = icom_transaction(rig, cmd, subcmd, freqbuf, freq_len, ackbuf,
|
||||
&ack_len);
|
||||
&ack_len);
|
||||
|
||||
if (retval == RIG_OK) // then we're done!!
|
||||
{
|
||||
|
@ -3840,7 +3842,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
cmd = C_SEND_SEL_FREQ;
|
||||
subcmd = 0x01; // get the unselected vfo
|
||||
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf,
|
||||
&ack_len);
|
||||
&ack_len);
|
||||
|
||||
if (retval == RIG_OK) // then we're done!!
|
||||
{
|
||||
|
@ -3858,7 +3860,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
cmd = 0x1c;
|
||||
subcmd = 0x03;
|
||||
retval = icom_transaction(rig, cmd, subcmd, NULL, 0, ackbuf,
|
||||
&ack_len);
|
||||
&ack_len);
|
||||
|
||||
if (retval == RIG_OK) // then we're done!!
|
||||
{
|
||||
|
@ -3994,7 +3996,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4043,7 +4045,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4097,7 +4099,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4146,7 +4148,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4207,7 +4209,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4270,7 +4272,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4329,7 +4331,7 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4383,7 +4385,7 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode,
|
||||
tx_width)))
|
||||
tx_width)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -4557,7 +4559,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
}
|
||||
|
||||
if (RIG_OK != (retval = icom_transaction(rig, C_CTL_SPLT, split_sc, NULL, 0,
|
||||
ackbuf, &ack_len)))
|
||||
ackbuf, &ack_len)))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -637,7 +637,9 @@ int kenwood_open(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
err = kenwood_get_id(rig, id);
|
||||
if (err == -RIG_ETIMEOUT) {
|
||||
|
||||
if (err == -RIG_ETIMEOUT)
|
||||
{
|
||||
// Ensure rig is on
|
||||
rig_set_powerstat(rig, 1);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef struct _yaesu_newcat_commands
|
|||
*/
|
||||
static const yaesu_newcat_commands_t valid_commands[] =
|
||||
{
|
||||
/* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D */
|
||||
/* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D */
|
||||
{"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
|
||||
{"AC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
|
||||
{"AG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
|
||||
|
|
|
@ -200,11 +200,13 @@ int HAMLIB_API rig_register(const struct rig_caps *caps)
|
|||
}
|
||||
|
||||
hval = HASH_FUNC(caps->rig_model);
|
||||
if(rig_hash_table[hval])
|
||||
|
||||
if (rig_hash_table[hval])
|
||||
{
|
||||
printf("Hash collision!!! Fatal error!!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
p->caps = caps;
|
||||
// p->handle = NULL;
|
||||
p->next = rig_hash_table[hval];
|
||||
|
|
|
@ -406,7 +406,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
rs->transceive = RIG_TRN_OFF;
|
||||
rs->poll_interval = 500;
|
||||
rs->lo_freq = 0;
|
||||
|
||||
|
||||
// We are using range_list1 as the default
|
||||
// Eventually we will have separate model number for different rig variations
|
||||
// So range_list1 will become just range_list (per model)
|
||||
|
|
72
src/serial.c
72
src/serial.c
|
@ -45,6 +45,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
|
@ -196,9 +197,10 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
/*
|
||||
* Open in Non-blocking mode. Watch for EAGAIN errors!
|
||||
*/
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: OPEN before\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: OPEN before\n", __func__);
|
||||
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: OPEN after\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: OPEN after\n", __func__);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
/* Could not open the port. */
|
||||
|
@ -212,9 +214,9 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
|
||||
rp->fd = fd;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: serial_setup before\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: serial_setup before\n", __func__);
|
||||
err = serial_setup(rp);
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: serial_setup after\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: serial_setup after\n", __func__);
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
|
@ -222,9 +224,9 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
return err;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: serial_flush before\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: serial_flush before\n", __func__);
|
||||
serial_flush(rp); // ensure nothing is there when we open
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: serial_flush before\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: serial_flush before\n", __func__);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -264,22 +266,22 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
* Get the current options for the port...
|
||||
*/
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: tcgetattr\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: tcgetattr\n", __func__);
|
||||
tcgetattr(fd, &options);
|
||||
memcpy(&orig_options, &options, sizeof(orig_options));
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TCGETA\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: IOCTL TCGETA\n", __func__);
|
||||
IOCTL(fd, TCGETA, &options);
|
||||
memcpy(&orig_options, &options, sizeof(orig_options));
|
||||
#else /* sgtty */
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TIOCGETP\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: IOCTL TIOCGETP\n", __func__);
|
||||
IOCTL(fd, TIOCGETP, &sg);
|
||||
memcpy(&orig_sg, &sg, sizeof(orig_sg));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CFMAKERAW
|
||||
/* Set serial port to RAW mode by default. */
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: cfmakeraw\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cfmakeraw\n", __func__);
|
||||
cfmakeraw(&options);
|
||||
#endif
|
||||
|
||||
|
@ -343,9 +345,9 @@ rig_debug(RIG_DEBUG_TRACE,"%s: cfmakeraw\n", __func__);
|
|||
}
|
||||
|
||||
/* TODO */
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: cfsetispeed\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cfsetispeed\n", __func__);
|
||||
cfsetispeed(&options, speed);
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: cfsetospeed\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cfsetospeed\n", __func__);
|
||||
cfsetospeed(&options, speed);
|
||||
|
||||
/*
|
||||
|
@ -518,7 +520,8 @@ rig_debug(RIG_DEBUG_TRACE,"%s: cfsetospeed\n", __func__);
|
|||
*/
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: tcsetattr TCSANOW\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: tcsetattr TCSANOW\n", __func__);
|
||||
|
||||
if (tcsetattr(fd, TCSANOW, &options) == -1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
|
@ -532,7 +535,8 @@ rig_debug(RIG_DEBUG_TRACE,"%s: tcsetattr TCSANOW\n", __func__);
|
|||
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TCSETA\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: IOCTL TCSETA\n", __func__);
|
||||
|
||||
if (IOCTL(fd, TCSETA, &options) == -1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
|
@ -546,7 +550,8 @@ rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TCSETA\n", __func__);
|
|||
|
||||
#else
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TIOCSETP\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: IOCTL TIOCSETP\n", __func__);
|
||||
|
||||
/* sgtty */
|
||||
if (IOCTL(fd, TIOCSETP, &sg) == -1)
|
||||
{
|
||||
|
@ -585,27 +590,34 @@ rig_debug(RIG_DEBUG_TRACE,"%s: IOCTL TIOCSETP\n", __func__);
|
|||
*/
|
||||
int HAMLIB_API serial_flush(hamlib_port_t *p)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s MDB called\n", __func__);
|
||||
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
// if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
// {
|
||||
unsigned char buf[32];
|
||||
/*
|
||||
* Catch microHam case:
|
||||
* if fd corresponds to a microHam device drain the line
|
||||
* (which is a socket) by reading until it is empty.
|
||||
*/
|
||||
int n;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: flushing: ", __func__);
|
||||
|
||||
while ((n = read(p->fd, buf, 32)) > 0)
|
||||
{
|
||||
char buf[32];
|
||||
/*
|
||||
* Catch microHam case:
|
||||
* if fd corresponds to a microHam device drain the line
|
||||
* (which is a socket) by reading until it is empty.
|
||||
*/
|
||||
int n;
|
||||
int i;
|
||||
|
||||
while ((n = read(p->fd, buf, 32)) > 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: flushed %d bytes\n", __func__, n);
|
||||
/* do nothing */
|
||||
}
|
||||
for (i = 0; i < n; ++i) { printf("0x%02x(%c) ", buf[i], isprint(buf[i]) ? buf[i] : '~'); }
|
||||
|
||||
return RIG_OK;
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
printf("DONE\n");
|
||||
|
||||
return RIG_OK;
|
||||
// }
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: tcflush\n", __func__);
|
||||
tcflush(p->fd, TCIFLUSH);
|
||||
return RIG_OK;
|
||||
|
|
|
@ -416,7 +416,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s %s\n", hamlib_version, __DATE__ " " __TIME__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s %s\n", hamlib_version,
|
||||
__DATE__ " " __TIME__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s",
|
||||
"Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n");
|
||||
|
||||
|
|
|
@ -640,6 +640,7 @@ int main(int argc, char *argv[])
|
|||
my_rig->caps->rig_model,
|
||||
my_rig->caps->model_name);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
@ -980,6 +981,7 @@ void *handle_socket(void *arg)
|
|||
sync_callback(1);
|
||||
|
||||
#if 0
|
||||
|
||||
if (!client_count++)
|
||||
{
|
||||
retcode = rig_open(my_rig);
|
||||
|
@ -991,6 +993,7 @@ void *handle_socket(void *arg)
|
|||
my_rig->caps->model_name);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
sync_callback(0);
|
||||
|
|
|
@ -57,7 +57,7 @@ int sprintf_vfo(char *str, vfo_t vfo)
|
|||
const char *sv;
|
||||
sv = rig_strvfo(vfo & RIG_VFO_N(i));
|
||||
|
||||
if (sv && sv[0] && strstr(str,"None")==0)
|
||||
if (sv && sv[0] && strstr(str, "None") == 0)
|
||||
{
|
||||
len += sprintf(str + len, "%s ", sv);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue