diff --git a/dummy/dummy.c b/dummy/dummy.c index 4f8e2e332..4591c6d3f 100644 --- a/dummy/dummy.c +++ b/dummy/dummy.c @@ -1873,7 +1873,7 @@ static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower, .ext_levels = 1, \ } -const struct rig_caps dummy_caps = +struct rig_caps dummy_caps = { RIG_MODEL(RIG_MODEL_DUMMY), .model_name = "Dummy", diff --git a/dummy/dummy.h b/dummy/dummy.h index 1afed1130..b3422845f 100644 --- a/dummy/dummy.h +++ b/dummy/dummy.h @@ -38,8 +38,8 @@ #define TOK_EL_MAGICCOMBO TOKEN_BACKEND(5) -extern const struct rig_caps dummy_caps; -extern const struct rig_caps netrigctl_caps; +extern struct rig_caps dummy_caps; +extern struct rig_caps netrigctl_caps; extern const struct rig_caps flrig_caps; extern const struct rig_caps trxmanager_caps; diff --git a/dummy/netrigctl.c b/dummy/netrigctl.c index bb4604e9b..6a0f31587 100644 --- a/dummy/netrigctl.c +++ b/dummy/netrigctl.c @@ -503,6 +503,47 @@ static int netrigctl_open(RIG *rig) rs->vfo_list |= rs->tx_range_list[i].vfo; } + if (prot_ver == 0) { return RIG_OK; } + + // otherwise we continue reading protocol 1 fields + + + do + { + char setting[32], value[256]; + ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + strtok(buf, "\r\n"); // chop the EOL + + if (ret <= 0) + { + return (ret < 0) ? ret : -RIG_EPROTO; + } + + if (strncmp(buf, "done", 4) == 0) { return RIG_OK; } + + if (sscanf(buf, "%[^=]=%[^\t\n]", setting, value) == 2) + { + if (strcmp(setting, "vfo_ops") == 0) + { + rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %s\n", __func__, setting, value); + rig->caps->vfo_ops = strtol(value, NULL, 0); + } + else + { + rig_debug(RIG_DEBUG_ERR, "%s: unknown setting='%s'\n", __func__, buf); + } + } + else + { + rig_debug(RIG_DEBUG_ERR, + "%s: invalid dumpcaps line, expected 'setting=value', got '%s'\n", __func__, + buf); + } + + + } + while (1); + return RIG_OK; } @@ -2105,7 +2146,7 @@ static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg) * Netrigctl rig capabilities. */ -const struct rig_caps netrigctl_caps = +struct rig_caps netrigctl_caps = { RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index cc4715591..f3798eafa 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -1063,7 +1063,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, return 0; } - rig_debug(RIG_DEBUG_BUG, "%s: input_line: %s\n", __func__, input_line); + rig_debug(RIG_DEBUG_TRACE, "%s: input_line: %s\n", __func__, input_line); /* Split input_line on any number of spaces to get the command token * Tabs are intercepted by readline for completion and a newline @@ -3888,7 +3888,7 @@ declare_proto_rig(dump_state) /* * - Protocol version */ -#define RIGCTLD_PROT_VER 0 +#define RIGCTLD_PROT_VER 1 fprintf(fout, "%d\n", RIGCTLD_PROT_VER); fprintf(fout, "%d\n", rig->caps->rig_model); fprintf(fout, "%d\n", rs->itu_region); @@ -3973,7 +3973,13 @@ declare_proto_rig(dump_state) fprintf(fout, "0x%"PRXll"\n", rs->has_get_parm); fprintf(fout, "0x%"PRXll"\n", rs->has_set_parm); -#if 0 + // protocol 1 fields are "setting=value" + // protocol 1 allows fields can be listed/processed in any order + // protocol 1 fields can be multi-line -- just write the thing to allow for it + fprintf(fout, "vfo_ops=0x%"PRXll"\n", (unsigned long)rig->caps->vfo_ops); + fprintf(fout, "done\n"); + +#if 0 // why isn't this implemented? Does anybody care? gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */ #endif