Fix debug statement and allow read_string error to retry in flrig.c

pull/224/head
Michael Black W9MDB 2020-04-21 07:56:00 -05:00
rodzic ff79dc800c
commit 8e1f6c9fc1
2 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -409,14 +409,15 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
char tmp_buf[MAXXMLLEN]; // plenty big for expected flrig responses hopefully char tmp_buf[MAXXMLLEN]; // plenty big for expected flrig responses hopefully
int len = read_string(&rs->rigport, tmp_buf, sizeof(tmp_buf), delims, int len = read_string(&rs->rigport, tmp_buf, sizeof(tmp_buf), delims,
strlen(delims)); strlen(delims));
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'", __func__, tmp_buf); rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
if (len > 0) { retry = 3; } if (len > 0) { retry = 3; }
if (len <= 0) if (len <= 0)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: read_string error=%d\n", __func__, len); rig_debug(RIG_DEBUG_ERR, "%s: read_string error=%d\n", __func__, len);
return -(100 + RIG_EPROTO); //return -(100 + RIG_EPROTO);
continue;
} }
if (strlen(xml) + strlen(tmp_buf) < xml_len - 1) if (strlen(xml) + strlen(tmp_buf) < xml_len - 1)
@ -436,6 +437,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
if (retry == 0) if (retry == 0)
{ {
rig_debug(RIG_DEBUG_WARN, "%s: retry timeout\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s: retry timeout\n", __func__);
return -RIG_ETIMEOUT;
} }
if (strstr(xml, terminator)) if (strstr(xml, terminator))
@ -1464,7 +1466,9 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return retval; return retval;
} }
read_transaction(rig, xml, sizeof(xml)); retval = read_transaction(rig, xml, sizeof(xml));
if (retval < 0) {
}
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
retval = modeMapGetHamlib(value); retval = modeMapGetHamlib(value);

Wyświetl plik

@ -28,7 +28,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "20200319" #define BACKEND_VER "20200421"
#define EOM "\r" #define EOM "\r"
#define TRUE 1 #define TRUE 1