kopia lustrzana https://github.com/Hamlib/Hamlib
Add debug time stamps via -Z and --debug-time-stamps
rodzic
841acdf011
commit
6c369109e6
|
@ -411,6 +411,10 @@ will use the verbose facility to print critical values useful for
|
||||||
testing and will often ask for this output in response to a request
|
testing and will often ask for this output in response to a request
|
||||||
for help.
|
for help.
|
||||||
|
|
||||||
|
@item -Z
|
||||||
|
@itemx --debug-time-stamps
|
||||||
|
Enable time stamps on debug output.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx --help
|
@itemx --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
|
@ -421,6 +425,7 @@ Show summary of these options and exit.
|
||||||
@item -V
|
@item -V
|
||||||
@itemx --version
|
@itemx --version
|
||||||
Show version of @command{rigctl} and exit.
|
Show version of @command{rigctl} and exit.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@quotation Note
|
@quotation Note
|
||||||
|
@ -1414,6 +1419,10 @@ will use the verbose facility to print critical values useful for
|
||||||
testing and will often ask for this output in response to a request
|
testing and will often ask for this output in response to a request
|
||||||
for help.
|
for help.
|
||||||
|
|
||||||
|
@item -Z
|
||||||
|
@itemx --debug-time-stamps
|
||||||
|
Enable time stamps on debug output.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx --help
|
@itemx --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
|
@ -1913,6 +1922,10 @@ will use the verbose facility to print critical values useful for
|
||||||
testing and will often ask for this output in response to a request
|
testing and will often ask for this output in response to a request
|
||||||
for help.
|
for help.
|
||||||
|
|
||||||
|
@item -Z
|
||||||
|
@itemx --debug_time_stamps
|
||||||
|
Enable time stamps on debug output.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx --help
|
@itemx --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
|
@ -1923,6 +1936,7 @@ Show summary of these options and exit.
|
||||||
@item -V
|
@item -V
|
||||||
@itemx --version
|
@itemx --version
|
||||||
Show version of @command{rigctl} and exit.
|
Show version of @command{rigctl} and exit.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@quotation Note
|
@quotation Note
|
||||||
|
@ -2948,6 +2962,10 @@ will use the verbose facility to print critical values useful for
|
||||||
testing and will often ask for this output in response to a request
|
testing and will often ask for this output in response to a request
|
||||||
for help.
|
for help.
|
||||||
|
|
||||||
|
@item -Z
|
||||||
|
@itemx --debug-time-stamps
|
||||||
|
Enable time stamps on debug output.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx --help
|
@itemx --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
|
|
|
@ -2180,6 +2180,9 @@ rig_setting2idx HAMLIB_PARAMS((setting_t s));
|
||||||
extern HAMLIB_EXPORT(void)
|
extern HAMLIB_EXPORT(void)
|
||||||
rig_set_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level));
|
rig_set_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level));
|
||||||
|
|
||||||
|
extern HAMLIB_EXPORT(void)
|
||||||
|
rig_set_debug_time_stamp HAMLIB_PARAMS((int flag));
|
||||||
|
|
||||||
#define rig_set_debug_level(level) rig_set_debug(level)
|
#define rig_set_debug_level(level) rig_set_debug(level)
|
||||||
|
|
||||||
extern HAMLIB_EXPORT(int)
|
extern HAMLIB_EXPORT(int)
|
||||||
|
|
35
src/debug.c
35
src/debug.c
|
@ -42,6 +42,7 @@
|
||||||
#include <errno.h> /* Error number definitions */
|
#include <errno.h> /* Error number definitions */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
# include <android/log.h>
|
# include <android/log.h>
|
||||||
|
@ -54,6 +55,7 @@
|
||||||
|
|
||||||
|
|
||||||
static int rig_debug_level = RIG_DEBUG_TRACE;
|
static int rig_debug_level = RIG_DEBUG_TRACE;
|
||||||
|
static int rig_debug_time_stamp = 0;
|
||||||
static FILE *rig_debug_stream;
|
static FILE *rig_debug_stream;
|
||||||
static vprintf_cb_t rig_vprintf_cb;
|
static vprintf_cb_t rig_vprintf_cb;
|
||||||
static rig_ptr_t rig_vprintf_arg;
|
static rig_ptr_t rig_vprintf_arg;
|
||||||
|
@ -128,6 +130,30 @@ int HAMLIB_API rig_need_debug(enum rig_debug_level_e debug_level)
|
||||||
return (debug_level <= rig_debug_level);
|
return (debug_level <= rig_debug_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param debug_time_stamp
|
||||||
|
* \brief Enbable/disable time stamp on debug output
|
||||||
|
*/
|
||||||
|
void HAMLIB_API rig_set_debug_time_stamp(int flag)
|
||||||
|
{
|
||||||
|
rig_debug_time_stamp = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *date_strget(char *buf,int buflen)
|
||||||
|
{
|
||||||
|
time_t mytime;
|
||||||
|
struct tm *mytm;
|
||||||
|
struct timeval tv;
|
||||||
|
mytime=time(NULL);
|
||||||
|
mytm = gmtime(&mytime);
|
||||||
|
gettimeofday(&tv,NULL);
|
||||||
|
strftime(buf,buflen,"%Y-%m-%d:%H:%M:%S.",mytm);
|
||||||
|
char tmp[16];
|
||||||
|
sprintf(tmp,"%06ld",tv.tv_usec);
|
||||||
|
strcat(buf,tmp);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \param debug_level
|
* \param debug_level
|
||||||
|
@ -157,7 +183,10 @@ void HAMLIB_API rig_debug(enum rig_debug_level_e debug_level,
|
||||||
{
|
{
|
||||||
rig_debug_stream = stderr;
|
rig_debug_stream = stderr;
|
||||||
}
|
}
|
||||||
|
if (rig_debug_time_stamp) {
|
||||||
|
char buf[256];
|
||||||
|
fprintf(rig_debug_stream,"%s: ",date_strget(buf,sizeof(buf)));
|
||||||
|
}
|
||||||
vfprintf(rig_debug_stream, fmt, ap);
|
vfprintf(rig_debug_stream, fmt, ap);
|
||||||
fflush(rig_debug_stream);
|
fflush(rig_debug_stream);
|
||||||
}
|
}
|
||||||
|
@ -190,6 +219,10 @@ void HAMLIB_API rig_debug(enum rig_debug_level_e debug_level,
|
||||||
a = ANDROID_LOG_VERBOSE;
|
a = ANDROID_LOG_VERBOSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RIG_DEBUG_TIME:
|
||||||
|
a = ANDROID_LOG_VERBOSE;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
a = ANDROID_LOG_DEBUG;
|
a = ANDROID_LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -151,11 +151,15 @@ is not set, the value of HOME is used.
|
||||||
.B \-v, --verbose
|
.B \-v, --verbose
|
||||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||||
.TP
|
.TP
|
||||||
|
.B \-Z, --debug-time-stamps
|
||||||
|
Enable time stamps for the debug messages
|
||||||
|
.TP
|
||||||
.B \-h, --help
|
.B \-h, --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
.TP
|
.TP
|
||||||
.B \-V, --version
|
.B \-V, --version
|
||||||
Show version of \fBrigctl\fP and exit.
|
Show version of \fBrigctl\fP and exit.
|
||||||
|
.sp
|
||||||
.PP
|
.PP
|
||||||
\fBN.B.\fP Some options may not be implemented by a given backend and will
|
\fBN.B.\fP Some options may not be implemented by a given backend and will
|
||||||
return an error. This is most likely to occur with the \fI\-\-set-conf\fP
|
return an error. This is most likely to occur with the \fI\-\-set-conf\fP
|
||||||
|
|
|
@ -87,7 +87,7 @@ void usage(void);
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* 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:lC:LuonvhV"
|
#define SHORT_OPTIONS "+m:r:p:d:P:D:s:c:t:lC:LuonvhVZ"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -105,6 +105,7 @@ static struct option long_options[] =
|
||||||
{"dump-caps", 0, 0, 'u'},
|
{"dump-caps", 0, 0, 'u'},
|
||||||
{"vfo", 0, 0, 'o'},
|
{"vfo", 0, 0, 'o'},
|
||||||
{"no-restore-ai", 0, 0, 'n'},
|
{"no-restore-ai", 0, 0, 'n'},
|
||||||
|
{"debug-time-stamps",0, 0, 'Z'},
|
||||||
#ifdef HAVE_READLINE_HISTORY
|
#ifdef HAVE_READLINE_HISTORY
|
||||||
{"read-history", 0, 0, 'i'},
|
{"read-history", 0, 0, 'i'},
|
||||||
{"save-history", 0, 0, 'I'},
|
{"save-history", 0, 0, 'I'},
|
||||||
|
@ -399,6 +400,10 @@ int main(int argc, char *argv[])
|
||||||
dump_caps_opt++;
|
dump_caps_opt++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
rig_set_debug_time_stamp(1);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(); /* unknown option? */
|
usage(); /* unknown option? */
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -636,6 +641,7 @@ void usage(void)
|
||||||
" -I, --save-history save current interactive session history\n"
|
" -I, --save-history save current interactive session history\n"
|
||||||
#endif
|
#endif
|
||||||
" -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\n"
|
" -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\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"
|
||||||
" -V, --version output version information and exit\n\n"
|
" -V, --version output version information and exit\n\n"
|
||||||
);
|
);
|
||||||
|
|
|
@ -137,6 +137,9 @@ below.
|
||||||
.B \-v, --verbose
|
.B \-v, --verbose
|
||||||
Set verbose mode, cumulative (see \fIDIAGNOSTICS\fP below).
|
Set verbose mode, cumulative (see \fIDIAGNOSTICS\fP below).
|
||||||
.TP
|
.TP
|
||||||
|
.B \-Z, --debug-time-stamps
|
||||||
|
Enable time stamps for the debug messages
|
||||||
|
.TP
|
||||||
.B \-h, --help
|
.B \-h, --help
|
||||||
Show a summary of these options and exit.
|
Show a summary of these options and exit.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* 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:lLuovhV"
|
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:lLuovhVZ"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -106,6 +106,7 @@ static struct option long_options[] =
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
|
{"debug-time-stamps",0, 0, 'Z'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1020,6 +1021,7 @@ void usage(void)
|
||||||
" -u, --dump-caps dump capabilities and exit\n"
|
" -u, --dump-caps dump capabilities and exit\n"
|
||||||
" -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"
|
||||||
|
" -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"
|
||||||
" -V, --version output version information and exit\n\n",
|
" -V, --version output version information and exit\n\n",
|
||||||
portno);
|
portno);
|
||||||
|
|
|
@ -110,6 +110,9 @@ is not set, the value of HOME is used.
|
||||||
.B \-v, --verbose
|
.B \-v, --verbose
|
||||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||||
.TP
|
.TP
|
||||||
|
.B \-Z, --debug-time-stamps
|
||||||
|
Enable time stamps for the debug messages
|
||||||
|
.TP
|
||||||
.B \-h, --help
|
.B \-h, --help
|
||||||
Show summary of these options and exit.
|
Show summary of these options and exit.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -82,7 +82,7 @@ void usage();
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* 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:s:C:t:LvhVlu"
|
#define SHORT_OPTIONS "+m:r:s:C:t:LvhVluZ"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -93,6 +93,7 @@ static struct option long_options[] =
|
||||||
{"set-conf", 1, 0, 'C'},
|
{"set-conf", 1, 0, 'C'},
|
||||||
{"show-conf", 0, 0, 'L'},
|
{"show-conf", 0, 0, 'L'},
|
||||||
{"dump-caps", 0, 0, 'u'},
|
{"dump-caps", 0, 0, 'u'},
|
||||||
|
{"debug-time-stamps",0,0, 'Z'},
|
||||||
#ifdef HAVE_READLINE_HISTORY
|
#ifdef HAVE_READLINE_HISTORY
|
||||||
{"read-history", 0, 0, 'i'},
|
{"read-history", 0, 0, 'i'},
|
||||||
{"save-history", 0, 0, 'I'},
|
{"save-history", 0, 0, 'I'},
|
||||||
|
@ -258,6 +259,10 @@ int main(int argc, char *argv[])
|
||||||
dump_caps_opt++;
|
dump_caps_opt++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
rig_set_debug_time_stamp(1);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(); /* unknown option? */
|
usage(); /* unknown option? */
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -460,6 +465,7 @@ void usage()
|
||||||
" -I, --save-history save current interactive session history\n"
|
" -I, --save-history save current interactive session history\n"
|
||||||
#endif
|
#endif
|
||||||
" -v, --verbose set verbose mode, cumulative\n"
|
" -v, --verbose set verbose mode, cumulative\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"
|
||||||
" -V, --version output version information and exit\n\n"
|
" -V, --version output version information and exit\n\n"
|
||||||
);
|
);
|
||||||
|
|
|
@ -109,6 +109,9 @@ Dump capabilities for the rotator defined with -m above and exit.
|
||||||
.B \-v, --verbose
|
.B \-v, --verbose
|
||||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||||
.TP
|
.TP
|
||||||
|
.B \-Z, --debug-time-stamps
|
||||||
|
Enable time stamps for the debug messages
|
||||||
|
.TP
|
||||||
.B \-h, --help
|
.B \-h, --help
|
||||||
Show a summary of these options and exit.
|
Show a summary of these options and exit.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -84,7 +84,7 @@ void usage();
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* 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:s:C:t:T:LuvhVl"
|
#define SHORT_OPTIONS "m:r:s:C:t:T:LuvhVlZ"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -96,6 +96,7 @@ static struct option long_options[] =
|
||||||
{"set-conf", 1, 0, 'C'},
|
{"set-conf", 1, 0, 'C'},
|
||||||
{"show-conf", 0, 0, 'L'},
|
{"show-conf", 0, 0, 'L'},
|
||||||
{"dump-caps", 0, 0, 'u'},
|
{"dump-caps", 0, 0, 'u'},
|
||||||
|
{"debug-time-stamps",0, 0, 'Z'},
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
|
@ -279,6 +280,10 @@ int main(int argc, char *argv[])
|
||||||
dump_caps_opt++;
|
dump_caps_opt++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
rig_set_debug_time_stamp(1);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(); /* unknown option? */
|
usage(); /* unknown option? */
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -692,6 +697,7 @@ void usage()
|
||||||
" -l, --list list all model numbers and exit\n"
|
" -l, --list list all model numbers and exit\n"
|
||||||
" -u, --dump-caps dump capabilities and exit\n"
|
" -u, --dump-caps dump capabilities and exit\n"
|
||||||
" -v, --verbose set verbose mode, cumulative\n"
|
" -v, --verbose set verbose mode, cumulative\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"
|
||||||
" -V, --version output version information and exit\n\n",
|
" -V, --version output version information and exit\n\n",
|
||||||
portno);
|
portno);
|
||||||
|
|
Ładowanie…
Reference in New Issue