kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
93af897753
commit
71f8b3b8c9
|
@ -85,28 +85,7 @@ DECLARE_PROBERIG_BACKEND(anytone)
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
retval = RIG_MODEL_NONE;
|
retval = -RIG_EIO;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char acBuf[ ANYTONE_RESPSZ + 1 ];
|
|
||||||
int nRead = 0;
|
|
||||||
|
|
||||||
memset(acBuf, 0, ANYTONE_RESPSZ + 1);
|
|
||||||
|
|
||||||
close(port->fd);
|
|
||||||
|
|
||||||
if ((retval != RIG_OK || nRead < 0))
|
|
||||||
{
|
|
||||||
retval = RIG_MODEL_NONE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "Received ID = %s.",
|
|
||||||
acBuf);
|
|
||||||
|
|
||||||
retval = RIG_MODEL_ADT_200A;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "hamlib/rig.h"
|
#include "hamlib/rig.h"
|
||||||
|
|
||||||
#define BACKEND_VER "20230530"
|
#define BACKEND_VER "20231001"
|
||||||
|
|
||||||
#define ANYTONE_RESPSZ 64
|
#define ANYTONE_RESPSZ 64
|
||||||
|
|
||||||
|
|
|
@ -1275,13 +1275,19 @@ static int thd72_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||||
static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
|
int n;
|
||||||
char c;
|
char c;
|
||||||
const char *data;
|
const char *data;
|
||||||
|
|
||||||
if (kind == 0) { data = buf + 5; }
|
if (kind == 0) { data = buf + 5; }
|
||||||
else { data = buf + 7; }
|
else { data = buf + 7; }
|
||||||
|
|
||||||
sscanf(data, "%"SCNfreq, &chan->freq);
|
n = sscanf(data, "%"SCNfreq, &chan->freq);
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error scanning %s\n", __func__, data);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
c = data[46]; // mode
|
c = data[46]; // mode
|
||||||
|
|
||||||
if (c >= '0' && c <= '2')
|
if (c >= '0' && c <= '2')
|
||||||
|
@ -1304,12 +1310,22 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||||
chan->rptr_shift = thd72_rshf_table[c - '0'];
|
chan->rptr_shift = thd72_rshf_table[c - '0'];
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf(data + 37, "%ld", &chan->rptr_offs);
|
n = sscanf(data + 37, "%ld", &chan->rptr_offs);
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[37]%s\n", __func__, data);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
c = data[17]; // Tone status
|
c = data[17]; // Tone status
|
||||||
|
|
||||||
if (c != '0')
|
if (c != '0')
|
||||||
{
|
{
|
||||||
sscanf(data + 25, "%d", &tmp);
|
n = sscanf(data + 25, "%d", &tmp);
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[25]%s\n", __func__, data);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
if (tmp > 0 && tmp < 42)
|
if (tmp > 0 && tmp < 42)
|
||||||
{
|
{
|
||||||
|
@ -1325,7 +1341,12 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||||
|
|
||||||
if (c != '0')
|
if (c != '0')
|
||||||
{
|
{
|
||||||
sscanf(data + 28, "%d", &tmp);
|
n = sscanf(data + 28, "%d", &tmp);
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[28]%s\n", __func__, data);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
if (tmp > 0 && tmp < 42)
|
if (tmp > 0 && tmp < 42)
|
||||||
{
|
{
|
||||||
|
@ -1341,7 +1362,12 @@ static int thd72_parse_channel(int kind, const char *buf, channel_t *chan)
|
||||||
|
|
||||||
if (c != '0')
|
if (c != '0')
|
||||||
{
|
{
|
||||||
sscanf(data + 31, "%d", &tmp);
|
n = sscanf(data + 31, "%d", &tmp);
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error scanning data[31]%s\n", __func__, data);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
chan->dcs_code = tmp;
|
chan->dcs_code = tmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Ładowanie…
Reference in New Issue