kopia lustrzana https://github.com/Hamlib/Hamlib
Improve kenwood.c debug a little bit to reduce confusion
https://github.com/Hamlib/Hamlib/issues/1298pull/1301/head
rodzic
ece6a7ae1a
commit
4832cc1bb2
|
@ -246,9 +246,16 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data,
|
||||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
struct rig_state *rs;
|
struct rig_state *rs;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called cmd=%s datasize=%d\n", __func__,
|
if (datasize > 0 && datasize < strlen(cmdstr)) {
|
||||||
|
rig_debug(RIG_DEBUG_WARN, "%s called cmd=%s datasize=%d, datasize < cmd length?\n", __func__,
|
||||||
cmdstr ? cmdstr : "(NULL)",
|
cmdstr ? cmdstr : "(NULL)",
|
||||||
(int)datasize);
|
(int)datasize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called cmd=%s\n", __func__,
|
||||||
|
cmdstr ? cmdstr : "(NULL)");
|
||||||
|
}
|
||||||
|
|
||||||
if ((!cmdstr && !datasize) || (datasize && !data))
|
if ((!cmdstr && !datasize) || (datasize && !data))
|
||||||
{
|
{
|
||||||
|
@ -385,13 +392,15 @@ transaction_write:
|
||||||
|
|
||||||
transaction_read:
|
transaction_read:
|
||||||
/* allow room for most any response */
|
/* allow room for most any response */
|
||||||
|
// this len/expected stuff is confusing -- logic in some places includes the semicolon
|
||||||
|
// so we add 1 to our read_string length to cover these cases
|
||||||
|
// eventually we should be able to get rid of this but requires testing all Kenwood rigs
|
||||||
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
|
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
|
||||||
KENWOOD_MAX_BUF_LEN);
|
KENWOOD_MAX_BUF_LEN);
|
||||||
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
|
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
|
||||||
cmdtrm_str, strlen(cmdtrm_str), 0, 1);
|
cmdtrm_str, strlen(cmdtrm_str), 0, 1);
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string(expected=%d, len=%d)='%s'\n",
|
rig_debug(RIG_DEBUG_TRACE, "%s: read_string len=%d '%s'\n", __func__,
|
||||||
__func__,
|
(int)strlen(buffer), buffer);
|
||||||
len, (int)strlen(buffer), buffer);
|
|
||||||
|
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
{
|
{
|
||||||
|
@ -1253,7 +1262,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: checking satellite mode status\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: checking satellite mode status\n", __func__);
|
||||||
SNPRINTF(cmdbuf, sizeof(cmdbuf), "SA");
|
SNPRINTF(cmdbuf, sizeof(cmdbuf), "SA");
|
||||||
|
|
||||||
retval = kenwood_transaction(rig, cmdbuf, retbuf, 20);
|
retval = kenwood_transaction(rig, cmdbuf, retbuf, 4);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue