kopia lustrzana https://github.com/Hamlib/Hamlib
Limit the error retry in rigctld.c to 4 times
https://github.com/Hamlib/Hamlib/issues/551pull/552/head
rodzic
1e9a991a25
commit
06723c959b
|
@ -83,7 +83,6 @@
|
||||||
/*
|
/*
|
||||||
* Reminder: when adding long options,
|
* Reminder: when adding long options,
|
||||||
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
|
||||||
* TODO: add an option to read from a file
|
* TODO: add an option to read from a file
|
||||||
*/
|
*/
|
||||||
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:W:x:z:lLuovhVZ"
|
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:W:x:z:lLuovhVZ"
|
||||||
|
@ -108,6 +107,7 @@ static struct option long_options[] =
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"twiddle_timeout", 1, 0, 'W'},
|
{"twiddle_timeout", 1, 0, 'W'},
|
||||||
|
{"twiddle_rit" , 0, 0, 'Y'},
|
||||||
{"uplink", 1, 0, 'x'},
|
{"uplink", 1, 0, 'x'},
|
||||||
{"debug-time-stamps", 0, 0, 'Z'},
|
{"debug-time-stamps", 0, 0, 'Z'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
|
@ -249,6 +249,7 @@ int main(int argc, char *argv[])
|
||||||
int sock_listen;
|
int sock_listen;
|
||||||
int reuseaddr = 1;
|
int reuseaddr = 1;
|
||||||
int twiddle = 0;
|
int twiddle = 0;
|
||||||
|
int twiddle_rit = 0;
|
||||||
int uplink = 0;
|
int uplink = 0;
|
||||||
char host[NI_MAXHOST];
|
char host[NI_MAXHOST];
|
||||||
char serv[NI_MAXSERV];
|
char serv[NI_MAXSERV];
|
||||||
|
@ -526,6 +527,10 @@ int main(int argc, char *argv[])
|
||||||
twiddle = atoi(optarg);
|
twiddle = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Y':
|
||||||
|
twiddle_rit=1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
if (!optarg)
|
if (!optarg)
|
||||||
{
|
{
|
||||||
|
@ -586,9 +591,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
my_rig->state.twiddle_timeout = twiddle;
|
my_rig->state.twiddle_timeout = twiddle;
|
||||||
|
my_rig->state.twiddle_rit = twiddle_rit;
|
||||||
my_rig->state.uplink = uplink;
|
my_rig->state.uplink = uplink;
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d, twiddle_rit=%d\n", __func__,
|
||||||
my_rig->state.twiddle_timeout, my_rig->state.uplink);
|
my_rig->state.twiddle_timeout, my_rig->state.uplink, my_rig->state.twiddle_rit);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||||
|
@ -1097,16 +1103,20 @@ void *handle_socket(void *arg)
|
||||||
if (ferror(fsockout)) fsockout = get_fsockout(handle_data_arg);
|
if (ferror(fsockout)) fsockout = get_fsockout(handle_data_arg);
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: socket error in=%d, out=%d\n", __func__,
|
rig_debug(RIG_DEBUG_ERR, "%s: socket error in=%d, out=%d\n", __func__,
|
||||||
ferror(fsockin), ferror(fsockout));
|
ferror(fsockin), ferror(fsockout));
|
||||||
|
// if we get an error from the rig we'll try to repoen
|
||||||
do
|
// that may fix things when COM ports drop and such
|
||||||
|
int retry=4;
|
||||||
|
if (retcode == 2)
|
||||||
{
|
{
|
||||||
retcode = rig_close(my_rig);
|
do
|
||||||
hl_usleep(1000 * 1000);
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: rig_close retcode=%d\n", __func__, retcode);
|
retcode = rig_close(my_rig);
|
||||||
retcode = rig_open(my_rig);
|
hl_usleep(1000 * 1000);
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode);
|
rig_debug(RIG_DEBUG_ERR, "%s: rig_close retcode=%d\n", __func__, retcode);
|
||||||
|
retcode = rig_open(my_rig);
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode);
|
||||||
|
} while (retry-- > 0 && retcode != RIG_OK);
|
||||||
}
|
}
|
||||||
while (retcode != RIG_OK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL);
|
while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL);
|
||||||
|
@ -1213,6 +1223,7 @@ void usage(void)
|
||||||
" -o, --vfo do not default to VFO_CURR, require extra vfo arg\n"
|
" -o, --vfo do not default to VFO_CURR, require extra vfo arg\n"
|
||||||
" -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\n"
|
" -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\n"
|
||||||
" -W, --twiddle_timeout timeout after detecting vfo manual change\n"
|
" -W, --twiddle_timeout timeout after detecting vfo manual change\n"
|
||||||
|
" -W, --twiddle_rit suppress VFOB getfreq so RIT can be twiddled"
|
||||||
" -x, --uplink set uplink get_freq ignore, 1=Sub, 2=Main\n"
|
" -x, --uplink set uplink get_freq ignore, 1=Sub, 2=Main\n"
|
||||||
" -Z, --debug-time-stamps enable time stamps for debug messages\n"
|
" -Z, --debug-time-stamps enable time stamps for debug messages\n"
|
||||||
" -h, --help display this help and exit\n"
|
" -h, --help display this help and exit\n"
|
||||||
|
|
Ładowanie…
Reference in New Issue