Convert rigs/icom/, rigs/kit/

pull/1508/head
George Baltz N3GB 2024-02-03 14:11:46 -05:00
rodzic c7ab5c44af
commit 464eea58e7
14 zmienionych plików z 118 dodań i 110 usunięć

Wyświetl plik

@ -131,6 +131,7 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
struct icom_priv_data *priv;
const struct icom_priv_caps *priv_caps;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
struct timeval start_time, current_time, elapsed_time;
// this buf needs to be large enough for 0xfe strings for power up
// at 115,200 this is now at least 150
@ -158,11 +159,11 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
set_transaction_active(rig);
collision_retry:
rig_flush(&rs->rigport);
rig_flush(rp);
if (data_len) { *data_len = 0; }
retval = write_block(&rs->rigport, sendbuf, frm_len);
retval = write_block(rp, sendbuf, frm_len);
if (retval != RIG_OK)
{
@ -182,7 +183,7 @@ collision_retry:
* up to rs->retry times.
*/
retval = read_icom_frame(&rs->rigport, buf, sizeof(buf));
retval = read_icom_frame(rp, buf, sizeof(buf));
if (retval == -RIG_ETIMEOUT || retval == 0)
{
@ -289,7 +290,7 @@ read_another_frame:
* ACKFRMLEN is the smallest frame we can expect from the rig
*/
buf[0] = 0;
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
frm_len = read_icom_frame(rp, buf, sizeof(buf));
if (frm_len > 4 && memcmp(buf, sendbuf, frm_len) == 0)
{
@ -305,7 +306,7 @@ read_another_frame:
// Hmmm -- got an echo back when not expected so let's change
priv->serial_USB_echo_off = 0;
// And try again
frm_len = read_icom_frame(&rs->rigport, buf, sizeof(buf));
frm_len = read_icom_frame(rp, buf, sizeof(buf));
}
#endif
@ -412,7 +413,7 @@ read_another_frame:
elapsedms = (int)(elapsed_time.tv_sec * 1000 + elapsed_time.tv_usec / 1000);
if (elapsedms > rs->rigport.timeout)
if (elapsedms > rp->timeout)
{
set_transaction_inactive(rig);
RETURNFUNC(-RIG_ETIMEOUT);
@ -458,7 +459,7 @@ int icom_transaction(RIG *rig, int cmd, int subcmd,
"%s: cmd=0x%02x, subcmd=0x%02x, payload_len=%d\n", __func__,
cmd, subcmd, payload_len);
retry = rig->state.rigport.retry;
retry = RIGPORT(rig)->retry;
do
{

Wyświetl plik

@ -611,6 +611,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
pltune_cb_t cb;
int rc, pin_state;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
if (scan != RIG_SCAN_PLT)
{
@ -630,7 +631,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
{
/* time for CIV command to be sent. this is subtracted from */
/* rcvr settle time */
state->usleep_time = (1000000 / (rig->state.rigport.parm.serial.rate))
state->usleep_time = (1000000 / (rp->parm.serial.rate))
* 13 * 9;
rc = cb(rig, vfo, &(state->next_freq), &(state->next_mode),
@ -666,7 +667,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
optoscan_wait_timer(rig, state); /*Step 5*/
ser_get_car(&rs->rigport, &pin_state);
ser_get_car(rp, &pin_state);
if (pin_state) /*Step 6*/
{
@ -795,12 +796,11 @@ static int optoscan_send_freq(RIG *rig, vfo_t vfo, const pltstate_t *state)
static int optoscan_RTS_toggle(RIG *rig)
{
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int state = 0;
rs = &rig->state;
ser_get_rts(&rs->rigport, &state);
ser_set_rts(&rs->rigport, !state);
ser_get_rts(rp, &state);
ser_set_rts(rp, !state);
return RIG_OK;
}

Wyświetl plik

@ -348,7 +348,7 @@ int dds60_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned long frg;
unsigned char control;
struct dds60_priv_data *priv;
hamlib_port_t *port = &rig->state.rigport;
hamlib_port_t *port = RIGPORT(rig);
freq_t osc_ref;
priv = (struct dds60_priv_data *)rig->state.priv;
@ -379,7 +379,7 @@ int dds60_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int dds60_open(RIG *rig)
{
hamlib_port_t *port = &rig->state.rigport;
hamlib_port_t *port = RIGPORT(rig);
/* lock the parallel port */
par_lock(port);

Wyświetl plik

@ -412,7 +412,7 @@ int drt1_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned cfr2;
struct drt1_priv_data *priv;
hamlib_port_t *port = &rig->state.rigport;
hamlib_port_t *port = RIGPORT(rig);
priv = (struct drt1_priv_data *)rig->state.priv;

Wyświetl plik

@ -621,7 +621,7 @@ struct rig_caps dwt_caps =
int dwt_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
rp->parm.usb.vid = USB_VID_CT;
rp->parm.usb.pid = USB_PID_CT_DWT;
@ -635,7 +635,7 @@ int dwt_init(RIG *rig)
#define MSG_LEN 16
int dwt_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int request, value, index;
unsigned char buf[MSG_LEN] = { 0x4a, 0x00, 0x03, 0x00, 0xff, 0xff, 0x32 };
int requesttype, r;
@ -668,7 +668,7 @@ int dwt_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
const char *dwt_get_info(RIG *rig)
{
static char buf[64];
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
struct libusb_device_descriptor desc;
/* always succeeds since libusb-1.0.16 */

Wyświetl plik

@ -342,7 +342,7 @@ int elektor304_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned fhl, fhh, fll, flh;
struct elektor304_priv_data *priv;
hamlib_port_t *port = &rig->state.rigport;
hamlib_port_t *port = RIGPORT(rig);
priv = (struct elektor304_priv_data *)rig->state.priv;

Wyświetl plik

@ -373,7 +373,7 @@ const char *elektor507_get_info(RIG *rig)
*/
int elektor507_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct elektor507_priv_data *priv;
rig->state.priv = (struct elektor507_priv_data *)calloc(sizeof(struct
@ -426,7 +426,7 @@ int elektor507_cleanup(RIG *rig)
const char *elektor507_get_info(RIG *rig)
{
static char buf[64];
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
struct libusb_device_descriptor desc;
/* always succeeds since libusb-1.0.16 */
@ -439,7 +439,7 @@ const char *elektor507_get_info(RIG *rig)
int elektor507_libusb_setup(RIG *rig)
{
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned short index = 0, usb_val;
@ -500,7 +500,7 @@ int elektor507_libusb_setup(RIG *rig)
int elektor507_ftdi_write_data(RIG *rig, void *FTOutBuf,
unsigned long BufferSize)
{
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret, actual_length;
rig_debug(RIG_DEBUG_TRACE, "%s called, %lu bytes\n", __func__, BufferSize);

Wyświetl plik

@ -276,12 +276,12 @@ static int fifisdr_usb_write(RIG *rig,
unsigned char *bytes, int size)
{
int ret;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
ret = libusb_control_transfer(udh,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
request, value, index,
bytes, size, rig->state.rigport.timeout);
bytes, size, RIGPORT(rig)->timeout);
if (ret != size)
{
@ -303,12 +303,12 @@ static int fifisdr_usb_read(RIG *rig,
unsigned char *bytes, int size)
{
int ret;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
ret = libusb_control_transfer(udh,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
request, value, index,
bytes, size, rig->state.rigport.timeout);
bytes, size, RIGPORT(rig)->timeout);
if (ret != size)
{
@ -326,7 +326,7 @@ static int fifisdr_usb_read(RIG *rig,
int fifisdr_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct fifisdr_priv_instance_data *priv;
rig->state.priv = (struct fifisdr_priv_instance_data *)calloc(sizeof(

Wyświetl plik

@ -225,7 +225,7 @@ struct rig_caps funcubeplus_caps =
int funcube_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct funcube_priv_data *priv;
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(
@ -255,7 +255,7 @@ int funcube_init(RIG *rig)
int funcubeplus_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct funcube_priv_data *priv;
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(
@ -304,7 +304,7 @@ int funcube_cleanup(RIG *rig)
const char *funcube_get_info(RIG *rig)
{
static char buf[64];
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
struct libusb_device_descriptor desc;
/* always succeeds since libusb-1.0.16 */
@ -427,12 +427,14 @@ int set_freq_v1(libusb_device_handle *udh, unsigned int f, int timeout)
int funcube_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct funcube_priv_data *priv = (struct funcube_priv_data *)rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
hamlib_port_t *rp = RIGPORT(rig);
libusb_device_handle *udh = rp->handle;
int ret;
if ((ret = set_freq_v1(udh, freq, rig->state.rigport.timeout)) != RIG_OK)
if ((ret = set_freq_v1(udh, freq, rp->timeout)) != RIG_OK)
{
if ((ret = set_freq_v0(udh, freq, rig->state.rigport.timeout)) == RIG_OK)
if ((ret = set_freq_v0(udh, freq, rp->timeout)) == RIG_OK)
{
priv->freq = freq;
}
@ -460,7 +462,8 @@ int get_freq_v0(RIG *rig, vfo_t vfo, freq_t *freq)
int get_freq_v1(RIG *rig, vfo_t vfo, freq_t *freq)
{
libusb_device_handle *udh = rig->state.rigport.handle;
hamlib_port_t *rp = RIGPORT(rig);
libusb_device_handle *udh = rp->handle;
int ret;
unsigned int f;
int actual_length;
@ -475,7 +478,7 @@ int get_freq_v1(RIG *rig, vfo_t vfo, freq_t *freq)
au8BufOut[3] & 0xFF);
ret = libusb_interrupt_transfer(udh, OUTPUT_ENDPOINT, au8BufOut,
sizeof(au8BufOut), &actual_length, rig->state.rigport.timeout);
sizeof(au8BufOut), &actual_length, rp->timeout);
if (ret < 0)
{
@ -485,7 +488,7 @@ int get_freq_v1(RIG *rig, vfo_t vfo, freq_t *freq)
}
ret = libusb_interrupt_transfer(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn),
&actual_length, rig->state.rigport.timeout);
&actual_length, rp->timeout);
if (ret < 0 || actual_length != sizeof(au8BufIn))
{
@ -528,7 +531,8 @@ int funcube_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
libusb_device_handle *udh = rig->state.rigport.handle;
hamlib_port_t *rp = RIGPORT(rig);
libusb_device_handle *udh = rp->handle;
int ret;
int actual_length;
unsigned char au8BufOut[64] = "\0\0\0\0"; // endpoint size
@ -601,7 +605,7 @@ int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
au8BufOut[3] & 0xFF);
ret = libusb_interrupt_transfer(udh, OUTPUT_ENDPOINT, au8BufOut,
sizeof(au8BufOut), &actual_length, rig->state.rigport.timeout);
sizeof(au8BufOut), &actual_length, rp->timeout);
if (ret < 0)
{
@ -611,7 +615,7 @@ int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
ret = libusb_interrupt_transfer(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn),
&actual_length, rig->state.rigport.timeout);
&actual_length, rp->timeout);
if (ret < 0 || actual_length != sizeof(au8BufIn))
{
@ -635,7 +639,8 @@ int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
libusb_device_handle *udh = rig->state.rigport.handle;
hamlib_port_t *rp = RIGPORT(rig);
libusb_device_handle *udh = rp->handle;
int ret;
int actual_length;
unsigned char au8BufOut[64] = "\0\0\0\0"; // endpoint size
@ -663,7 +668,7 @@ int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
au8BufOut[3] & 0xFF);
ret = libusb_interrupt_transfer(udh, OUTPUT_ENDPOINT, au8BufOut,
sizeof(au8BufOut), &actual_length, rig->state.rigport.timeout);
sizeof(au8BufOut), &actual_length, rp->timeout);
if (ret < 0)
{
@ -673,7 +678,7 @@ int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
ret = libusb_interrupt_transfer(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn),
&actual_length, rig->state.rigport.timeout);
&actual_length, rp->timeout);
if (ret < 0 || actual_length != sizeof(au8BufIn))
{
@ -760,7 +765,8 @@ int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int funcube_hid_cmd(RIG *rig, unsigned char *au8BufOut, unsigned char *au8BufIn,
int inputSize)
{
libusb_device_handle *udh = rig->state.rigport.handle;
hamlib_port_t *rp = RIGPORT(rig);
libusb_device_handle *udh = rp->handle;
int ret;
int actual_length;
rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x\n",
@ -768,7 +774,7 @@ int funcube_hid_cmd(RIG *rig, unsigned char *au8BufOut, unsigned char *au8BufIn,
au8BufOut[3] & 0xFF);
ret = libusb_interrupt_transfer(udh, OUTPUT_ENDPOINT, au8BufOut,
sizeof(au8BufOut), &actual_length, rig->state.rigport.timeout);
sizeof(au8BufOut), &actual_length, rp->timeout);
if (ret < 0)
{
@ -778,7 +784,7 @@ int funcube_hid_cmd(RIG *rig, unsigned char *au8BufOut, unsigned char *au8BufIn,
}
ret = libusb_interrupt_transfer(udh, INPUT_ENDPOINT, au8BufIn, inputSize,
&actual_length, rig->state.rigport.timeout);
&actual_length, rp->timeout);
if (ret < 0 || actual_length != inputSize)
{

Wyświetl plik

@ -192,10 +192,10 @@ static int send_command(RIG *rig)
rig->state.priv;
int ret;
ret = write_block(&rig->state.rigport, (unsigned char *) priv->control_frame,
ret = write_block(RIGPORT(rig), (unsigned char *) priv->control_frame,
CTRL_FRAME_LEN);
#if 0
ret = read_block(&rig->state.rigport, (unsigned char *) priv->control_frame,
ret = read_block(RIGPORT(rig), (unsigned char *) priv->control_frame,
CTRL_FRAME_LEN);
if (ret != CTRL_FRAME_LEN)
@ -306,7 +306,7 @@ int hiqsdr_init(RIG *rig)
priv->split = RIG_SPLIT_OFF;
priv->ref_clock = REFCLOCK;
priv->sample_rate = DEFAULT_SAMPLE_RATE;
strncpy(rig->state.rigport.pathname, "192.168.2.196:48248",
strncpy(RIGPORT(rig)->pathname, "192.168.2.196:48248",
HAMLIB_FILPATHLEN - 1);
return RIG_OK;
@ -347,7 +347,7 @@ int hiqsdr_open(RIG *rig)
#if 0
/* Send the samples to me. FIXME: send to port 48247 */
ret = write_block(&rig->state.rigport, buf_send_to_me, sizeof(buf_send_to_me));
ret = write_block(RIGPORT(rig), buf_send_to_me, sizeof(buf_send_to_me));
if (ret != RIG_OK)
{

Wyświetl plik

@ -33,18 +33,18 @@ static int miniVNA_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char fstr[20];
char cmdstr[40];
int retval;
hamlib_port_t *rp = RIGPORT(rig);
sprintf_freq(fstr, sizeof(fstr), freq);
rig_debug(RIG_DEBUG_TRACE, "%s called: %s %s\n", __func__,
rig_strvfo(vfo), fstr);
rig_flush(&rig->state.rigport);
rig_flush(rp);
SNPRINTF(cmdstr, sizeof(cmdstr), "0\r%lu\r1\r0\r",
(unsigned long int)(freq * DDS_RATIO));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
retval = write_block(rp, (unsigned char *) cmdstr, strlen(cmdstr));
if (retval != RIG_OK)
{

Wyświetl plik

@ -54,7 +54,7 @@ static int
pcrotor_stop(ROT *rot)
{
/* CW=0, CCW=0, Power-up=0 */
return setDirection(&rot->state.rotport, 0);
return setDirection(ROTPORT(rot), 0);
}
static int
@ -83,7 +83,7 @@ pcrotor_move(ROT *rot, int direction, int speed)
return -RIG_EINVAL;
}
return setDirection(&rot->state.rotport, outputvalue);
return setDirection(ROTPORT(rot), outputvalue);
}

Wyświetl plik

@ -45,21 +45,22 @@ static int rshfiq_open(RIG *rig)
int flag;
char versionstr[20];
char stopset[2];
hamlib_port_t *rp = RIGPORT(rig);
stopset[0] = '\r';
stopset[1] = '\n';
rig_debug(RIG_DEBUG_TRACE, "%s: Port = %s\n", __func__,
rig->state.rigport.pathname);
rig->state.rigport.timeout = 2000;
rig->state.rigport.retry = 1;
retval = serial_open(&rig->state.rigport);
rp->pathname);
rp->timeout = 2000;
rp->retry = 1;
retval = serial_open(rp);
if (retval != RIG_OK)
{
return retval;
}
retval = ser_get_dtr(&rig->state.rigport, &flag);
retval = ser_get_dtr(rp, &flag);
if (retval == RIG_OK)
{
@ -73,7 +74,7 @@ static int rshfiq_open(RIG *rig)
if (flag == 0)
{
flag = 1; // Set DTR
retval = ser_set_dtr(&rig->state.rigport, flag);
retval = ser_set_dtr(rp, flag);
if (retval == RIG_OK)
{
@ -88,10 +89,10 @@ static int rshfiq_open(RIG *rig)
for (int init_retry_count = 0; (init_retry_count < RSHFIQ_INIT_RETRY)
&& (retval == -RIG_ETIMEOUT); init_retry_count++)
{
rig_flush(&rig->state.rigport);
rig_flush(rp);
SNPRINTF(versionstr, sizeof(versionstr), "*w\r");
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s\n", __func__, versionstr);
retval = write_block(&rig->state.rigport, (unsigned char *) versionstr,
retval = write_block(rp, (unsigned char *) versionstr,
strlen(versionstr));
if (retval != RIG_OK)
@ -99,7 +100,7 @@ static int rshfiq_open(RIG *rig)
return retval;
}
retval = read_string(&rig->state.rigport, (unsigned char *) versionstr, 20,
retval = read_string(rp, (unsigned char *) versionstr, 20,
stopset, 2, 0, 1);
}
@ -108,7 +109,7 @@ static int rshfiq_open(RIG *rig)
return retval;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
versionstr[retval] = 0;
rig_debug(RIG_DEBUG_TRACE, "%s: Rigversion = %s\n", __func__, versionstr);
@ -150,16 +151,17 @@ static int rshfiq_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char fstr[9];
char cmdstr[15];
int retval;
hamlib_port_t *rp = RIGPORT(rig);
SNPRINTF(fstr, sizeof(fstr), "%lu", (unsigned long int)(freq));
rig_debug(RIG_DEBUG_TRACE, "%s called: %s %s\n", __func__,
rig_strvfo(vfo), fstr);
rig_flush(&rig->state.rigport);
rig_flush(rp);
SNPRINTF(cmdstr, sizeof(cmdstr), "*f%lu\r", (unsigned long int)(freq));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
retval = write_block(rp, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
@ -174,7 +176,9 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char cmdstr[15];
char stopset[2];
int retval;
rig_flush(&rig->state.rigport);
hamlib_port_t *rp = RIGPORT(rig);
rig_flush(rp);
stopset[0] = '\r';
stopset[1] = '\n';
@ -183,7 +187,7 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s\n", __func__, cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
retval = write_block(rp, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
@ -191,7 +195,7 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval;
}
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
retval = read_string(rp, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
if (retval <= 0)
@ -233,7 +237,7 @@ static int rshfiq_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s\n", __func__, cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
retval = write_block(RIGPORT(rig), (unsigned char *) cmdstr,
strlen(cmdstr));
return retval;
}
@ -247,6 +251,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
char cmdstr[15];
char stopset[2];
int retval;
hamlib_port_t *rp = RIGPORT(rig);
if (!val)
{
@ -263,13 +268,13 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return -RIG_ENAVAIL;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
SNPRINTF(cmdstr, sizeof(cmdstr), "*L\r");
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER command=%s\n", cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
retval = write_block(rp, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
@ -280,7 +285,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
retval = read_string(rp, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER reply=%s\n", cmdstr);
@ -299,17 +304,16 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER val=%f\n", val->f);
return RIG_OK;
break;
case RIG_LEVEL_TEMP_METER:
rig_flush(&rig->state.rigport);
rig_flush(rp);
SNPRINTF(cmdstr, sizeof(cmdstr), "*T\r");
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER command=%s\n", cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
retval = write_block(rp, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
@ -320,7 +324,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
retval = read_string(rp, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER reply=%s\n", cmdstr);
@ -338,14 +342,11 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER val=%g\n", val->f);
return RIG_OK;
break;
break;
default:
rig_debug(RIG_DEBUG_VERBOSE, "%s: Unrecognized RIG_LEVEL_* enum: %"PRIll"\n",
__func__, level);
return -RIG_EDOM;
break;
}
}

Wyświetl plik

@ -566,7 +566,7 @@ static uint32_t getLongWord(unsigned char const *bytes)
*/
int si570avrusb_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct si570xxxusb_priv_data *priv;
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
@ -607,7 +607,7 @@ int si570avrusb_init(RIG *rig)
*/
int si570peaberry1_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct si570xxxusb_priv_data *priv;
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
@ -648,7 +648,7 @@ int si570peaberry1_init(RIG *rig)
*/
int si570peaberry2_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct si570xxxusb_priv_data *priv;
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
@ -689,7 +689,7 @@ int si570peaberry2_init(RIG *rig)
*/
int si570picusb_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct si570xxxusb_priv_data *priv;
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
@ -730,7 +730,7 @@ int si570picusb_init(RIG *rig)
int fasdr_init(RIG *rig)
{
hamlib_port_t *rp = &rig->state.rigport;
hamlib_port_t *rp = RIGPORT(rig);
struct si570xxxusb_priv_data *priv;
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
@ -771,7 +771,7 @@ int fasdr_open(RIG *rig)
{
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret, i;
double f;
unsigned char buffer[4];
@ -781,7 +781,7 @@ int fasdr_open(RIG *rig)
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_READ_VERSION, 0x0E00, 0,
buffer, 2, rig->state.rigport.timeout);
buffer, 2, RIGPORT(rig)->timeout);
if (ret != 2)
{
@ -797,7 +797,7 @@ int fasdr_open(RIG *rig)
ret = libusb_control_transfer(udh,
REQUEST_TYPE_IN,
REQUEST_READ_EEPROM, F_CAL_STATUS, 0, buffer, 1,
rig->state.rigport.timeout);
RIGPORT(rig)->timeout);
if (ret != 1)
{
@ -810,7 +810,7 @@ int fasdr_open(RIG *rig)
// ret = libusb_control_transfer(udh,
// REQUEST_TYPE_IN,
// REQUEST_READ_XTALL, 0, 0, (unsigned char *) &iFreq, sizeof(iFreq),
// rig->state.rigport.timeout);
// RIGPORT(rig)->timeout);
if (buffer[0] == 0xFF)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Device not calibrated", __func__);
@ -822,7 +822,7 @@ int fasdr_open(RIG *rig)
ret = libusb_control_transfer(udh,
REQUEST_TYPE_IN,
REQUEST_READ_EEPROM, F_CRYST + i, 0, &buffer[i], 1,
rig->state.rigport.timeout);
RIGPORT(rig)->timeout);
if (ret != 1)
{
@ -963,7 +963,7 @@ int si570xxxusb_get_conf(RIG *rig, hamlib_token_t token, char *val)
static int setBPF(RIG *rig, int enable)
{
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
/* allocate enough space for up to 16 filters */
unsigned short FilterCrossOver[16];
int nBytes;
@ -974,7 +974,7 @@ static int setBPF(RIG *rig, int enable)
nBytes = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_FILTERS, 0, 255,
(unsigned char *) FilterCrossOver, sizeof(FilterCrossOver),
rig->state.rigport.timeout);
RIGPORT(rig)->timeout);
if (nBytes < 0)
{
@ -987,7 +987,7 @@ static int setBPF(RIG *rig, int enable)
int retval = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_FILTERS, enable, (nBytes / 2) - 1,
(unsigned char *) FilterCrossOver, sizeof(FilterCrossOver),
rig->state.rigport.timeout);
RIGPORT(rig)->timeout);
if (retval < 2)
{
@ -1015,7 +1015,7 @@ int si570xxxusb_open(RIG *rig)
{
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned char buffer[4];
@ -1027,7 +1027,7 @@ int si570xxxusb_open(RIG *rig)
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_READ_VERSION, 0x0E00, 0,
buffer, 2, rig->state.rigport.timeout);
buffer, 2, RIGPORT(rig)->timeout);
if (ret != 2)
{
@ -1048,7 +1048,7 @@ int si570xxxusb_open(RIG *rig)
ret = libusb_control_transfer(udh,
REQUEST_TYPE_IN,
REQUEST_READ_XTALL, 0, 0, buffer, sizeof(buffer),
rig->state.rigport.timeout);
RIGPORT(rig)->timeout);
if (ret != 4)
{
@ -1080,14 +1080,14 @@ int si570xxxusb_open(RIG *rig)
const char *si570xxxusb_get_info(RIG *rig)
{
static char buf[64];
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
struct libusb_device_descriptor desc;
int ret;
unsigned char buffer[2];
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_READ_VERSION, 0x0E00, 0,
buffer, sizeof(buffer), rig->state.rigport.timeout);
buffer, sizeof(buffer), RIGPORT(rig)->timeout);
if (ret != 2)
{
@ -1195,7 +1195,7 @@ int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned char buffer[6];
int request = REQUEST_SET_FREQ;
@ -1235,7 +1235,7 @@ int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
buffer[0] = buffer[0] + (theSolution.HS_DIV << 5);
ret = libusb_control_transfer(udh, REQUEST_TYPE_OUT,
request, value, index, buffer, sizeof(buffer), rig->state.rigport.timeout);
request, value, index, buffer, sizeof(buffer), RIGPORT(rig)->timeout);
rig_debug(RIG_DEBUG_TRACE,
"%s: Freq=%.6f MHz, Real=%.6f MHz, buf=%02x%02x%02x%02x%02x%02x\n",
@ -1261,7 +1261,7 @@ int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned char buffer[4];
@ -1280,7 +1280,7 @@ int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq)
buffer[0], buffer[1], buffer[2], buffer[3]);
ret = libusb_control_transfer(udh, REQUEST_TYPE_OUT,
request, value, index, buffer, sizeof(buffer), rig->state.rigport.timeout);
request, value, index, buffer, sizeof(buffer), RIGPORT(rig)->timeout);
if (!ret)
{
@ -1331,7 +1331,7 @@ int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
unsigned char buffer[6];
int ret;
@ -1344,7 +1344,7 @@ int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_READ_REGISTERS, priv->i2c_addr, 0,
buffer, sizeof(buffer), rig->state.rigport.timeout);
buffer, sizeof(buffer), RIGPORT(rig)->timeout);
if (ret <= 0)
{
@ -1363,14 +1363,14 @@ int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq)
{
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
rig->state.priv;
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned char buffer[4];
uint32_t iFreq;
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_READ_FREQUENCY, 0, 0,
buffer, sizeof(buffer), rig->state.rigport.timeout);
buffer, sizeof(buffer), RIGPORT(rig)->timeout);
if (ret != 4)
{
@ -1392,7 +1392,7 @@ int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq)
int si570xxxusb_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
libusb_device_handle *udh = rig->state.rigport.handle;
libusb_device_handle *udh = RIGPORT(rig)->handle;
int ret;
unsigned char buffer[3];
@ -1404,7 +1404,7 @@ int si570xxxusb_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
ret = libusb_control_transfer(udh, REQUEST_TYPE_IN,
REQUEST_SET_PTT, (ptt == RIG_PTT_ON) ? 1 : 0, 0,
buffer, sizeof(buffer), rig->state.rigport.timeout);
buffer, sizeof(buffer), RIGPORT(rig)->timeout);
if (ret < 0)
{