kopia lustrzana https://github.com/Hamlib/Hamlib
Fix segfault for Kenwood L MICGAIN
Fix potential segfault in iofunc.c when stopset is nullpull/1410/head
rodzic
e0fa354d3a
commit
192822417b
|
@ -2861,7 +2861,7 @@ static int kenwood_get_micgain_minmax(RIG *rig, int *micgain_now,
|
||||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||||
|
|
||||||
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf),
|
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf),
|
||||||
NULL, 0, 0, 1);
|
NULL, ";", 1, 1);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
|
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "idx_builtin.h"
|
#include "idx_builtin.h"
|
||||||
|
|
||||||
#define BACKEND_VER "20231011"
|
#define BACKEND_VER "20231023"
|
||||||
|
|
||||||
#define EOM_KEN ';'
|
#define EOM_KEN ';'
|
||||||
#define EOM_TH '\r'
|
#define EOM_TH '\r'
|
||||||
|
|
|
@ -32,6 +32,7 @@ int width_low = 0;
|
||||||
int afgain = 50;
|
int afgain = 50;
|
||||||
int usb_af = 5;
|
int usb_af = 5;
|
||||||
int usb_af_input = 2;
|
int usb_af_input = 2;
|
||||||
|
int mic_gain = 50;
|
||||||
|
|
||||||
int
|
int
|
||||||
getmyline(int fd, char *buf)
|
getmyline(int fd, char *buf)
|
||||||
|
@ -153,8 +154,12 @@ int main(int argc, char *argv[])
|
||||||
else if (strcmp(buf, "MG;") == 0)
|
else if (strcmp(buf, "MG;") == 0)
|
||||||
{
|
{
|
||||||
hl_usleep(mysleep * 1000);
|
hl_usleep(mysleep * 1000);
|
||||||
pbuf = "MG050;";
|
SNPRINTF(buf, sizeof(buf), "MG%03d;", mic_gain);
|
||||||
WRITE(fd, pbuf, strlen(pbuf));
|
WRITE(fd, buf, strlen(buf));
|
||||||
|
}
|
||||||
|
else if (strncmp(buf, "MG", 2) == 0)
|
||||||
|
{
|
||||||
|
sscanf(buf,"MG%d", &mic_gain);
|
||||||
}
|
}
|
||||||
else if (strcmp(buf, "AG0;") == 0)
|
else if (strcmp(buf, "AG0;") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1427,7 +1427,7 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
// direct);
|
// direct);
|
||||||
}
|
}
|
||||||
// special read for FLRig
|
// special read for FLRig
|
||||||
if (strcmp(stopset, "</methodResponse>") == 0)
|
if (stopset != NULL && strcmp(stopset, "</methodResponse>") == 0)
|
||||||
{
|
{
|
||||||
if (strstr((char*)rxbuffer, stopset))
|
if (strstr((char*)rxbuffer, stopset))
|
||||||
{
|
{
|
||||||
|
|
|
@ -515,6 +515,7 @@ static int multicast_publisher_write_data(multicast_publisher_args
|
||||||
return (RIG_OK);
|
return (RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // disable until we figure out what to do about Windows poor performance
|
||||||
static int multicast_publisher_read_data(multicast_publisher_args
|
static int multicast_publisher_read_data(multicast_publisher_args
|
||||||
const *mcast_publisher_args, size_t length, unsigned char *data)
|
const *mcast_publisher_args, size_t length, unsigned char *data)
|
||||||
{
|
{
|
||||||
|
@ -557,6 +558,7 @@ static int multicast_publisher_read_data(multicast_publisher_args
|
||||||
|
|
||||||
return (RIG_OK);
|
return (RIG_OK);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -978,6 +980,7 @@ void *multicast_publisher(void *arg)
|
||||||
}
|
}
|
||||||
for(i=0;i<5;++i)
|
for(i=0;i<5;++i)
|
||||||
{
|
{
|
||||||
|
hl_usleep(200*1000);
|
||||||
if (rig->state.cache.freqMainA != freqA)
|
if (rig->state.cache.freqMainA != freqA)
|
||||||
{
|
{
|
||||||
freqA = rig->state.cache.freqMainA;
|
freqA = rig->state.cache.freqMainA;
|
||||||
|
@ -1033,7 +1036,6 @@ void *multicast_publisher(void *arg)
|
||||||
widthC = rig->state.cache.widthMainC;
|
widthC = rig->state.cache.widthMainC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hl_usleep(200*1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue