fix segfault and allow mode listing in rigctl

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2865 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.11
Stéphane Fillod, F8CFE 2010-04-05 10:01:09 +00:00
rodzic a74bc53452
commit 453995e7c0
4 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -13,3 +13,9 @@ Here is the list of the brave fellows:
* Chuck Hemker N2POR, v1.1.3, 09/2002, src/event.c * Chuck Hemker N2POR, v1.1.3, 09/2002, src/event.c
when using rig_set_trn() and receiving a SIGIO, when using rig_set_trn() and receiving a SIGIO,
and having a second non serial rig open. and having a second non serial rig open.
* Roeland Th. Jansen PA3MET, v1.2.10, 03/2010, tests/rigctl_parse.c
$ rigctl
Rig command: M
Mode: ?

Wyświetl plik

@ -1431,6 +1431,7 @@ struct rig_state {
rmode_t current_mode; /*!< Mode currently set */ rmode_t current_mode; /*!< Mode currently set */
pbwidth_t current_width; /*!< Passband width currently set */ pbwidth_t current_width; /*!< Passband width currently set */
vfo_t tx_vfo; /*!< Tx VFO currently set */ vfo_t tx_vfo; /*!< Tx VFO currently set */
int mode_list; /*!< Complete list of modes for this rig */
}; };

Wyświetl plik

@ -1,6 +1,6 @@
/* /*
* Hamlib Interface - main file * Hamlib Interface - main file
* Copyright (c) 2000-2009 by Stephane Fillod * Copyright (c) 2000-2010 by Stephane Fillod
* Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2003 by Frank Singleton
* *
* $Id: rig.c,v 1.103 2009-02-20 14:14:31 fillods Exp $ * $Id: rig.c,v 1.103 2009-02-20 14:14:31 fillods Exp $
@ -31,7 +31,7 @@
* \brief Ham Radio Control Libraries interface * \brief Ham Radio Control Libraries interface
* \author Stephane Fillod * \author Stephane Fillod
* \author Frank Singleton * \author Frank Singleton
* \date 2000-2009 * \date 2000-2010
* *
* Hamlib provides a user-callable API, a set of "front-end" routines that * Hamlib provides a user-callable API, a set of "front-end" routines that
* call rig-specific "back-end" routines which actually communicate with * call rig-specific "back-end" routines which actually communicate with
@ -83,7 +83,7 @@ const char hamlib_version[21] = "Hamlib " PACKAGE_VERSION;
* \brief Hamlib copyright notice * \brief Hamlib copyright notice
*/ */
const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */
"Copyright (C) 2000-2009 Stephane Fillod\n" "Copyright (C) 2000-2010 Stephane Fillod\n"
"Copyright (C) 2000-2003 Frank Singleton\n" "Copyright (C) 2000-2003 Frank Singleton\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.";
@ -344,11 +344,14 @@ RIG * HAMLIB_API rig_init(rig_model_t rig_model)
} }
rs->vfo_list = 0; rs->vfo_list = 0;
rs->mode_list = 0;
for (i=0; i<FRQRANGESIZ && !RIG_IS_FRNG_END(rs->rx_range_list[i]); i++) { for (i=0; i<FRQRANGESIZ && !RIG_IS_FRNG_END(rs->rx_range_list[i]); i++) {
rs->vfo_list |= rs->rx_range_list[i].vfo; rs->vfo_list |= rs->rx_range_list[i].vfo;
rs->mode_list |= rs->rx_range_list[i].modes;
} }
for (i=0; i<FRQRANGESIZ && !RIG_IS_FRNG_END(rs->tx_range_list[i]); i++) { for (i=0; i<FRQRANGESIZ && !RIG_IS_FRNG_END(rs->tx_range_list[i]); i++) {
rs->vfo_list |= rs->tx_range_list[i].vfo; rs->vfo_list |= rs->tx_range_list[i].vfo;
rs->mode_list |= rs->tx_range_list[i].modes;
} }
memcpy(rs->preamp, caps->preamp, sizeof(int)*MAXDBLSTSIZ); memcpy(rs->preamp, caps->preamp, sizeof(int)*MAXDBLSTSIZ);

Wyświetl plik

@ -752,14 +752,13 @@ declare_proto_rig(set_mode)
rmode_t mode; rmode_t mode;
pbwidth_t width; pbwidth_t width;
#if 0
if (!strcmp(arg1, "?")) { if (!strcmp(arg1, "?")) {
char s[SPRINTF_MAX_SIZE]; char s[SPRINTF_MAX_SIZE];
sprintf_mode(s, rig->state.modes); sprintf_mode(s, rig->state.mode_list);
fprintf(fout, "%s\n", s); fprintf(fout, "%s\n", s);
return RIG_OK; return RIG_OK;
} }
#endif
mode = rig_parse_mode(arg1); mode = rig_parse_mode(arg1);
sscanf(arg2, "%ld", &width); sscanf(arg2, "%ld", &width);
return rig_set_mode(rig, vfo, mode, width); return rig_set_mode(rig, vfo, mode, width);
@ -1031,14 +1030,13 @@ declare_proto_rig(set_split_mode)
int width; int width;
vfo_t txvfo = RIG_VFO_TX; vfo_t txvfo = RIG_VFO_TX;
#if 0
if (!strcmp(arg1, "?")) { if (!strcmp(arg1, "?")) {
char s[SPRINTF_MAX_SIZE]; char s[SPRINTF_MAX_SIZE];
sprintf_mode(s, rig->state.modes); sprintf_mode(s, rig->state.mode_list);
fprintf(fout, "%s\n", s); fprintf(fout, "%s\n", s);
return RIG_OK; return RIG_OK;
} }
#endif
mode = rig_parse_mode(arg1); mode = rig_parse_mode(arg1);
sscanf(arg2, "%d", &width); sscanf(arg2, "%d", &width);
return rig_set_split_mode(rig, txvfo, mode, (pbwidth_t) width); return rig_set_split_mode(rig, txvfo, mode, (pbwidth_t) width);