check for memory support

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2724 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.10
Stéphane Fillod, F8CFE 2009-09-14 07:27:58 +00:00
rodzic 24078ca7dd
commit eaf810ea3a
2 zmienionych plików z 22 dodań i 2 usunięć

Wyświetl plik

@ -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 RIGMEM "1" "February 24, 2007" "Hamlib" "Radio Memory Operations" .TH RIGMEM "1" "September 13, 2009" "Hamlib" "Radio Memory Operations"
.\" 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:
@ -130,6 +130,9 @@ library development and may be requested by the developers.
1 if there was an invalid command line option or argument; 1 if there was an invalid command line option or argument;
.br .br
2 if an error was returned by \fBHamlib\fP. 2 if an error was returned by \fBHamlib\fP.
.br
3 the \fBHamlib\fP backend has no memory support implemented and/or
the rig has no memory access available.
.SH BUGS .SH BUGS
This empty section... This empty section...
.SH REPORTING BUGS .SH REPORTING BUGS

Wyświetl plik

@ -1,5 +1,6 @@
/* /*
* rigmem.c - (C) Stephane Fillod and Thierry Leconte 2003-2005 * rigmem.c - (C) Thierry Leconte 2003-2005
* (C) Stephane Fillod 2003-2009
* *
* This program exercises the backup and restore of a radio * This program exercises the backup and restore of a radio
* using Hamlib. * using Hamlib.
@ -212,6 +213,22 @@ int main (int argc, char *argv[])
exit(2); exit(2);
} }
/* check channel support */
if (rig->caps->set_channel == NULL && rig->caps->get_channel == NULL &&
rig->caps->set_chan_all_cb == NULL && rig->caps->get_chan_all_cb == NULL &&
(rig->caps->set_mem == NULL || rig->caps->set_vfo == NULL)) {
fprintf(stderr, "Error: rig num %d has no memory support implemented/available.\n",
my_model);
exit(3);
}
/* check channel description */
if (rig->caps->chan_list[0].type == 0) {
fprintf(stderr, "Error: rig num %d has no channel list.\n",
my_model);
exit(3);
}
if (rig_file) if (rig_file)
strncpy(rig->state.rigport.pathname, rig_file, FILPATHLEN); strncpy(rig->state.rigport.pathname, rig_file, FILPATHLEN);