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
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" 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.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
|
@ -74,6 +74,9 @@ Set config parameter. e.g. --set_conf=stop_bits=2
|
||||||
.sp
|
.sp
|
||||||
Use -L option for a list.
|
Use -L option for a list.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-u, --dump-caps
|
||||||
|
Dump capabilities for the rotor defined with -m above and exit.
|
||||||
|
.TP
|
||||||
.B \-l, --list
|
.B \-l, --list
|
||||||
List all model numbers defined in \fBHamlib\fP and exit.
|
List all model numbers defined in \fBHamlib\fP and exit.
|
||||||
.TP
|
.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.
|
* This program test/control a rotator using Hamlib.
|
||||||
* It takes commands in interactive mode as well as
|
* It takes commands in interactive mode as well as
|
||||||
* from command line options.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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.
|
* 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:LvhVl"
|
#define SHORT_OPTIONS "m:r:s:C:t:LvhVlu"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -62,6 +60,7 @@ static struct option long_options[] =
|
||||||
{"list", 0, 0, 'l'},
|
{"list", 0, 0, 'l'},
|
||||||
{"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'},
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
|
@ -85,6 +84,7 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int show_conf = 0;
|
int show_conf = 0;
|
||||||
|
int dump_caps_opt = 0;
|
||||||
const char *rot_file=NULL;
|
const char *rot_file=NULL;
|
||||||
int serial_rate = 0;
|
int serial_rate = 0;
|
||||||
char conf_parms[MAXCONFLEN] = "";
|
char conf_parms[MAXCONFLEN] = "";
|
||||||
|
@ -154,6 +154,9 @@ int main (int argc, char *argv[])
|
||||||
case 'l':
|
case 'l':
|
||||||
list_models();
|
list_models();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
case 'u':
|
||||||
|
dump_caps_opt++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(); /* unknown option? */
|
usage(); /* unknown option? */
|
||||||
exit(1);
|
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);
|
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);
|
retcode = rot_open(my_rot);
|
||||||
if (retcode != RIG_OK) {
|
if (retcode != RIG_OK) {
|
||||||
fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode));
|
fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode));
|
||||||
|
@ -240,6 +253,7 @@ void usage()
|
||||||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||||
" -L, --show-conf list all config parameters\n"
|
" -L, --show-conf list all config parameters\n"
|
||||||
" -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"
|
||||||
" -v, --verbose set verbose mode, cumulative\n"
|
" -v, --verbose set verbose mode, cumulative\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"
|
||||||
|
|
|
@ -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.
|
* This program test/control a rotator using Hamlib.
|
||||||
* It takes commands in interactive mode as well as
|
* It takes commands in interactive mode as well as
|
||||||
* from command line options.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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)
|
if (!prompt)
|
||||||
rig_debug(RIG_DEBUG_TRACE, "rotctl(d): %c '%s' '%s' '%s' '%s'\n",
|
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
|
* Extended Response protocol: output received command name and arguments
|
||||||
|
@ -637,7 +635,20 @@ declare_proto_rot(move)
|
||||||
int direction;
|
int direction;
|
||||||
int speed;
|
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));
|
CHKSCN1ARG(sscanf(arg2, "%d", &speed));
|
||||||
return rot_move(rot, direction, speed);
|
return rot_move(rot, direction, speed);
|
||||||
}
|
}
|
||||||
|
@ -646,11 +657,11 @@ declare_proto_rot(move)
|
||||||
declare_proto_rot(inter_set_conf)
|
declare_proto_rot(inter_set_conf)
|
||||||
{
|
{
|
||||||
token_t token;
|
token_t token;
|
||||||
char val[21] = ""; /* 20 chars enough? */
|
|
||||||
|
|
||||||
CHKSCN1ARG(sscanf(arg1, "%ld", &token));
|
CHKSCN1ARG(sscanf(arg1, "%ld", &token));
|
||||||
CHKSCN1ARG(sscanf(arg2, "%s", val));
|
if (!arg2 || arg2[0] == '\0')
|
||||||
return rot_set_conf(rot, token, val);
|
return -RIG_EINVAL;
|
||||||
|
return rot_set_conf(rot, token, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue