Merge remote-tracking branch 'upstream/master'

pull/58/head
Michael Black W9MDB 2018-10-28 16:10:30 -05:00
commit f0bcffae36
10 zmienionych plików z 97 dodań i 54 usunięć

Wyświetl plik

@ -657,14 +657,14 @@ static int thd72_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
break;
case RIG_LEVEL_VOXGAIN:
retval = thd72_get_menu_item(rig, 8, '9', &l);
retval = thd72_get_menu_item(rig, 8, 9, &l);
if (retval != RIG_OK)
return retval;
/* FIXME - if VOX is off, what do we return */
val->f = l / 9.0;
break;
case RIG_LEVEL_VOXDELAY:
retval = thd72_get_menu_item(rig, 9, '7', &l);
retval = thd72_get_menu_item(rig, 9, 7, &l);
if (retval != RIG_OK)
return retval;
/* FIXME - if VOX is off, what do we return */
@ -683,7 +683,7 @@ static int thd72_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
val->f = thd72sqlevel[l];
break;
case RIG_LEVEL_BALANCE:
retval = thd72_get_menu_item(rig, 13, '4', &l);
retval = thd72_get_menu_item(rig, 13, 4, &l);
if (retval != RIG_OK)
return retval;
/* FIXME - is balance 0.0 .. 1.0 or -1.0 .. 1.0? */
@ -782,7 +782,7 @@ static int thd72_get_parm(RIG *rig, setting_t parm, value_t *val)
switch (parm) {
case RIG_PARM_APO:
retval = thd72_get_menu_item(rig, 3, '3', &l);
retval = thd72_get_menu_item(rig, 3, 3, &l);
if (retval != RIG_OK)
return retval;
val->i = thd72apo[l];

Wyświetl plik

@ -174,12 +174,12 @@ const struct rig_caps funcubeplus_caps = {
.has_get_level = RIG_LEVEL_ATT | RIG_LEVEL_PREAMP | RIG_LEVEL_RF, // RIG_LEVEL_ATT: Mixer gain on/off
// RIG_LEVEL_PREAMP: LNA gain on/off
// RIG_LEVEL_RF 0..1 : IF gain 0 .. 59 dB
.has_set_level = RIG_LEVEL_ATT | RIG_LEVEL_PREAMP | RIG_LEVEL_RF, // RIG_LEVEL_ATT: Mixer gain on/off
// RIG_LEVEL_PREAMP: LNA gain on/off
// RIG_LEVEL_RF 0..1 : IF gain 0 .. 59 dB
// so values have to be mapped
// so values have to be mapped
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {},
@ -700,8 +700,8 @@ int funcubepro_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
libusb_device_handle *udh = rig->state.rigport.handle;
int ret;
int actual_length;
unsigned char au8BufOut[64]; // endpoint size
unsigned char au8BufIn[64]; // endpoint size
unsigned char au8BufOut[64] = { 0 }; // endpoint size
unsigned char au8BufIn[64] = { 0 }; // endpoint size
switch (level) {
case RIG_LEVEL_PREAMP:
@ -719,7 +719,7 @@ int funcubepro_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if( au8BufOut[1] > 59 )
au8BufOut[1]= 59;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported level %d\n", __func__, level);
@ -761,8 +761,8 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
libusb_device_handle *udh = rig->state.rigport.handle;
int ret;
int actual_length;
unsigned char au8BufOut[64]; // endpoint size
unsigned char au8BufIn[64]; // endpoint size
unsigned char au8BufOut[64] = { 0 }; // endpoint size
unsigned char au8BufIn[64] = { 0 }; // endpoint size
switch (level) {
case RIG_LEVEL_ATT:
@ -773,7 +773,7 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
case RIG_LEVEL_RF:
au8BufOut[0] = REQUEST_GET_IF_GAIN;
break;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported level %d\n", __func__, level);
return -RIG_EINVAL;
@ -809,7 +809,7 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
switch (level) {
case RIG_LEVEL_PREAMP:
case RIG_LEVEL_ATT:
val->i = au8BufIn[2] &0x01;
val->i = au8BufIn[2] &0x01;
break;
case RIG_LEVEL_RF:

Wyświetl plik

@ -115,7 +115,8 @@ int cm108_open(hamlib_port_t *port)
&& ((hiddevinfo.product >= 0x0008
&& hiddevinfo.product <= 0x000f)
|| hiddevinfo.product == 0x0012
|| hiddevinfo.product == 0x013a))
|| hiddevinfo.product == 0x013a
|| hiddevinfo.product == 0x013c))
// SSS1621/23
|| (hiddevinfo.vendor == 0x0c76
&& (hiddevinfo.product == 0x1605

Wyświetl plik

@ -78,8 +78,10 @@
#define PATH_MAX 256
#endif
#if !(defined(WIN32) || !defined(HAVE_GLOB_H))
static char
uh_device_path[PATH_MAX]; // use PATH_MAX since udev names can be VERY long!
#endif
static int uh_device_fd = -1;
static int uh_is_initialized = 0;
@ -106,14 +108,18 @@ static pthread_t readthread;
#define freelock()
#endif
#if defined(HAVE_SELECT)
//
// time of last heartbeat. Updated by heartbeat()
//
static time_t lastbeat = 0;
#endif
#if defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT)
static time_t starttime;
#define TIME ((int) (time(NULL) - starttime))
#endif
//
// close all sockets and mark them free
@ -205,9 +211,12 @@ static void close_microham()
* number begins with MK, M2, CK, DK, D2, 2R, 2P or UR. Then, open the serial
* line with correct serial speed etc. and put a valid fd into uh_device_fd.
*/
static void finddevices()
{
}
/* Commenting out the following dummy function to quell the warning from
* MinGW's GCC of a defined but not used function.
*/
/* static void finddevices() */
/* { */
/* } */
#else
@ -381,6 +390,7 @@ static void finddevices()
#endif
#if defined(HAVE_SELECT)
//
// parse a frame received from the keyer
// This is called from the "device reading" thread
@ -500,8 +510,10 @@ static void parseFrame(unsigned char *frame)
}
}
}
#endif /* HAVE_SELECT */
#if defined(HAVE_SELECT)
//
// Send radio bytes to microHam device
//
@ -548,6 +560,7 @@ static void writeRadio(unsigned char *bytes, int len)
freelock();
}
#endif /* HAVE_SELECT */
//
@ -585,6 +598,7 @@ static void writeFlags()
}
#if defined(HAVE_SELECT)
//
// Send bytes to the WinKeyer within microHam device
//
@ -639,6 +653,7 @@ static void writeWkey(unsigned char *bytes, int len)
freelock();
}
#endif /* HAVE_SELECT */
//
@ -701,6 +716,7 @@ static void writeControl(unsigned char *data, int len)
}
#if defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT)
//
// send a heartbeat and record time
// The "last heartbeat" time is recorded in a global variable
@ -716,8 +732,10 @@ static void heartbeat()
writeControl(seq, 2);
lastbeat = time(NULL);
}
#endif /* defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT) */
#if defined(HAVE_SELECT)
//
// This thread reads from the microHam device and puts data on the sockets
// it also issues periodic heartbeat messages
@ -725,7 +743,6 @@ static void heartbeat()
//
static void *read_device(void *p)
{
#if defined(HAVE_SELECT)
unsigned char frame[4];
int framepos = 0;
int ret;
@ -862,9 +879,9 @@ static void *read_device(void *p)
}
}
#endif
return NULL;
// return NULL;
}
#endif
/*

Wyświetl plik

@ -241,7 +241,7 @@ int network_open(hamlib_port_t *rp, int default_port)
{
break;
}
char msg[150];
char msg[1024];
snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname);
handle_error(RIG_DEBUG_WARN, msg);

Wyświetl plik

@ -121,8 +121,6 @@ static struct option long_options[] =
/* variable for readline support */
#ifdef HAVE_LIBREADLINE
static const int have_rl = 1;
#else /* no readline */
static const int have_rl = 0;
#endif
@ -143,6 +141,7 @@ int main(int argc, char *argv[])
int verbose = 0;
int show_conf = 0;
int dump_caps_opt = 0;
#ifdef HAVE_READLINE_HISTORY
int rd_hist = 0;
int sv_hist = 0;
@ -150,7 +149,8 @@ int main(int argc, char *argv[])
const char hist_file[] = "/.rigctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif
#endif /* HAVE_READLINE_HISTORY */
const char *rig_file = NULL, *ptt_file = NULL, *dcd_file = NULL;
ptt_type_t ptt_type = RIG_PTT_NONE;
dcd_type_t dcd_type = RIG_DCD_NONE;
@ -389,7 +389,7 @@ int main(int argc, char *argv[])
case 'I':
sv_hist++;
break;
#endif
#endif /* HAVE_READLINE_HISTORY */
case 'v':
verbose++;
@ -570,7 +570,7 @@ int main(int argc, char *argv[])
}
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
@ -608,11 +608,11 @@ int main(int argc, char *argv[])
hist_path = (char *)NULL;
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif
rig_close(my_rig); /* close port */
#endif /* HAVE_LIBREADLINE */
rig_close(my_rig); /* close port */
rig_cleanup(my_rig); /* if you care about memory */
return exitcode;

Wyświetl plik

@ -109,8 +109,6 @@ static struct option long_options[] =
/* variable for readline support */
#ifdef HAVE_LIBREADLINE
static const int have_rl = 1;
#else /* no readline */
static const int have_rl = 0;
#endif
@ -131,6 +129,7 @@ int main(int argc, char *argv[])
int verbose = 0;
int show_conf = 0;
int dump_caps_opt = 0;
#ifdef HAVE_READLINE_HISTORY
int rd_hist = 0;
int sv_hist = 0;
@ -138,7 +137,8 @@ int main(int argc, char *argv[])
const char hist_file[] = "/.rotctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif
#endif /* HAVE_READLINE_HISTORY */
const char *rot_file = NULL;
int serial_rate = 0;
char conf_parms[MAXCONFLEN] = "";
@ -240,7 +240,7 @@ int main(int argc, char *argv[])
case 'I':
sv_hist++;
break;
#endif
#endif /* HAVE_READLINE_HISTORY */
case 'v':
verbose++;
@ -395,7 +395,7 @@ int main(int argc, char *argv[])
}
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
@ -433,11 +433,11 @@ int main(int argc, char *argv[])
hist_path = (char *)NULL;
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif
rot_close(my_rot); /* close port */
#endif /* HAVE_LIBREADLINE */
rot_close(my_rot); /* close port */
rot_cleanup(my_rot); /* if you care about memory */
return exitcode;

Wyświetl plik

@ -177,7 +177,7 @@ const struct rig_caps ft817_caps = {
.write_delay = FT817_WRITE_DELAY,
.post_write_delay = FT817_POST_WRITE_DELAY,
.timeout = FT817_TIMEOUT,
.retry = 3,
.retry = 5,
.has_get_func = RIG_FUNC_NONE,
.has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL,
.has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER,
@ -456,17 +456,27 @@ int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
int n;
freq_t f1 = 0, f2 = 0;
int retries = rig->state.rigport.retry + 1; // +1 because, because 2 steps are needed even in best scenario
if (vfo != RIG_VFO_CURR)
return -RIG_ENTARGET;
if (check_cache_timeout(&p->fm_status_tv))
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0)
return n;
while ((f1 == 0 || f1 != f2) && retries-- > 0) {
if (check_cache_timeout(&p->fm_status_tv))
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0)
return n;
f1 = f2;
f2 = from_bcd_be(p->fm_status, 8);
}
*freq = from_bcd_be(p->fm_status, 8) * 10;
if (retries >= 0) {
*freq = f1 * 10;
return RIG_OK;
} else {
return -RIG_EIO;
}
return RIG_OK;
}
int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
@ -842,6 +852,8 @@ int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
int index, n;
ptt_t ptt_response = -1;
int retries = rig->state.rigport.retry;
if (vfo != RIG_VFO_CURR)
return -RIG_ENTARGET;
@ -859,15 +871,28 @@ int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_EINVAL;
}
n = ft817_send_cmd(rig, index);
rig_force_cache_timeout(
&((struct ft817_priv_data *)rig->state.priv)->tx_status_tv);
do {
n = ft817_send_cmd(rig, index);
if (n < 0 && n != -RIG_ERJCTED)
return n;
rig_force_cache_timeout(
&((struct ft817_priv_data *)rig->state.priv)->tx_status_tv);
if (n < 0 && n != -RIG_ERJCTED)
return n;
if (ft817_get_ptt(rig, vfo, &ptt_response) != RIG_OK) {
ptt_response = -1;
}
} while (ptt_response != ptt && retries-- > 0);
if (retries >=0) {
return RIG_OK;
} else {
return -RIG_EIO;
}
return RIG_OK;
}
int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status)

Wyświetl plik

@ -50,7 +50,7 @@
/*
* Read timeout.
*/
#define FT817_TIMEOUT 1000
#define FT817_TIMEOUT 3000
/*
* The time the TX, RX and FREQ/MODE status are cached (in millisec).

Wyświetl plik

@ -289,7 +289,7 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wi
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: Passs band is not set here nor does it make sense as the
* Comments: Pass band is not set here nor does it make sense as the
* FT991 cannot receive on VFO B. The FT991 cannot set
* VFO B mode directly so we'll just set A and swap A
* into B but we must preserve the VFO A mode and VFO B
@ -333,7 +333,7 @@ int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_widt
{
return err;
}
strncat (restore_commands, priv->ret_data, NEWCAT_DATA_LEN-1);
strncpy(restore_commands, priv->ret_data, NEWCAT_DATA_LEN);
/* Change mode on VFOA */
if (RIG_OK != (err = newcat_set_mode (rig, RIG_VFO_A, tx_mode, RIG_PASSBAND_NOCHANGE)))