From 25ee5d65d592e80f7471806c2959ded06ece1b69 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Wed, 28 Feb 2024 17:30:41 -0600 Subject: [PATCH] Fix rigctld vfo_ops https://github.com/Hamlib/Hamlib/issues/1518 --- rigs/dummy/netrigctl.c | 19 ++++++++++++------- rigs/yaesu/ft991.c | 2 +- tests/rigctl_parse.c | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 394a7e2f3..04ceb0b81 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -635,6 +635,7 @@ static int netrigctl_open(RIG *rig) ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1); strtok(buf, "\r\n"); // chop the EOL +rig_debug(RIG_DEBUG_ERR, "## %s\n", buf); if (ret <= 0) { RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO); @@ -646,7 +647,7 @@ static int netrigctl_open(RIG *rig) { if (strcmp(setting, "vfo_ops") == 0) { - rig->caps->vfo_ops = strtoll(value, NULL, 0); + rig->caps->vfo_ops = rig->state.vfo_ops = strtoll(value, NULL, 0); rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting, rig->caps->vfo_ops); } @@ -664,7 +665,7 @@ static int netrigctl_open(RIG *rig) * locally overridden it */ pttp->type.ptt = RIG_PTT_RIG_MICDATA; - rig->caps->ptt_type = RIG_PTT_RIG_MICDATA; + rig->caps->ptt_type = rig->state.ptt_type = RIG_PTT_RIG_MICDATA; rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting, pttp->type.ptt); } @@ -672,13 +673,13 @@ static int netrigctl_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp); pttp->type.ptt = temp; - rig->caps->ptt_type = temp; + rig->caps->ptt_type = rig->state.ptt_type = temp; } } else if (strcmp(setting, "targetable_vfo") == 0) { - rig->caps->targetable_vfo = strtol(value, NULL, 0); + rig->caps->targetable_vfo = rig->state.targetable_vfo = strtol(value, NULL, 0); rig_debug(RIG_DEBUG_VERBOSE, "%s: targetable_vfo=0x%2x\n", __func__, rig->caps->targetable_vfo); } @@ -862,7 +863,7 @@ static int netrigctl_open(RIG *rig) int level; sscanf(p, "%d", &level); - if (RIG_LEVEL_IS_FLOAT(level)) + if (RIG_PARM_IS_FLOAT(level)) { double min, max, step; sscanf(p, "%*d=%lf,%lf,%lf", &min, &max, &step); @@ -870,7 +871,11 @@ static int netrigctl_open(RIG *rig) rig->caps->parm_gran[i].max.f = rs->parm_gran[i].max.f = max; rig->caps->parm_gran[i].step.f = rs->parm_gran[i].step.f = step; } - else + else if (RIG_PARM_IS_STRING(level)) + { + rig->caps->parm_gran[i].step.s = strdup(value); + } + else // must be INT { int min, max, step; sscanf(p, "%*d=%d,%d,%d", &min, &max, &step); @@ -2807,7 +2812,7 @@ struct rig_caps netrigctl_caps = RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", .mfg_name = "Hamlib", - .version = "20231229.0", + .version = "20240226.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index 75916e210..47d9d484f 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -206,7 +206,7 @@ struct rig_caps ft991_caps = [LVL_RFPOWER] = { .min = { .f = .05 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } }, }, .parm_gran = { - [PARM_BANDSELECT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.s = "BAND160M,BAND80M,BANDUNUSED,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN,BANDMW,BANDUNUSED,BANDAIR,BAND70CM,BAND33CM"}} + [PARM_BANDSELECT] = {.step = {.s = "BAND160M,BAND80M,BANDUNUSED,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN,BANDMW,BANDUNUSED,BANDAIR,BAND70CM,BAND33CM"}} }, .ctcss_list = common_ctcss_list, diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index daf817492..e1a0e0d15 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3919,7 +3919,7 @@ declare_proto_rig(vfo_op) if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; - rig_sprintf_vfop(s, sizeof(s), rig->caps->vfo_ops); + rig_sprintf_vfop(s, sizeof(s), rig->state.vfo_ops); fprintf(fout, "%s\n", s); RETURNFUNC2(RIG_OK); }