pull/1522/head
George Baltz N3GB 2024-03-01 05:32:08 -05:00
rodzic 07f8023d17
commit 728db84c0c
9 zmienionych plików z 40 dodań i 42 usunięć

Wyświetl plik

@ -132,7 +132,7 @@ int gr_init(RIG *rig)
rig->state.priv = (void*)priv;
rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__ );
rig->state.rigport.type.rig = RIG_PORT_NONE;
RIGORT(rig)->type.rig = RIG_PORT_NONE;
memset(priv->parms, 0, RIG_SETTING_MAX*sizeof(value_t));

Wyświetl plik

@ -328,7 +328,7 @@ int main(int argc, char *argv[])
if (amp_file)
{
strncpy(my_amp->state.ampport.pathname, amp_file, HAMLIB_FILPATHLEN - 1);
strncpy(AMPPORT(my_amp)->pathname, amp_file, HAMLIB_FILPATHLEN - 1);
strncpy(my_amp->state.ampport_deprecated.pathname, amp_file,
HAMLIB_FILPATHLEN - 1);
}
@ -336,7 +336,7 @@ int main(int argc, char *argv[])
/* FIXME: bound checking and port type == serial */
if (serial_rate != 0)
{
my_amp->state.ampport.parm.serial.rate = serial_rate;
AMPPORT(my_amp)->parm.serial.rate = serial_rate;
my_amp->state.ampport_deprecated.parm.serial.rate = serial_rate;
}

Wyświetl plik

@ -1990,7 +1990,7 @@ declare_proto_amp(get_powerstat)
declare_proto_amp(send_cmd)
{
int retval;
struct amp_state *rs;
hamlib_port_t *ampp = AMPPORT(amp);
int backend_num, cmd_len;
#define BUFSZ 128
unsigned char bufcmd[BUFSZ];
@ -2038,11 +2038,9 @@ declare_proto_amp(send_cmd)
eom_buf[2] = send_cmd_term;
}
rs = &amp->state;
rig_flush(ampp);
rig_flush(&rs->ampport);
retval = write_block(&rs->ampport, bufcmd, cmd_len);
retval = write_block(ampp, bufcmd, cmd_len);
if (retval != RIG_OK)
{
@ -2060,7 +2058,7 @@ declare_proto_amp(send_cmd)
* assumes CR or LF is end of line char
* for all ascii protocols
*/
retval = read_string(&rs->ampport, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
retval = read_string(ampp, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -67,12 +67,12 @@ int main(int argc, const char *argv[])
my_rig->caps->version,
rig_strstatus(my_rig->caps->status));
printf("Serial speed: %d baud\n", my_rig->state.rigport.parm.serial.rate);
printf("Serial speed: %d baud\n", RIGPORT(my_rig)->parm.serial.rate);
#if 0 // if we want to bench serial or network I/O use this time
rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, 0);
#endif
strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
retcode = rig_open(my_rig);

Wyświetl plik

@ -2576,7 +2576,7 @@ declare_proto_rig(set_ptt)
if (rig->caps->ptt_type != RIG_PTT_RIG_MICDATA)
{
rig_debug(RIG_DEBUG_ERR, "%s: pttport.type.ptt=%d\n", __func__,
rig->state.pttport.type.ptt);
PTTPORT(rig)->type.ptt);
ptt = RIG_PTT_ON;
}
@ -4654,7 +4654,7 @@ declare_proto_rig(dump_state)
{
fprintf(fout, "vfo_ops=0x%x\n", rig->caps->vfo_ops);
fprintf(fout, "ptt_type=0x%x\n",
rig->state.pttport.type.ptt);
PTTPORT(rig)->type.ptt);
fprintf(fout, "targetable_vfo=0x%x\n", rig->caps->targetable_vfo);
fprintf(fout, "has_set_vfo=%d\n", rig->caps->set_vfo != NULL);
fprintf(fout, "has_get_vfo=%d\n", rig->caps->get_vfo != NULL);
@ -5005,7 +5005,7 @@ extern int flrig_cat_string(RIG *rig, const char *arg);
declare_proto_rig(send_cmd)
{
int retval;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int backend_num, cmd_len;
#define BUFSZ 512
char bufcmd[BUFSZ * 5]; // allow for 5 chars for binary
@ -5015,7 +5015,7 @@ declare_proto_rig(send_cmd)
int rxbytes = BUFSZ;
int simulate = rig->caps->rig_model == RIG_MODEL_DUMMY ||
rig->caps->rig_model == RIG_MODEL_NONE ||
rs->rigport.rig == RIG_PORT_NONE;
rp->rig == RIG_PORT_NONE;
ENTERFUNC2;
@ -5120,7 +5120,7 @@ declare_proto_rig(send_cmd)
}
rig_debug(RIG_DEBUG_TRACE, "%s: rigport=%d, bufcmd=%s, cmd_len=%d\n", __func__,
rs->rigport.fd, hasbinary(bufcmd, cmd_len) ? "BINARY" : bufcmd, cmd_len);
rp->fd, hasbinary(bufcmd, cmd_len) ? "BINARY" : bufcmd, cmd_len);
set_transaction_active(rig);
@ -5131,17 +5131,17 @@ declare_proto_rig(send_cmd)
}
else
{
rig_flush(&rs->rigport);
rig_flush(rp);
// we don't want the 'w' command to wait too long
int save_retry = rs->rigport.retry;
rs->rigport.retry = 0;
retval = write_block(&rs->rigport, (unsigned char *) bufcmd, cmd_len);
rs->rigport.retry = save_retry;
int save_retry = rp->retry;
rp->retry = 0;
retval = write_block(rp, (unsigned char *) bufcmd, cmd_len);
rp->retry = save_retry;
if (retval != RIG_OK)
{
rig_flush_force(&rs->rigport, 1);
rig_flush_force(rp, 1);
set_transaction_inactive(rig);
RETURNFUNC2(retval);
}
@ -5193,7 +5193,7 @@ declare_proto_rig(send_cmd)
else
{
/* Assumes CR or LF is end of line char for all ASCII protocols. */
retval = read_string(&rs->rigport, buf, rxbytes, eom_buf,
retval = read_string(rp, buf, rxbytes, eom_buf,
strlen(eom_buf), 0, 1);
if (retval < 0)
@ -5245,7 +5245,7 @@ declare_proto_rig(send_cmd)
strncat(hexbuf, hex, hexbufbytes - 1);
}
rig_flush_force(&rs->rigport, 1);
rig_flush_force(rp, 1);
set_transaction_inactive(rig);
rig_debug(RIG_DEBUG_TRACE, "%s: binary=%s, retval=%d\n", __func__, hexbuf,
@ -5262,7 +5262,7 @@ declare_proto_rig(send_cmd)
}
while (retval > 0 && rxbytes == BUFSZ);
rig_flush_force(&rs->rigport, 1);
rig_flush_force(rp, 1);
set_transaction_inactive(rig);
// we use fwrite in case of any nulls in binary return
@ -5786,7 +5786,7 @@ declare_proto_rig(cm108_get_bit)
if (n != 1) { return -RIG_EINVAL; }
int retval = rig_cm108_get_bit(&rig->state.pttport, gpio, &bit);
int retval = rig_cm108_get_bit(PTTPORT(rig), gpio, &bit);
if (retval != RIG_OK)
{
@ -5826,7 +5826,7 @@ declare_proto_rig(cm108_set_bit)
if (n != 1) { return -RIG_EINVAL; }
rig_debug(RIG_DEBUG_TRACE, "%s: set gpio=%d, bit=%d\n", __func__, gpio, bit);
int retval = rig_cm108_set_bit(&rig->state.pttport, gpio, bit);
int retval = rig_cm108_set_bit(PTTPORT(rig), gpio, bit);
if (retval != RIG_OK)
{

Wyświetl plik

@ -686,7 +686,7 @@ int main(int argc, char *argv[])
if (rig_file)
{
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
}
my_rig->state.twiddle_timeout = twiddle_timeout;
@ -701,7 +701,7 @@ int main(int argc, char *argv[])
*/
if (ptt_type != RIG_PTT_NONE)
{
my_rig->state.pttport.type.ptt = ptt_type;
PTTPORT(my_rig)->type.ptt = ptt_type;
my_rig->state.pttport_deprecated.type.ptt = ptt_type;
// This causes segfault since backend rig_caps are const
// rigctld will use the rig->state version of this for clients
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
if (ptt_file)
{
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
strncpy(my_rig->state.pttport_deprecated.pathname, ptt_file,
HAMLIB_FILPATHLEN - 1);
}
@ -731,7 +731,7 @@ int main(int argc, char *argv[])
/* FIXME: bound checking and port type == serial */
if (serial_rate != 0)
{
my_rig->state.rigport.parm.serial.rate = serial_rate;
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate;
}
@ -1309,7 +1309,7 @@ void *handle_socket(void *arg)
if (cmd[0] != 0)
{
memset(reply, 0, sizeof(reply));
rig_flush(&my_rig->state.rigport);
rig_flush(RIGPORT(my_rig));
retcode = rig_send_raw(my_rig, cmd, nbytes, reply, sizeof(reply),
term);

Wyświetl plik

@ -265,13 +265,13 @@ int main(int argc, char *argv[])
if (rig_file)
{
strncpy(rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
strncpy(RIGPORT(rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
}
/* FIXME: bound checking and port type == serial */
if (serial_rate != 0)
{
rig->state.rigport.parm.serial.rate = serial_rate;
RIGPORT(rig)->parm.serial.rate = serial_rate;
}
if (civaddr)
@ -329,13 +329,13 @@ int main(int argc, char *argv[])
if (rot_file)
{
strncpy(rot->state.rotport.pathname, rot_file, HAMLIB_FILPATHLEN - 1);
strncpy(ROTPORT(rot)->pathname, rot_file, HAMLIB_FILPATHLEN - 1);
}
/* FIXME: bound checking and port type == serial */
if (rot_serial_rate != 0)
{
rot->state.rotport.parm.serial.rate = rot_serial_rate;
ROTPORT(rot)->parm.serial.rate = rot_serial_rate;
}
retcode = rot_open(rot);

Wyświetl plik

@ -257,23 +257,23 @@ int main(int argc, char *argv[])
if (ptt_type != RIG_PTT_NONE)
{
rig->state.pttport.type.ptt = ptt_type;
PTTPORT(rig)->type.ptt = ptt_type;
}
if (ptt_file)
{
strncpy(rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
strncpy(PTTPORT(rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
}
if (rig_file)
{
strncpy(rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
strncpy(RIGPORT(rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
}
/* FIXME: bound checking and port type == serial */
if (serial_rate != 0)
{
rig->state.rigport.parm.serial.rate = serial_rate;
RIGPORT(rig)->parm.serial.rate = serial_rate;
}
if (civaddr)
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
if (!rig_has_get_level(rig, RIG_LEVEL_SWR)
|| rig->state.pttport.type.ptt == RIG_PTT_NONE)
|| PTTPORT(rig)->type.ptt == RIG_PTT_NONE)
{
fprintf(stderr,

Wyświetl plik

@ -52,7 +52,7 @@ int main(int argc, const char *argv[])
exit(1); /* whoops! something went wrong (mem alloc?) */
}
strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), SERIAL_PORT);
if (rig_open(my_rig))
{