kopia lustrzana https://github.com/Hamlib/Hamlib
- allow litteral command for \move
- added dump-caps option to rotctl git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2895 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.11
rodzic
30f7124435
commit
ecda326342
|
@ -2,7 +2,7 @@
|
|||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH ROTCTL "1" "February 17, 2010" "Hamlib" "Rotator Control Program"
|
||||
.TH ROTCTL "1" "April 25, 2010" "Hamlib" "Rotator Control Program"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -74,6 +74,9 @@ Set config parameter. e.g. --set_conf=stop_bits=2
|
|||
.sp
|
||||
Use -L option for a list.
|
||||
.TP
|
||||
.B \-u, --dump-caps
|
||||
Dump capabilities for the rotor defined with -m above and exit.
|
||||
.TP
|
||||
.B \-l, --list
|
||||
List all model numbers defined in \fBHamlib\fP and exit.
|
||||
.TP
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/*
|
||||
* rotctl.c - (C) Stephane Fillod 2000-2009
|
||||
* rotctl.c - (C) Stephane Fillod 2000-2010
|
||||
*
|
||||
* This program test/control a rotator using Hamlib.
|
||||
* It takes commands in interactive mode as well as
|
||||
* from command line options.
|
||||
*
|
||||
* $Id: rotctl.c,v 1.14 2009-02-17 08:03:22 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -52,7 +50,7 @@ void usage();
|
|||
* NB: do NOT use -W since it's reserved by POSIX.
|
||||
* TODO: add an option to read from a file
|
||||
*/
|
||||
#define SHORT_OPTIONS "m:r:s:C:t:LvhVl"
|
||||
#define SHORT_OPTIONS "m:r:s:C:t:LvhVlu"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
|
@ -62,6 +60,7 @@ static struct option long_options[] =
|
|||
{"list", 0, 0, 'l'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"show-conf",0, 0, 'L'},
|
||||
{"dump-caps",0, 0, 'u'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
|
@ -85,6 +84,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
int verbose = 0;
|
||||
int show_conf = 0;
|
||||
int dump_caps_opt = 0;
|
||||
const char *rot_file=NULL;
|
||||
int serial_rate = 0;
|
||||
char conf_parms[MAXCONFLEN] = "";
|
||||
|
@ -154,6 +154,9 @@ int main (int argc, char *argv[])
|
|||
case 'l':
|
||||
list_models();
|
||||
exit(0);
|
||||
case 'u':
|
||||
dump_caps_opt++;
|
||||
break;
|
||||
default:
|
||||
usage(); /* unknown option? */
|
||||
exit(1);
|
||||
|
@ -202,6 +205,16 @@ int main (int argc, char *argv[])
|
|||
rot_token_foreach(my_rot, print_conf_list, (rig_ptr_t)my_rot);
|
||||
}
|
||||
|
||||
/*
|
||||
* print out capabilities, and exists immediately
|
||||
* We may be interested only in caps, and rig_open may fail.
|
||||
*/
|
||||
if (dump_caps_opt) {
|
||||
dumpcaps_rot(my_rot, stdout);
|
||||
rot_cleanup(my_rot); /* if you care about memory */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
retcode = rot_open(my_rot);
|
||||
if (retcode != RIG_OK) {
|
||||
fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode));
|
||||
|
@ -240,6 +253,7 @@ void usage()
|
|||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||
" -L, --show-conf list all config parameters\n"
|
||||
" -l, --list list all model numbers and exit\n"
|
||||
" -u, --dump-caps dump capabilities and exit\n"
|
||||
" -v, --verbose set verbose mode, cumulative\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
" -V, --version output version information and exit\n\n"
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/*
|
||||
* rotctl.c - (C) Stephane Fillod 2000-2010
|
||||
* rotctl_parse.c - (C) Stephane Fillod 2000-2010
|
||||
*
|
||||
* This program test/control a rotator using Hamlib.
|
||||
* It takes commands in interactive mode as well as
|
||||
* from command line options.
|
||||
*
|
||||
* $Id: rotctl_parse.c,v 1.5 2009-01-04 14:49:17 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -392,7 +390,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
|
||||
if (!prompt)
|
||||
rig_debug(RIG_DEBUG_TRACE, "rotctl(d): %c '%s' '%s' '%s' '%s'\n",
|
||||
cmd, p1, p2, p3, p4);
|
||||
cmd, p1?p1:"", p2?p2:"", p3?p3:"", p4?p4:"");
|
||||
|
||||
/*
|
||||
* Extended Response protocol: output received command name and arguments
|
||||
|
@ -637,7 +635,20 @@ declare_proto_rot(move)
|
|||
int direction;
|
||||
int speed;
|
||||
|
||||
CHKSCN1ARG(sscanf(arg1, "%d", &direction));
|
||||
if (!strcmp(arg1, "LEFT") || !strcmp(arg1, "CCW"))
|
||||
direction = ROT_MOVE_LEFT;
|
||||
else
|
||||
if (!strcmp(arg1, "RIGHT") || !strcmp(arg1, "CW"))
|
||||
direction = ROT_MOVE_RIGHT;
|
||||
else
|
||||
if (!strcmp(arg1, "UP"))
|
||||
direction = ROT_MOVE_UP;
|
||||
else
|
||||
if (!strcmp(arg1, "DOWN"))
|
||||
direction = ROT_MOVE_DOWN;
|
||||
else
|
||||
CHKSCN1ARG(sscanf(arg1, "%d", &direction));
|
||||
|
||||
CHKSCN1ARG(sscanf(arg2, "%d", &speed));
|
||||
return rot_move(rot, direction, speed);
|
||||
}
|
||||
|
@ -646,11 +657,11 @@ declare_proto_rot(move)
|
|||
declare_proto_rot(inter_set_conf)
|
||||
{
|
||||
token_t token;
|
||||
char val[21] = ""; /* 20 chars enough? */
|
||||
|
||||
CHKSCN1ARG(sscanf(arg1, "%ld", &token));
|
||||
CHKSCN1ARG(sscanf(arg2, "%s", val));
|
||||
return rot_set_conf(rot, token, val);
|
||||
if (!arg2 || arg2[0] == '\0')
|
||||
return -RIG_EINVAL;
|
||||
return rot_set_conf(rot, token, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue