diff --git a/rigs/dummy/aclog.c b/rigs/dummy/aclog.c index 8baeef075..3b9fb4cef 100644 --- a/rigs/dummy/aclog.c +++ b/rigs/dummy/aclog.c @@ -19,6 +19,7 @@ * */ +#include #include #include #include @@ -421,9 +422,14 @@ static rmode_t modeMapGetHamlib(const char *modeACLog) /* * aclog_get_freq * Assumes rig!=NULL, STATE(rig)->priv!=NULL, freq!=NULL +* +* string='23SSBPH1,296.171100 ' */ static int aclog_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { + int i, j = 0; + char f_string[32]; + char value[MAXARGLEN]; struct aclog_priv_data *priv = (struct aclog_priv_data *) STATE(rig)->priv; @@ -461,7 +467,30 @@ static int aclog_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) char *p = strstr(value, ""); *freq = 0; - if (p) { sscanf(p, "%'lf", freq); } + if (p) + { + // Move the pointer to the first digit. + p += strlen(""); + + // Parse "1,296.171100" ignoring the comma. + for (i = 0; p[i] != '<'; i++) + { + if (isdigit(p[i])) + { + f_string[j++] = p[i]; + } + else if (ispunct(p[i]) && p[i] == '.') + { + f_string[j++] = p[i]; + } + } + + f_string[j] = '\0'; + rig_debug(RIG_DEBUG_TRACE, "%s: f_string=%s\n", __func__, f_string); + + *freq = strtold(f_string, NULL); + rig_debug(RIG_DEBUG_TRACE, "%s: freq=%.0f\n", __func__, *freq); + } *freq *= 1e6; // convert from MHz to Hz