diff --git a/rigs/dummy/rot_pstrotator.c b/rigs/dummy/rot_pstrotator.c index 2de2d9f81..d89d34fab 100644 --- a/rigs/dummy/rot_pstrotator.c +++ b/rigs/dummy/rot_pstrotator.c @@ -163,18 +163,19 @@ static int write_transaction(ROT *rot, char *cmd) static int pstrotator_rot_init(ROT *rot) { struct pstrotator_rot_priv_data *priv; + struct rot_state *rs = ROTSTATE(rot); 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)); - if (!rot->state.priv) + if (!rs->priv) { return -RIG_ENOMEM; } - priv = rot->state.priv; + priv = rs->priv; 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) { + struct rot_state *rs = ROTSTATE(rot); 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__); @@ -221,9 +223,9 @@ static int pstrotator_rot_cleanup(ROT *rot) free(priv->ext_levels); free(priv->ext_parms); free(priv->magic_conf); - free(rot->state.priv); + free(rs->priv); - rot->state.priv = NULL; + rs->priv = NULL; return RIG_OK; } @@ -251,11 +253,12 @@ static int pstrotator_rot_open(ROT *rot) int n1, n2, n3, n4; int sockfd; struct sockaddr_in clientAddr; + struct rot_state *rs = ROTSTATE(rot); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - priv = (struct pstrotator_rot_priv_data *)rot->state.priv; - //priv->port2 = rot->state.rotport; + priv = (struct pstrotator_rot_priv_data *)rs->priv; + //priv->port2 = rs->rotport; //priv->port2.type.rig = RIG_PORT_UDP_NETWORK; 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; - priv = (struct pstrotator_rot_priv_data *)rot->state.priv; + priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv; 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; - priv = (struct pstrotator_rot_priv_data *)rot->state.priv; + priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv; 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) { 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__, 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) { struct pstrotator_rot_priv_data *priv = (struct pstrotator_rot_priv_data *) - rot->state.priv; + ROTSTATE(rot)->priv; char buf[64]; int n = 0; 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 *) - rot->state.priv; + ROTSTATE(rot)->priv; *status = priv->status; diff --git a/rigs/tentec/orion.c b/rigs/tentec/orion.c index 6873cd68b..89cf4d157 100644 --- a/rigs/tentec/orion.c +++ b/rigs/tentec/orion.c @@ -694,6 +694,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) char ttmode, ttreceiver; int retry; int timeout; + struct rig_state *rs = STATE(rig); 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) */ // since this fails at 80ms sometimes we won't retry and will reduce the timeout // Normally this comes back in about 30ms - retry = rig->state.retry; - timeout = rig->state.timeout; - rig->state.retry = 0; - rig->state.timeout = 100; + retry = rs->retry; + timeout = rs->timeout; + rs->retry = 0; + rs->timeout = 100; SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cF" EOM, ttreceiver); resp_len = sizeof(respbuf); retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len); - rig->state.retry = retry; - rig->state.timeout = timeout; + rs->retry = retry; + rs->timeout = timeout; if (retval != RIG_OK) { diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index 2f2b479ac..84ccbf3ff 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -2439,7 +2439,7 @@ static int ft1000d_set_vfo(RIG *rig, vfo_t vfo) } 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); // if (vfo == RIG_VFO_CURR) { diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index b4ebe6d0a..4dfba1c28 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -1005,7 +1005,7 @@ struct rig_caps ft847uni_caps = /* * setup *priv - * serial port is already open (rig->state->fd) + * serial port is already open (STATE(rig)->fd) */ static int ft847_init(RIG *rig)