FIx the stragglers

Comments/false postitives
New code
pull/1563/head
George Baltz N3GB 2024-06-08 03:53:17 -04:00
rodzic 5790af8cc6
commit c4e5f54bbf
4 zmienionych plików z 25 dodań i 21 usunięć

Wyświetl plik

@ -163,18 +163,19 @@ static int write_transaction(ROT *rot, char *cmd)
static int pstrotator_rot_init(ROT *rot) static int pstrotator_rot_init(ROT *rot)
{ {
struct pstrotator_rot_priv_data *priv; struct pstrotator_rot_priv_data *priv;
struct rot_state *rs = ROTSTATE(rot);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct pstrotator_rot_priv_data *) rs->priv = (struct pstrotator_rot_priv_data *)
calloc(1, sizeof(struct pstrotator_rot_priv_data)); calloc(1, sizeof(struct pstrotator_rot_priv_data));
if (!rot->state.priv) if (!rs->priv)
{ {
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
priv = rot->state.priv; priv = rs->priv;
priv->ext_funcs = alloc_init_ext(pstrotator_ext_funcs); priv->ext_funcs = alloc_init_ext(pstrotator_ext_funcs);
@ -212,8 +213,9 @@ static int pstrotator_rot_init(ROT *rot)
static int pstrotator_rot_cleanup(ROT *rot) static int pstrotator_rot_cleanup(ROT *rot)
{ {
struct rot_state *rs = ROTSTATE(rot);
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *) struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv; rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -221,9 +223,9 @@ static int pstrotator_rot_cleanup(ROT *rot)
free(priv->ext_levels); free(priv->ext_levels);
free(priv->ext_parms); free(priv->ext_parms);
free(priv->magic_conf); free(priv->magic_conf);
free(rot->state.priv); free(rs->priv);
rot->state.priv = NULL; rs->priv = NULL;
return RIG_OK; return RIG_OK;
} }
@ -251,11 +253,12 @@ static int pstrotator_rot_open(ROT *rot)
int n1, n2, n3, n4; int n1, n2, n3, n4;
int sockfd; int sockfd;
struct sockaddr_in clientAddr; struct sockaddr_in clientAddr;
struct rot_state *rs = ROTSTATE(rot);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct pstrotator_rot_priv_data *)rot->state.priv; priv = (struct pstrotator_rot_priv_data *)rs->priv;
//priv->port2 = rot->state.rotport; //priv->port2 = rs->rotport;
//priv->port2.type.rig = RIG_PORT_UDP_NETWORK; //priv->port2.type.rig = RIG_PORT_UDP_NETWORK;
rig_debug(RIG_DEBUG_VERBOSE, "%s: pathname=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: pathname=%s\n", __func__,
@ -300,7 +303,7 @@ static int pstrotator_set_conf(ROT *rot, hamlib_token_t token, const char *val)
{ {
struct pstrotator_rot_priv_data *priv; struct pstrotator_rot_priv_data *priv;
priv = (struct pstrotator_rot_priv_data *)rot->state.priv; priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv;
switch (token) switch (token)
{ {
@ -326,7 +329,7 @@ static int pstrotator_get_conf2(ROT *rot, hamlib_token_t token, char *val,
{ {
struct pstrotator_rot_priv_data *priv; struct pstrotator_rot_priv_data *priv;
priv = (struct pstrotator_rot_priv_data *)rot->state.priv; priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv;
switch (token) switch (token)
{ {
@ -351,7 +354,7 @@ static int pstrotator_get_conf(ROT *rot, hamlib_token_t token, char *val)
static int pstrotator_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) static int pstrotator_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
{ {
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *) struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv; ROTSTATE(rot)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
az, el); az, el);
@ -442,7 +445,7 @@ void readPacket(int sockfd, char *buf, int buf_len, int expected)
static int pstrotator_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) static int pstrotator_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
{ {
struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *) struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *)
rot->state.priv; ROTSTATE(rot)->priv;
char buf[64]; char buf[64];
int n = 0; int n = 0;
fd_set rfds, efds; fd_set rfds, efds;
@ -519,7 +522,7 @@ static int pstrotator_rot_get_status(ROT *rot, rot_status_t *status)
{ {
const struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data const struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data
*) *)
rot->state.priv; ROTSTATE(rot)->priv;
*status = priv->status; *status = priv->status;

Wyświetl plik

@ -694,6 +694,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
char ttmode, ttreceiver; char ttmode, ttreceiver;
int retry; int retry;
int timeout; int timeout;
struct rig_state *rs = STATE(rig);
ttreceiver = which_receiver(rig, vfo); ttreceiver = which_receiver(rig, vfo);
@ -743,15 +744,15 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* Query passband width (filter) */ /* Query passband width (filter) */
// since this fails at 80ms sometimes we won't retry and will reduce the timeout // since this fails at 80ms sometimes we won't retry and will reduce the timeout
// Normally this comes back in about 30ms // Normally this comes back in about 30ms
retry = rig->state.retry; retry = rs->retry;
timeout = rig->state.timeout; timeout = rs->timeout;
rig->state.retry = 0; rs->retry = 0;
rig->state.timeout = 100; rs->timeout = 100;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cF" EOM, ttreceiver); SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cF" EOM, ttreceiver);
resp_len = sizeof(respbuf); resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len); retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
rig->state.retry = retry; rs->retry = retry;
rig->state.timeout = timeout; rs->timeout = timeout;
if (retval != RIG_OK) if (retval != RIG_OK)
{ {

Wyświetl plik

@ -2439,7 +2439,7 @@ static int ft1000d_set_vfo(RIG *rig, vfo_t vfo)
} }
priv = (struct ft1000d_priv_data *)STATE(rig)->priv; priv = (struct ft1000d_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: MADE IT TO rig.state.priv = 0x%02x\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: MADE IT TO STATE(rig)->priv = 0x%02x\n", __func__,
RIG_VFO_CURR); RIG_VFO_CURR);
// if (vfo == RIG_VFO_CURR) { // if (vfo == RIG_VFO_CURR) {

Wyświetl plik

@ -1005,7 +1005,7 @@ struct rig_caps ft847uni_caps =
/* /*
* setup *priv * setup *priv
* serial port is already open (rig->state->fd) * serial port is already open (STATE(rig)->fd)
*/ */
static int ft847_init(RIG *rig) static int ft847_init(RIG *rig)