Porównaj commity

...

32 Commity

Autor SHA1 Wiadomość Data
Mike Black W9MDB 59e4ba1cdc Add TIME_BITS debug 2024-02-07 12:27:12 -06:00
Mike Black W9MDB 64c470a4e7 Make hamlib_settings error show the real error 2024-02-05 15:00:26 -06:00
Michael Black 3dd8c97b54
Merge pull request #1508 from GeoBaltz/rp4
Convert all rigs/*/*.c to use pointers for ports
2024-02-05 11:10:56 -06:00
George Baltz N3GB e26e6cd7f2 Convert rigs/yaesu
No more code references to raw port structures in rigs/*
2024-02-05 11:28:31 -05:00
George Baltz N3GB 12552bff64 Do rigs/tuner/, rigs/uniden/, rigs/winradio/ & rigs/wj/
This leaves only rigs/yaesu
2024-02-05 11:28:31 -05:00
George Baltz N3GB a2abc25416 Convert rigs/mds/, rigs/skanti/, rigs/tapr/ and rigs/tentec/ 2024-02-05 11:28:31 -05:00
George Baltz N3GB eb94ce2b94 Convert rigs/loew/, rigs/pcr/, rigs/prm80/, rigs/racal/ and rigs/rs/ 2024-02-05 11:28:31 -05:00
George Baltz N3GB 464eea58e7 Convert rigs/icom/, rigs/kit/ 2024-02-05 11:28:31 -05:00
George Baltz N3GB c7ab5c44af Convert rigs/flexradio, rigs/gomspace, rigs/jrc, rigs/kachina 2024-02-05 11:28:31 -05:00
George Baltz N3GB 1e552b557f Convert rigs/dummy/ 2024-02-05 11:28:31 -05:00
George Baltz N3GB f777179bc8 Convert rigs/dorji, rigs/drake, rigs/elad. 2024-02-05 11:28:31 -05:00
George Baltz N3GB 23d5d53248 Port rigs/anytone/, rigs/barrett/ and rigs/codan/
Fixup git rebase SMerge error.
2024-02-05 11:28:31 -05:00
George Baltz N3GB 02f0ad067a Start converting rigs/*
This commit does rigs/adat/, rigs/alinco/ and rigs/aor/.
2024-02-05 11:28:31 -05:00
George Baltz N3GB 4a1fa678ea Play catchup with split/VFO revision.
Fix typos in rebase fixups.
2024-02-05 11:28:30 -05:00
George Baltz N3GB b1d85e5aa1 Update dcdport usage in tests/*.c
Issue #1445
2024-02-05 11:28:30 -05:00
George Baltz N3GB 1532a7d8dc Convert rot_conf.c and amp_conf.c to pointers
Consolidate some assignments to make deprecation easier.
Issues #1445, #487
2024-02-05 11:28:30 -05:00
George Baltz N3GB 3eb41c6400 Cache pointers for src/rig.c
Issue #1420 again.
2024-02-05 11:28:30 -05:00
George Baltz N3GB 96ee58436a Convert a few more cache pointers
More of issue #1420
2024-02-05 11:28:30 -05:00
George Baltz N3GB bf8bf51bf4 Convert some cache references to pointers
Affects issue #1420
2024-02-05 11:28:30 -05:00
Mike Black W9MDB 6bfccb3e92 Add filternum option for Icom rigs so WJST-X can use hamlib_settings.json to set default filter
https://github.com/Hamlib/Hamlib/issues/1507
2024-02-04 16:53:41 -06:00
Mike Black W9MDB d42d505d22 Icom rigs will now recognize the current even if the user is twiddling buttons
https://github.com/Hamlib/Hamlib/issues/1507
2024-02-04 15:56:34 -06:00
Mike Black W9MDB 1093349564 Fix TIME_BITS_64 2024-02-03 23:35:56 -06:00
Mike Black W9MDB d77b0df702 Fix Icom rigs filter -- mode set will now keep the same filter as currently set 2024-02-03 23:29:09 -06:00
Mike Black W9MDB 8757271437 Merge branch 'master' of https://github.com/Hamlib/Hamlib 2024-02-03 23:26:58 -06:00
Mike Black W9MDB ab8835e87e See if _TIME_BITS_64 works on 32-bit bit builds to fix 2038 problem.
https://github.com/Hamlib/Hamlib/issues/1478
2024-02-03 23:24:07 -06:00
Mike Black W9MDB 9bfb0f5f71 Fix bandlist nullification 2024-02-03 23:23:25 -06:00
Michael Black dab7cf1ee6
Merge pull request #1506 from GeoBaltz/fix10
Fix icom_set_powerstat() to correctly save&restore rp->retry, rp->tim…
2024-02-03 16:45:39 -06:00
George Baltz N3GB 904dfef9b9 Fix icom_set_powerstat() to correctly save&restore rp->retry, rp->timeout_retry
Also convert icom.c to pointer use.
2024-02-03 15:46:11 -05:00
Mike Black W9MDB 0adaebd100 Update comment in rig.h 2024-02-03 12:44:48 -06:00
Mike Black W9MDB 09a9075844 Fix Yaesu BANDSELECT
Rigs must have the bands listed in the backend to work properly
https://github.com/Hamlib/Hamlib/issues/1504
2024-02-03 12:40:58 -06:00
Mike Black W9MDB ade62105a3 Don't set bandwidth on TS590 when RIG_PASSBAND_NOCHANGE is the width
https://github.com/Hamlib/Hamlib/issues/1505
2024-02-03 11:05:12 -06:00
Mike Black W9MDB cff4faba53 Update rigctl.1 2024-02-02 15:54:29 -06:00
127 zmienionych plików z 1976 dodań i 1823 usunięć

Wyświetl plik

@ -28,4 +28,6 @@ DIST_SUBDIRS = macros include lib src c++ bindings tests doc android scripts rot
security $(BACKEND_LIST) $(RIG_BACKEND_LIST) $(ROT_BACKEND_LIST) $(AMP_BACKEND_LIST)
# Install any third party macros into our tree for distribution
ACLOCAL_AMFLAGS = -I macros --install
ACLOCAL_AMFLAGS = -I macros --install
AM_CFLAGS=-D_TIME_BITS=64

Wyświetl plik

@ -940,7 +940,7 @@ Level is a token: \(oqPREAMP\(cq, \(oqATT\(cq, \(oqVOXDELAY\(cq, \(oqAF\(cq,
\(oqALC\(cq, \(oqSTRENGTH\(cq, \(oqRFPOWER_METER\(cq, \(oqCOMPMETER\(cq, \(oqVD_METER\(cq, \(oqID_METER\(cq,
\(oqNOTCHF_RAW\(cq, \(oqMONITOR_GAIN\(cq, \(oqNQ\(cq, \(oqRFPOWER_METER_WATTS\(cq, \(oqSPECTRUM_MODE\(cq,
\(oqSPECTRUM_SPAN\(cq, \(oqSPECTRUM_EDGE_LOW\(cq, \(oqSPECTRUM_EDGE_HIGH\(cq, \(oqSPECTRUM_SPEED\(cq,
\(oqSPECTRUM_REF\(cq, \(oqSPECTRUM_AVG\(cq, \(oqSPECTRUM_ATT\(cq, \(oqTEMP_METER\(cq, \(oqBAND_SELECT\(cq,
\(oqSPECTRUM_REF\(cq, \(oqSPECTRUM_AVG\(cq, \(oqSPECTRUM_ATT\(cq, \(oqTEMP_METER\(cq, \(oqBANDSELECT\(cq,
\(oqUSB_AF\(cq.
.IP
The Level Value can be a float or an integer value. For the AGC token the
@ -970,7 +970,7 @@ Seconds
VOXDELAY(ds), BKINDL(ms), BKIN_DLYMS(ms)
Raw info from rig
RAWSTR, BAND_SELECT (subject to change -- index right now but may convert to band name)
RAWSTR, BANDSELECT (subject to change -- index right now but may convert to band name)
SWR
SWR

Wyświetl plik

@ -781,7 +781,7 @@ typedef enum { // numbers here reflect the Yaesu values
RIG_BAND_430MHZ = 16, /*!< \c 430MHz */
} hamlib_band_t;
typedef enum { // numbers here reflect the Yaesu values
typedef enum { // numbers here reflect generic values -- need to map to rig values
RIG_BANDSELECT_UNUSED = CONSTANT_64BIT_FLAG(0), /*!< \c Unused */
RIG_BANDSELECT_2200M = CONSTANT_64BIT_FLAG(1), /*!< \c 160M */
RIG_BANDSELECT_600M = CONSTANT_64BIT_FLAG(2), /*!< \c 160M */

Wyświetl plik

@ -1233,7 +1233,7 @@ int adat_send(RIG *pRig,
char *pcData)
{
int nRC = RIG_OK;
struct rig_state *pRigState = &pRig->state;
hamlib_port_t *pRigPort = RIGPORT(pRig);
gFnLevel++;
@ -1241,9 +1241,9 @@ int adat_send(RIG *pRig,
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = %p, pcData = %s\n",
gFnLevel, __func__, __FILE__, __LINE__, pRig, pcData);
rig_flush(&pRigState->rigport);
rig_flush(pRigPort);
nRC = write_block(&pRigState->rigport, (unsigned char *) pcData,
nRC = write_block(pRigPort, (unsigned char *) pcData,
strlen(pcData));
rig_debug(RIG_DEBUG_TRACE,
@ -1264,7 +1264,6 @@ int adat_receive(RIG *pRig,
char *pcData)
{
int nRC = RIG_OK;
struct rig_state *pRigState = &pRig->state;
gFnLevel++;
@ -1272,7 +1271,7 @@ int adat_receive(RIG *pRig,
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = %p\n",
gFnLevel, __func__, __FILE__, __LINE__, pRig);
nRC = read_string(&pRigState->rigport, (unsigned char *) pcData, ADAT_RESPSZ,
nRC = read_string(RIGPORT(pRig), (unsigned char *) pcData, ADAT_RESPSZ,
ADAT_EOL, 1, 0, 1);
if (nRC > 0)
@ -1428,7 +1427,6 @@ int adat_get_single_cmd_result(RIG *pRig)
else
{
adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv;
struct rig_state *pRigState = &pRig->state;
nRC = adat_send(pRig, pPriv->acCmd);
@ -1526,7 +1524,7 @@ int adat_get_single_cmd_result(RIG *pRig)
}
}
rig_flush(&pRigState->rigport);
rig_flush(RIGPORT(pRig));
pPriv->nRC = nRC;
}

Wyświetl plik

@ -301,7 +301,7 @@ int dx77_transaction(RIG *rig,
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
char echobuf[BUFSZ + 1];
if (cmd == NULL)
@ -311,11 +311,9 @@ int dx77_transaction(RIG *rig,
return -RIG_EINTERNAL;
}
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -326,7 +324,7 @@ int dx77_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, (unsigned char *) echobuf, BUFSZ,
retval = read_string(rp, (unsigned char *) echobuf, BUFSZ,
LF, strlen(LF), 0, 1);
if (retval < 0)
@ -343,7 +341,7 @@ int dx77_transaction(RIG *rig,
/* no data expected, check for OK returned */
if (data == NULL)
{
retval = read_string(&rs->rigport, (unsigned char *) echobuf, BUFSZ,
retval = read_string(rp, (unsigned char *) echobuf, BUFSZ,
LF, strlen(LF), 0, 1);
if (retval < 0)
@ -365,7 +363,7 @@ int dx77_transaction(RIG *rig,
}
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
retval = read_string(rp, (unsigned char *) data, BUFSZ,
LF, strlen(LF), 0, 1);
if (retval < 0)

Wyświetl plik

@ -235,7 +235,7 @@ int dxsr8_transaction(RIG *rig,
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
char replybuf[BUFSZ + 1];
int reply_len;
@ -246,11 +246,9 @@ int dxsr8_transaction(RIG *rig,
return -RIG_EINTERNAL;
}
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -261,7 +259,7 @@ int dxsr8_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, (unsigned char *) replybuf, BUFSZ,
retval = read_string(rp, (unsigned char *) replybuf, BUFSZ,
LF, strlen(LF), 0, 1);
if (retval < 0)
@ -270,7 +268,7 @@ int dxsr8_transaction(RIG *rig,
}
retval = read_string(&rs->rigport, (unsigned char *) replybuf, BUFSZ,
retval = read_string(rp, (unsigned char *) replybuf, BUFSZ,
LF, strlen(LF), 0, 1);
if (retval < 0)

Wyświetl plik

@ -97,6 +97,7 @@ DECLARE_PROBERIG_BACKEND(anytone)
void *anytone_thread(void *vrig)
{
RIG *rig = (RIG *)vrig;
hamlib_port_t *rp = RIGPORT(rig);
anytone_priv_data_t *p = rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s: anytone_thread started\n", __func__);
p->runflag = 1;
@ -115,9 +116,9 @@ void *anytone_thread(void *vrig)
rig_set_debug(RIG_DEBUG_WARN); // only show WARN debug otherwise too verbose
}
write_block(&rig->state.rigport, (unsigned char *)c, strlen(c));
write_block(rp, (unsigned char *)c, strlen(c));
char buf[32];
read_block(&rig->state.rigport, (unsigned char *)buf, 22);
read_block(rp, (unsigned char *)buf, 22);
if (rig_need_debug(RIG_DEBUG_CACHE) == 0)
{
@ -138,13 +139,13 @@ int anytone_send(RIG *rig,
unsigned char *cmd, int cmd_len)
{
int retval = RIG_OK;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmd,
retval = write_block(rp, (unsigned char *) cmd,
cmd_len);
RETURNFUNC(retval);
@ -156,13 +157,13 @@ int anytone_send(RIG *rig,
int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected)
{
int retval = RIG_OK;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
// retval = read_string(&rs->rigport, (unsigned char *) buf, buf_len,
// retval = read_string(rp, (unsigned char *) buf, buf_len,
// NULL, 0, 0, expected);
retval = read_block(&rs->rigport, buf, expected);
retval = read_block(rp, buf, expected);
if (retval > 0)
{
@ -257,15 +258,16 @@ int anytone_cleanup(RIG *rig)
int anytone_open(RIG *rig)
{
int retval = RIG_OK;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
unsigned char cmd[] = { 0x2B, 0x41, 0x44, 0x41, 0x54, 0x41, 0x3A, 0x30, 0x30, 0x2C, 0x30, 0x30, 0x31, 0x0d, 0x0a, 'a', 0x0d, 0x0a };
write_block(&rig->state.rigport, cmd, sizeof(cmd));
write_block(rp, cmd, sizeof(cmd));
hl_usleep(500 * 1000);
char cmd2[64];
SNPRINTF(cmd2, sizeof(cmd2), "+ADATA:00,016\r\n%cD578UV COM MODE\r\n", 0x01);
write_block(&rig->state.rigport, (unsigned char *)cmd2, strlen(cmd2));
write_block(rp, (unsigned char *)cmd2, strlen(cmd2));
SNPRINTF(cmd2, sizeof(cmd2), "+ADATA:00,000\r\n");
unsigned char reply[512];
anytone_transaction(rig, (unsigned char *)cmd2, strlen(cmd2), reply,
@ -382,6 +384,7 @@ int anytone_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
char cmd[32];
int retval;
hamlib_port_t *rp = RIGPORT(rig);
SNPRINTF(cmd, sizeof(cmd), "+ADATA:00,006\r\n");
cmd[15] = 0x04;
@ -398,13 +401,13 @@ int anytone_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int retry = 2;
MUTEX_LOCK(p->priv.mutex);
rig_flush(&rig->state.rigport);
rig_flush(rp);
do
{
write_block(&rig->state.rigport, (unsigned char *)cmd, 25);
write_block(rp, (unsigned char *)cmd, 25);
unsigned char buf[512];
retval = read_block(&rig->state.rigport, buf, 138);
retval = read_block(rp, buf, 138);
if (retval == 138)
{
@ -423,6 +426,7 @@ int anytone_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int anytone_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
char cmd[64];
hamlib_port_t *rp = RIGPORT(rig);
if (vfo == RIG_VFO_A)
{
@ -434,14 +438,14 @@ int anytone_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
MUTEX_LOCK(p->priv.mutex);
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, (unsigned char *) cmd, 20);
rig_flush(rp);
write_block(rp, (unsigned char *) cmd, 20);
unsigned char backend[] = { 0x2f, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x15, 0x50, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x09, 0x00, 0x00, 0x0d, 0x0a};
snprintf(cmd, sizeof(cmd), "ADATA:00,023\r\n");
int bytes = strlen(cmd) + sizeof(backend);
memcpy(&cmd[15], backend, sizeof(backend));
hl_usleep(10 * 1000);
write_block(&rig->state.rigport, (unsigned char *)cmd, bytes);
write_block(rp, (unsigned char *)cmd, bytes);
MUTEX_UNLOCK(p->priv.mutex);
return -RIG_ENIMPL;

Wyświetl plik

@ -67,15 +67,13 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
char ackbuf[BUFSZ];
int ack_len;
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -95,7 +93,7 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
@ -124,7 +122,7 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (retval >= 1 && data[0] == '?')
{
/* command failed? resync with radio */
write_block(&rs->rigport, (unsigned char *) EOM, 1);
write_block(rp, (unsigned char *) EOM, 1);
return -RIG_EPROTO;
}
@ -144,7 +142,7 @@ int aor_close(RIG *rig)
* since no reply is to be expected.
*/
return write_block(&rig->state.rigport, (unsigned char *) "EX" EOM, 3);
return write_block(RIGPORT(rig), (unsigned char *) "EX" EOM, 3);
}
static int format_freq(char *buf, int buf_len, freq_t freq)
@ -1423,7 +1421,7 @@ int aor_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg)
/*
* get next line
*/
retval = read_string(&rig->state.rigport, (unsigned char *) chanbuf, BUFSZ,
retval = read_string(RIGPORT(rig), (unsigned char *) chanbuf, BUFSZ,
EOM, strlen(EOM), 0, 1);
if (retval < 0)

Wyświetl plik

@ -185,13 +185,11 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -204,7 +202,7 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
retval = read_string(rp, (unsigned char *) data, BUFSZ,
EOM, strlen(EOM), 0, 1);
if (retval == -RIG_ETIMEOUT)

Wyświetl plik

@ -216,22 +216,20 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
char *data, int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int retry = 3;
char tmpdata[BUFSZ];
rs = &rig->state;
if (data == NULL)
{
data = tmpdata;
}
rig_flush(&rs->rigport);
rig_flush(rp);
do
{
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -242,7 +240,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
if (data)
{
/* expecting 0x0d0x0a on all commands so wait for the 0x0a */
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
retval = read_string(rp, (unsigned char *) data, BUFSZ,
"\x0a", 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
@ -307,12 +305,10 @@ int ar3030_cleanup(RIG *rig)
int ar3030_close(RIG *rig)
{
int retval;
struct rig_state *rs;
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(RIGPORT(rig));
retval = ar3030_transaction(rig, "Q" CR, strlen("Q" CR), NULL, NULL);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);

Wyświetl plik

@ -66,7 +66,7 @@
static int rxr_writeByte(RIG *rig, unsigned char c)
{
return write_block(&rig->state.rigport, &c, 1);
return write_block(RIGPORT(rig), &c, 1);
}
@ -75,14 +75,14 @@ static int rxr_readByte(RIG *rig)
unsigned char response[1];
const unsigned char buf[] = {0x71}; // Read command
int retval;
retval = write_block(&rig->state.rigport, buf, 1);
retval = write_block(RIGPORT(rig), buf, 1);
if (retval != RIG_OK)
{
return retval;
}
retval = read_block(&rig->state.rigport, response, 1);
retval = read_block(RIGPORT(rig), response, 1);
if (retval != RIG_OK)
{
@ -270,16 +270,17 @@ static void Execute_Routine_6_1(RIG *rig, char mp, char ad, int numSteps)
static int Execute_Routine_14(RIG *rig)
{
unsigned char response[1];
hamlib_port_t *rp = RIGPORT(rig);
const unsigned char buf[] = {0x2e}; // Read command
int retval;
retval = write_block(&rig->state.rigport, buf, 1);
retval = write_block(rp, buf, 1);
if (retval != RIG_OK)
{
return retval;
}
retval = read_block(&rig->state.rigport, response, 1);
retval = read_block(rp, response, 1);
if (retval != RIG_OK)
{

Wyświetl plik

@ -266,7 +266,7 @@ static int ar7030p_init(RIG *rig)
rig->state.priv = (void *) priv;
rig->state.rigport.type.rig = RIG_PORT_SERIAL;
RIGPORT(rig)->type.rig = RIG_PORT_SERIAL;
priv->powerstat = RIG_POWER_ON;
priv->bank = 0;

Wyświetl plik

@ -56,7 +56,7 @@ int NOP(RIG *rig, unsigned char x)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -78,7 +78,7 @@ int SRH(RIG *rig, unsigned char x)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -108,7 +108,7 @@ int PGE(RIG *rig, enum PAGE_e page)
case EEPROM2:
case EEPROM3:
case ROM:
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -141,7 +141,7 @@ int ADR(RIG *rig, unsigned char x)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -163,7 +163,7 @@ int ADH(RIG *rig, unsigned char x)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -187,7 +187,7 @@ int WRD(RIG *rig, unsigned char out)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -210,7 +210,7 @@ int MSK(RIG *rig, unsigned char mask)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -248,7 +248,7 @@ int EXE(RIG *rig, enum ROUTINE_e routine)
case DISP_BUFF:
case READ_SIGNAL:
case READ_BTNS:
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -280,7 +280,7 @@ int RDD(RIG *rig, unsigned char len)
assert(NULL != rig);
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -288,7 +288,7 @@ int RDD(RIG *rig, unsigned char len)
}
else
{
rc = read_block(&rig->state.rigport, (char *) &inChr, len);
rc = read_block(RIGPORT(rig), (char *) &inChr, len);
if (1 != rc)
{
@ -321,7 +321,7 @@ int LOC(RIG *rig, enum LOCK_LVL_e level)
case LOCK_1:
case LOCK_2:
case LOCK_3:
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -366,7 +366,7 @@ int BUT(RIG *rig, enum BUTTON_e button)
case BTN_STAR:
case BTN_MENU:
case BTN_POWER:
rc = write_block(&rig->state.rigport, (char *) &op, 1);
rc = write_block(RIGPORT(rig), (char *) &op, 1);
if (0 != rc)
{
@ -403,7 +403,7 @@ int execRoutine(RIG *rig, enum ROUTINE_e rtn)
assert(NULL != rig);
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(RIGPORT(rig), &v, 1))
{
rc = RIG_OK;
@ -428,6 +428,7 @@ int execRoutine(RIG *rig, enum ROUTINE_e rtn)
static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
{
int rc = RIG_OK;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char v;
assert(NULL != rig);
@ -440,7 +441,7 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
{
v = PGE(page);
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(rp, &v, 1))
{
curPage = page;
rc = RIG_OK;
@ -457,7 +458,7 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
{
v = SRH((0x0f0 & addr) >> 4);
rc = write_block(&rig->state.rigport, &v, 1);
rc = write_block(rp, &v, 1);
if (rc != RIG_OK)
{
@ -466,13 +467,13 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
v = ADR((0x00f & addr));
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(rp, &v, 1))
{
if (0xff < addr)
{
v = ADH((0xf00 & addr) >> 8);
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(rp, &v, 1))
{
curAddr = addr;
rc = RIG_OK;
@ -525,6 +526,7 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr)
int writeByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x)
{
int rc;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char hi = SRH((x & 0xf0) >> 4);
unsigned char lo = WRD(x & 0x0f);
@ -536,9 +538,9 @@ int writeByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x)
{
rc = -RIG_EIO;
if (0 == write_block(&rig->state.rigport, &hi, 1))
if (0 == write_block(rp, &hi, 1))
{
if (0 == write_block(&rig->state.rigport, &lo, 1))
if (0 == write_block(rp, &lo, 1))
{
rc = RIG_OK;
curAddr++;
@ -667,6 +669,7 @@ int writeInt(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x)
int readByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x)
{
int rc = RIG_OK;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char v = RDD(1); // Read command
assert(NULL != rig);
@ -678,9 +681,9 @@ int readByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x)
{
rc = -RIG_EIO;
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(rp, &v, 1))
{
if (1 == read_block(&rig->state.rigport, x, 1))
if (1 == read_block(rp, x, 1))
{
curAddr++;
rc = RIG_OK;
@ -841,7 +844,7 @@ int readSignal(RIG *rig, unsigned char *x)
if (RIG_OK == rc)
{
if (1 == read_block(&rig->state.rigport, x, 1))
if (1 == read_block(RIGPORT(rig), x, 1))
{
rc = RIG_OK;
@ -867,7 +870,7 @@ int flushBuffer(RIG *rig)
assert(NULL != rig);
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(RIGPORT(rig), &v, 1))
{
rc = RIG_OK;
}
@ -896,7 +899,7 @@ int lockRx(RIG *rig, enum LOCK_LVL_e level)
{
v = LOC(level);
if (0 == write_block(&rig->state.rigport, &v, 1))
if (0 == write_block(RIGPORT(rig), &v, 1))
{
rc = RIG_OK;

Wyświetl plik

@ -274,15 +274,13 @@ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len,
char *data, int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
char ackbuf[BUFSZ];
int ack_len;
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -302,7 +300,7 @@ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
@ -324,7 +322,7 @@ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len,
if (data[0] == '?')
{
/* command failed? resync with radio */
write_block(&rs->rigport, (unsigned char *) EOM, 1);
write_block(rp, (unsigned char *) EOM, 1);
return -RIG_EPROTO;
}

Wyświetl plik

@ -58,12 +58,11 @@ DECLARE_INITRIG_BACKEND(barrett)
int barrett_transaction2(RIG *rig, char *cmd, int expected, char **result)
{
char cmd_buf[MAXCMDLEN];
struct rig_state *rs = &rig->state;
struct barrett_priv_data *priv = rig->state.priv;
int retval;
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%c%s%s", 0x0a, cmd, EOM);
retval = read_block(&rs->rigport, (unsigned char *) priv->ret_data, expected);
retval = read_block(RIGPORT(rig), (unsigned char *) priv->ret_data, expected);
if (retval < 0)
{
@ -80,7 +79,7 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
char *p;
char xon;
char xoff;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct barrett_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s\n", __func__, cmd);
@ -93,8 +92,8 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%s%s", cmd, EOM);
}
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd_buf, strlen(cmd_buf));
rig_flush(rp);
retval = write_block(rp, (unsigned char *) cmd_buf, strlen(cmd_buf));
if (retval < 0)
{
@ -104,7 +103,7 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
if (expected == 0)
{
// response format is 0x11,data...,0x0d,0x0a,0x13
retval = read_string(&rs->rigport, (unsigned char *) priv->ret_data,
retval = read_string(rp, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
"\x11", 1, 0, 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s: resultlen=%d\n", __func__,
@ -118,7 +117,7 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
}
else
{
retval = read_block(&rs->rigport, (unsigned char *) priv->ret_data, expected);
retval = read_block(rp, (unsigned char *) priv->ret_data, expected);
if (retval < 0)
{
@ -704,7 +703,7 @@ int barrett_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int barrett_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
char cmd_buf[MAXCMDLEN];
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int retval;
switch (level)
@ -716,8 +715,8 @@ int barrett_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
default: return -RIG_ENIMPL;
}
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd_buf, strlen(cmd_buf));
rig_flush(rp);
retval = write_block(rp, (unsigned char *) cmd_buf, strlen(cmd_buf));
if (retval < 0)
{

Wyświetl plik

@ -46,7 +46,7 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
{
char cmd_buf[MAXCMDLEN];
int retval;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct codan_priv_data *priv = rig->state.priv;
//int retry = 3;
@ -54,8 +54,8 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%s%s", cmd, EOM);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd_buf, strlen(cmd_buf));
rig_flush(rp);
retval = write_block(rp, (unsigned char *) cmd_buf, strlen(cmd_buf));
hl_usleep(rig->caps->post_write_delay);
if (retval < 0)
@ -66,7 +66,7 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
if (expected == 0)
{
// response format is response...0x0d0x0a
retval = read_string(&rs->rigport, (unsigned char *) priv->ret_data,
retval = read_string(rp, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
"\x0a", 1, 0, 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s: result=%s, resultlen=%d\n", __func__,
@ -79,7 +79,7 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
}
else
{
retval = read_string(&rs->rigport, (unsigned char *) priv->ret_data,
retval = read_string(rp, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
"\x0a", 1, 0, 1);
@ -91,7 +91,7 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
if (strncmp(priv->ret_data, "LEVELS:", 7) == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, priv->ret_data);
retval = read_string(&rs->rigport, (unsigned char *) priv->ret_data,
retval = read_string(rp, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
"\x0a", 1, 0, 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, priv->ret_data);
@ -105,7 +105,7 @@ int codan_transaction(RIG *rig, char *cmd, int expected, char **result)
&& sscanf(priv->ret_data, "%d:%d:%d", &hr, &min, &sec) != 3)
{
char tmpbuf[256];
retval = read_string(&rs->rigport, (unsigned char *) tmpbuf,
retval = read_string(rp, (unsigned char *) tmpbuf,
sizeof(priv->ret_data),
"\x0a", 1, 0, 1);

Wyświetl plik

@ -52,7 +52,7 @@ struct dra818_priv
static int dra818_response(RIG *rig, const char *expected)
{
char response[80];
int r = read_string(&rig->state.rigport, (unsigned char *) response,
int r = read_string(RIGPORT(rig), (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);
@ -114,7 +114,7 @@ static int dra818_setgroup(RIG *rig)
(int)(priv->tx_freq / 1000000), (int)((priv->tx_freq % 1000000) / 100),
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100),
subtx, priv->sql, subrx);
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
return dra818_response(rig, dra818_setgroup_res);
}
@ -125,7 +125,7 @@ static int dra818_setvolume(RIG *rig)
char cmd[80];
SNPRINTF(cmd, sizeof(cmd), "AT+DMOSETVOLUME=%1d\r\n", priv->vol);
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
return dra818_response(rig, dra818_setvolume_res);
}
@ -186,7 +186,7 @@ int dra818_open(RIG *rig)
for (i = 0; i < 3; i++)
{
write_block(&rig->state.rigport, (unsigned char *) dra818_handshake_cmd,
write_block(RIGPORT(rig), (unsigned char *) dra818_handshake_cmd,
strlen(dra818_handshake_cmd));
r = dra818_response(rig, dra818_handshake_res);
@ -281,15 +281,16 @@ int dra818_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int dra818_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
const struct dra818_priv *priv = rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
char cmd[80];
char response[8];
int r;
SNPRINTF(cmd, sizeof(cmd), "S+%03d.%04d\r\n",
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
write_block(rp, (unsigned char *) cmd, strlen(cmd));
r = read_string(&rig->state.rigport, (unsigned char *) response,
r = read_string(rp, (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);

Wyświetl plik

@ -59,13 +59,11 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -78,7 +76,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
retval = read_string(rp, (unsigned char *) data, BUFSZ,
LF, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)

Wyświetl plik

@ -137,7 +137,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "</CMD>\r\n";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -154,7 +153,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
@ -215,12 +214,9 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
*/
static int write_transaction(RIG *rig, char *xml, int xml_len)
{
int try = rig->caps->retry;
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -234,11 +230,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -320,6 +316,7 @@ static int aclog_transaction(RIG *rig, char *cmd, char *value,
static int aclog_init(RIG *rig)
{
struct aclog_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -353,8 +350,7 @@ static int aclog_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -62,7 +62,7 @@ static int dummy_amp_init(AMP *amp)
priv = amp->state.priv;
amp->state.ampport.type.rig = RIG_PORT_NONE;
AMPPORT(amp)->type.rig = RIG_PORT_NONE;
priv->freq = 0;

Wyświetl plik

@ -231,7 +231,7 @@ static int dummy_init(RIG *rig)
rig->state.priv = (void *)priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig->state.rigport.type.rig = RIG_PORT_NONE;
RIGPORT(rig)->type.rig = RIG_PORT_NONE;
priv->split = RIG_SPLIT_OFF;
priv->ptt = RIG_PTT_OFF;
@ -743,6 +743,7 @@ static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
const struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
hamlib_port_t *pttp = PTTPORT(rig);
int rc;
int status = 0;
@ -751,12 +752,12 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
// sneak a look at the hardware PTT and OR that in with our result
// as if it had keyed us
switch (rig->state.pttport.type.ptt)
switch (pttp->type.ptt)
{
case RIG_PTT_SERIAL_DTR:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = ser_get_dtr(&rig->state.pttport, &status))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = ser_get_dtr(pttp, &status))) { RETURNFUNC(rc); }
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
}
@ -768,9 +769,9 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
break;
case RIG_PTT_SERIAL_RTS:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = ser_get_rts(&rig->state.pttport, &status))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = ser_get_rts(pttp, &status))) { RETURNFUNC(rc); }
*ptt = status ? RIG_PTT_ON : RIG_PTT_OFF;
}
@ -782,26 +783,26 @@ static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
break;
case RIG_PTT_PARALLEL:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = par_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = par_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;
case RIG_PTT_CM108:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = cm108_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = cm108_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;
case RIG_PTT_GPIO:
case RIG_PTT_GPION:
if (rig->state.pttport.fd >= 0)
if (pttp->fd >= 0)
{
if (RIG_OK != (rc = gpio_ptt_get(&rig->state.pttport, ptt))) { RETURNFUNC(rc); }
if (RIG_OK != (rc = gpio_ptt_get(pttp, ptt))) { RETURNFUNC(rc); }
}
break;

Wyświetl plik

@ -297,7 +297,7 @@ static char *xml_build(RIG *rig, char *cmd, char *value, char *xmlbuf,
SNPRINTF(xml, sizeof(xml),
"<?xml version=\"1.0\"?>\r\n<?clientid=\"hamlib(%d)\"?>\r\n",
rig->state.rigport.client_port);
RIGPORT(rig)->client_port);
strncat(xml, "<methodCall><methodName>", sizeof(xml) - 1);
strncat(xml, cmd, sizeof(xml) - strlen(xml) - 1);
@ -430,7 +430,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "</methodResponse>";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -448,7 +447,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
}
rig_debug(RIG_DEBUG_TRACE, "%s: before read_string\n", __func__);
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
// "</methodResponse>", 17,0,1);
@ -517,7 +516,7 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -531,11 +530,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -619,6 +618,7 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
static int flrig_init(RIG *rig)
{
struct flrig_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -653,8 +653,7 @@ static int flrig_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
priv->ext_parms = alloc_init_ext(flrig_ext_parms);

Wyświetl plik

@ -34,15 +34,16 @@
static int netampctl_transaction(AMP *amp, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *ampp = AMPPORT(amp);
ret = write_block(&amp->state.ampport, (unsigned char *) cmd, len);
ret = write_block(ampp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
@ -62,6 +63,7 @@ static int netampctl_open(AMP *amp)
{
int ret;
//struct amp_state *rs = &amp->state;
hamlib_port_t *ampp = AMPPORT(amp);
int pamp_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -86,9 +88,10 @@ static int netampctl_open(AMP *amp)
return -RIG_EPROTO;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
@ -96,7 +99,7 @@ static int netampctl_open(AMP *amp)
do
{
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ampp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret > 0)
@ -120,7 +123,7 @@ static int netampctl_close(AMP *amp)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
/* clean signoff, no read back */
write_block(&amp->state.ampport, (unsigned char *) "q\n", 2);
write_block(AMPPORT(amp), (unsigned char *) "q\n", 2);
return RIG_OK;
}

Wyświetl plik

@ -58,21 +58,21 @@ int netrigctl_get_vfo_mode(RIG *rig)
static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called len=%d\n", __func__, len);
/* flush anything in the read buffer before command is sent */
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = write_block(&rig->state.rigport, (unsigned char *) cmd, len);
ret = write_block(rp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret < 0)
{
@ -248,6 +248,7 @@ static int netrigctl_open(RIG *rig)
{
int ret, i;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int prot_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -303,16 +304,14 @@ static int netrigctl_open(RIG *rig)
RETURNFUNC(-RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -323,8 +322,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -354,8 +352,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -397,8 +394,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -422,8 +418,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -450,8 +445,7 @@ static int netrigctl_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -460,8 +454,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -470,8 +463,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -480,8 +472,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -490,8 +481,7 @@ static int netrigctl_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -518,8 +508,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -546,8 +535,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -556,8 +544,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -566,8 +553,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -589,8 +575,7 @@ static int netrigctl_open(RIG *rig)
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -599,8 +584,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -609,8 +593,7 @@ static int netrigctl_open(RIG *rig)
rs->has_get_parm = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -648,8 +631,8 @@ static int netrigctl_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
hamlib_port_t *pttp = PTTPORT(rig);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -672,7 +655,7 @@ static int netrigctl_open(RIG *rig)
ptt_type_t temp = (ptt_type_t)strtol(value, NULL, 0);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type='%s'(%d)\n", __func__, value, temp);
if (RIG_PTT_RIG_MICDATA == rig->state.pttport.type.ptt
if (RIG_PTT_RIG_MICDATA == pttp->type.ptt
|| temp == RIG_PTT_RIG_MICDATA)
{
/*
@ -680,15 +663,15 @@ static int netrigctl_open(RIG *rig)
* if there is any PTT capability and we have not
* locally overridden it
*/
rig->state.pttport.type.ptt = RIG_PTT_RIG_MICDATA;
pttp->type.ptt = RIG_PTT_RIG_MICDATA;
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
rig->state.pttport.type.ptt);
pttp->type.ptt);
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp);
rig->state.pttport.type.ptt = temp;
pttp->type.ptt = temp;
rig->caps->ptt_type = temp;
}
}
@ -1016,7 +999,7 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(RIGPORT(rig), buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1087,7 +1070,7 @@ static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1170,12 +1153,13 @@ static int netrigctl_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
char cmd[CMD_MAX];
char buf[BUF_MAX];
char vfostr[16] = "";
hamlib_port_t *pttp = PTTPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, ptt=%d, ptt_type=%d\n",
__func__,
rig_strvfo(vfo), ptt, rig->state.pttport.type.ptt);
rig_strvfo(vfo), ptt, pttp->type.ptt);
if (rig->state.pttport.type.ptt == RIG_PTT_NONE) { return RIG_OK; }
if (pttp->type.ptt == RIG_PTT_NONE) { return RIG_OK; }
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A);
@ -1703,7 +1687,7 @@ static int netrigctl_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1771,7 +1755,7 @@ static int netrigctl_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -2318,7 +2302,7 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)

Wyświetl plik

@ -35,18 +35,19 @@
static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rotp = ROTPORT(rot);
/* flush anything in the read buffer before command is sent */
rig_flush(&rot->state.rotport);
rig_flush(rotp);
ret = write_block(&rot->state.rotport, (unsigned char *) cmd, len);
ret = write_block(rotp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
@ -66,6 +67,7 @@ static int netrotctl_open(ROT *rot)
{
int ret;
struct rot_state *rs = &rot->state;
hamlib_port_t *rotp = ROTPORT(rot);
int prot_ver;
char cmd[CMD_MAX];
char buf[BUF_MAX];
@ -85,7 +87,7 @@ static int netrotctl_open(ROT *rot)
prot_ver = atoi(buf);
#define ROTCTLD_PROT_VER 1
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
@ -100,7 +102,7 @@ static int netrotctl_open(ROT *rot)
{
char setting[32], value[1024];
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(rotp, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
@ -158,7 +160,7 @@ static int netrotctl_close(ROT *rot)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
/* clean signoff, no read back */
write_block(&rot->state.rotport, (unsigned char *) "q\n", 2);
write_block(ROTPORT(rot), (unsigned char *) "q\n", 2);
return RIG_OK;
}
@ -205,7 +207,7 @@ static int netrotctl_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
*az = atof(buf);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
ret = read_string(ROTPORT(rot), (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)

Wyświetl plik

@ -61,20 +61,21 @@ int quisk_get_vfo_mode(RIG *rig)
static int quisk_transaction(RIG *rig, char *cmd, int len, char *buf)
{
int ret;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called len=%d\n", __func__, len);
/* flush anything in the read buffer before command is sent */
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = write_block(&rig->state.rigport, (unsigned char *) cmd, len);
ret = write_block(rp, (unsigned char *) cmd, len);
if (ret != RIG_OK)
{
return ret;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret < 0)
@ -212,6 +213,7 @@ static int quisk_open(RIG *rig)
char cmd[CMD_MAX];
char buf[BUF_MAX];
struct quisk_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -237,16 +239,14 @@ static int quisk_open(RIG *rig)
RETURNFUNC(-RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -257,8 +257,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -288,8 +287,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -331,8 +329,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -356,8 +353,7 @@ static int quisk_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -384,8 +380,7 @@ static int quisk_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -394,8 +389,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -404,8 +398,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -414,8 +407,7 @@ static int quisk_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -424,8 +416,7 @@ static int quisk_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -452,8 +443,7 @@ static int quisk_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -480,8 +470,7 @@ static int quisk_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -491,8 +480,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -502,8 +490,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -526,8 +513,7 @@ static int quisk_open(RIG *rig)
#endif
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -537,8 +523,7 @@ static int quisk_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -549,8 +534,7 @@ static int quisk_open(RIG *rig)
#if 0
HAMLIB_TRACE;
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -599,8 +583,8 @@ static int quisk_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
hamlib_port_t *pttp = PTTPORT(rig);
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -623,7 +607,7 @@ static int quisk_open(RIG *rig)
ptt_type_t temp = (ptt_type_t)strtol(value, NULL, 0);
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type='%s'(%d)\n", __func__, value, temp);
if (RIG_PTT_RIG_MICDATA == rig->state.pttport.type.ptt
if (RIG_PTT_RIG_MICDATA == pttp->type.ptt
|| temp == RIG_PTT_RIG_MICDATA)
{
/*
@ -631,15 +615,15 @@ static int quisk_open(RIG *rig)
* if there is any PTT capability and we have not
* locally overridden it
*/
rig->state.pttport.type.ptt = RIG_PTT_RIG_MICDATA;
pttp->type.ptt = RIG_PTT_RIG_MICDATA;
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
rig->state.pttport.type.ptt);
pttp->type.ptt);
}
else
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp);
rig->state.pttport.type.ptt = temp;
pttp->type.ptt = temp;
rig->caps->ptt_type = temp;
}
}
@ -955,7 +939,7 @@ static int quisk_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(RIGPORT(rig), buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1026,7 +1010,7 @@ static int quisk_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
@ -1114,9 +1098,9 @@ static int quisk_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, ptt=%d, ptt_type=%d\n",
__func__,
rig_strvfo(vfo), ptt, rig->state.pttport.type.ptt);
rig_strvfo(vfo), ptt, PTTPORT(rig)->type.ptt);
if (rig->state.pttport.type.ptt == RIG_PTT_NONE) { return RIG_OK; }
if (PTTPORT(rig)->type.ptt == RIG_PTT_NONE) { return RIG_OK; }
ret = quisk_vfostr(rig, vfostr, sizeof(vfostr), RIG_VFO_A);
@ -1645,8 +1629,7 @@ static int quisk_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -1713,8 +1696,7 @@ static int quisk_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{
@ -2268,8 +2250,7 @@ static int quisk_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
if (ret <= 0)
{

Wyświetl plik

@ -151,7 +151,7 @@ static int dummy_rot_init(ROT *rot)
return -RIG_ENOMEM;
}
rot->state.rotport.type.rig = RIG_PORT_NONE;
ROTPORT(rot)->type.rig = RIG_PORT_NONE;
priv->az = priv->el = 0;

Wyświetl plik

@ -101,7 +101,6 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
int retry;
char *delims;
char *terminator = "\n";
struct rig_state *rs = &rig->state;
ENTERFUNC;
@ -118,7 +117,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
int len = read_string(RIGPORT(rig), (unsigned char *) tmp_buf, sizeof(tmp_buf),
delims,
strlen(delims), 0, 1);
@ -175,7 +174,7 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -189,11 +188,11 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, (unsigned char *) xml, strlen(xml));
retval = write_block(rp, (unsigned char *) xml, strlen(xml));
if (retval < 0)
{
@ -270,6 +269,7 @@ static int sdrsharp_transaction(RIG *rig, char *cmd, char *value,
static int sdrsharp_init(RIG *rig)
{
struct sdrsharp_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -303,8 +303,7 @@ static int sdrsharp_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
RETURNFUNC(RIG_OK);
}

Wyświetl plik

@ -273,7 +273,6 @@ static int check_vfo(vfo_t vfo)
static int read_transaction(RIG *rig, unsigned char *buf, int buf_len)
{
int retry;
struct rig_state *rs = &rig->state;
char *delims = ";";
ENTERFUNC;
@ -287,7 +286,7 @@ static int read_transaction(RIG *rig, unsigned char *buf, int buf_len)
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
}
int len = read_string(&rs->rigport, buf, buf_len, delims,
int len = read_string(RIGPORT(rig), buf, buf_len, delims,
strlen(delims), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, buf);
@ -320,7 +319,7 @@ static int write_transaction(RIG *rig, const unsigned char *buf, int buf_len)
int retval = -RIG_EPROTO;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
@ -334,11 +333,11 @@ static int write_transaction(RIG *rig, const unsigned char *buf, int buf_len)
// appears we can lose sync if we don't clear things out
// shouldn't be anything for us now anyways
rig_flush(&rig->state.rigport);
rig_flush(rp);
while (try-- >= 0 && retval != RIG_OK)
{
retval = write_block(&rs->rigport, buf, buf_len);
retval = write_block(rp, buf, buf_len);
if (retval < 0)
{
@ -420,6 +419,7 @@ static int tci1x_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
static int tci1x_init(RIG *rig)
{
struct tci1x_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -453,8 +453,7 @@ static int tci1x_init(RIG *rig)
RETURNFUNC(-RIG_EINVAL);
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
priv->ext_parms = alloc_init_ext(tci1x_ext_parms);

Wyświetl plik

@ -228,13 +228,12 @@ static int vfo_curr(RIG *rig, vfo_t vfo)
*/
static int read_transaction(RIG *rig, char *response, int response_len)
{
struct rig_state *rs = &rig->state;
const char *delims = "\n";
int len;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
len = read_string(&rs->rigport, (unsigned char *) response, response_len,
len = read_string(RIGPORT(rig), (unsigned char *) response, response_len,
delims,
strlen(delims), 0, 1);
@ -254,6 +253,7 @@ static int read_transaction(RIG *rig, char *response, int response_len)
static int trxmanager_init(RIG *rig)
{
struct trxmanager_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
@ -280,8 +280,7 @@ static int trxmanager_init(RIG *rig)
return -RIG_EINVAL;
}
strncpy(rig->state.rigport.pathname, DEFAULTPATH,
sizeof(rig->state.rigport.pathname));
strncpy(rp->pathname, DEFAULTPATH, sizeof(rp->pathname));
return RIG_OK;
}
@ -296,13 +295,13 @@ static int trxmanager_open(RIG *rig)
char *cmd;
char *saveptr;
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, BACKEND_VER);
rs->rigport.timeout = 10000; // long timeout for antenna switching/tuning
rp->timeout = 10000; // long timeout for antenna switching/tuning
retval = read_transaction(rig, response, sizeof(response));
if (retval != RIG_OK)
@ -323,7 +322,7 @@ static int trxmanager_open(RIG *rig)
// Turn off active messages
cmd = "AI0;";
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -346,7 +345,7 @@ static int trxmanager_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s AI response=%s\n", __func__, response);
cmd = "FN;";
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval != RIG_OK)
{
@ -405,7 +404,6 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char vfoab;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -434,7 +432,7 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
vfoab = vfo == RIG_VFO_A ? 'R' : 'T';
SNPRINTF(cmd, sizeof(cmd), "X%c;", vfoab);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -475,7 +473,6 @@ static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char vfoab;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -504,7 +501,7 @@ static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vfoab = vfo == RIG_VFO_A ? 'A' : 'B';
SNPRINTF(cmd, sizeof(cmd), "F%c%011lu;", vfoab, (unsigned long)freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -531,7 +528,6 @@ static int trxmanager_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: ptt=%d\n", __func__, ptt);
@ -543,7 +539,7 @@ static int trxmanager_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
}
SNPRINTF(cmd, sizeof(cmd), "%s;", ptt == 1 ? "TX" : "RX");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -576,13 +572,12 @@ static int trxmanager_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
char cptt;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo));
SNPRINTF(cmd, sizeof(cmd), "IF;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -635,7 +630,6 @@ static int trxmanager_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
char ttmode;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s mode=%s width=%d\n",
__func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width);
@ -707,7 +701,7 @@ static int trxmanager_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
}
SNPRINTF(cmd, sizeof(cmd), "MD%c;", ttmode);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -742,7 +736,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
char tmode;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -770,7 +764,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
rig_strvfo(vfo));
SNPRINTF(cmd, sizeof(cmd), "MD;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -843,7 +837,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
// now get the bandwidth
SNPRINTF(cmd, sizeof(cmd), "BW;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -910,7 +904,7 @@ static int trxmanager_set_vfo(RIG *rig, vfo_t vfo)
}
SNPRINTF(cmd, sizeof(cmd), "FN%d;", vfo == RIG_VFO_A ? 0 : 1);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -982,7 +976,6 @@ static int trxmanager_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__,
rig_strvfo(vfo), tx_freq);
@ -995,7 +988,7 @@ static int trxmanager_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
}
SNPRINTF(cmd, sizeof(cmd), "XT%011lu;", (unsigned long) tx_freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1038,7 +1031,6 @@ static int trxmanager_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
char response[MAXCMDLEN] = "";
split_t tsplit;
vfo_t ttx_vfo;
struct rig_state *rs = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s\n", __func__,
rig_strvfo(tx_vfo));
@ -1063,7 +1055,7 @@ static int trxmanager_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
if (tsplit == split) { return RIG_OK; } // don't need to change it
SNPRINTF(cmd, sizeof(cmd), "SP%c;", split ? '1' : '0');
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1099,13 +1091,12 @@ static int trxmanager_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
int n;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
SNPRINTF(cmd, sizeof(cmd), "SP;");
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{
@ -1144,7 +1135,6 @@ static int trxmanager_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
int retval;
char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv;
@ -1158,7 +1148,7 @@ static int trxmanager_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
// assume split is on B
//
SNPRINTF(cmd, sizeof(cmd), "XT%011lu;", (unsigned long)freq);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
if (retval < 0)
{

Wyświetl plik

@ -167,6 +167,7 @@ int elad_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize)
struct elad_priv_data *priv = rig->state.priv;
const struct elad_priv_caps *caps = elad_caps(rig);
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int retval;
char cmdtrm[2]; /* Default Command/Reply termination char */
char *cmd;
@ -189,7 +190,7 @@ int elad_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize)
rs->transaction_active = 1;
/* Emulators don't need any post_write_delay */
if (priv->is_emulation) { rs->rigport.post_write_delay = 0; }
if (priv->is_emulation) { rp->post_write_delay = 0; }
cmdtrm[0] = caps->cmdtrm;
cmdtrm[1] = '\0';
@ -220,9 +221,9 @@ transaction_write:
}
/* flush anything in the read buffer before command is sent */
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmd, len);
retval = write_block(rp, (unsigned char *) cmd, len);
free(cmd);
@ -239,7 +240,7 @@ transaction_write:
/* no reply expected so we need to write a command that always
gives a reply so we can read any error replies from the actual
command being sent without blocking */
if (RIG_OK != (retval = write_block(&rs->rigport,
if (RIG_OK != (retval = write_block(rp,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
goto transaction_quit;
@ -250,12 +251,12 @@ transaction_read:
/* allow one extra byte for terminator we don't return */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 13,
ELAD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
retval = read_string(rp, (unsigned char *) buffer, len,
cmdtrm, strlen(cmdtrm), 0, 1);
if (retval < 0)
{
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -269,7 +270,7 @@ transaction_read:
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n",
__func__, buffer);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -301,7 +302,7 @@ transaction_read:
rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -318,7 +319,7 @@ transaction_read:
cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -335,7 +336,7 @@ transaction_read:
cmdstr);
}
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
hl_usleep(rig->caps->timeout * 1000);
@ -365,7 +366,7 @@ transaction_read:
rig_debug(RIG_DEBUG_ERR, "%s: Wrong reply %c%c for command %c%c\n",
__func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -398,7 +399,7 @@ transaction_read:
__func__, buffer[0], buffer[1]
, priv->verify_cmd[0], priv->verify_cmd[1], (int)datasize);
if (retry_read++ < rs->rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -470,7 +471,7 @@ int elad_safe_transaction(RIG *rig, const char *cmd, char *buf,
hl_usleep(rig->caps->timeout * 1000);
}
}
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
while (err != RIG_OK && ++retry < RIGPORT(rig)->retry);
return err;
}

Wyświetl plik

@ -328,7 +328,7 @@ static int send_command(RIG *rig, const char *cmdstr, size_t buflen)
{
int ret;
ret = write_block(&rig->state.rigport, (unsigned char *) cmdstr, buflen);
ret = write_block(RIGPORT(rig), (unsigned char *) cmdstr, buflen);
return ret;
}
@ -481,6 +481,7 @@ int dttsp_get_conf(RIG *rig, hamlib_token_t token, char *val)
int dttsp_init(RIG *rig)
{
struct dttsp_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
const char *cmdpath;
char *p;
@ -515,10 +516,10 @@ int dttsp_init(RIG *rig)
cmdpath = getenv("SDR_PARMPATH");
if (!cmdpath)
cmdpath = rig->state.rigport.type.rig == RIG_PORT_UDP_NETWORK ?
cmdpath = rp->type.rig == RIG_PORT_UDP_NETWORK ?
DEFAULT_DTTSP_CMD_NET_ADDR : DEFAULT_DTTSP_CMD_PATH;
strncpy(rig->state.rigport.pathname, cmdpath, HAMLIB_FILPATHLEN - 1);
strncpy(rp->pathname, cmdpath, HAMLIB_FILPATHLEN - 1);
return RIG_OK;
}
@ -530,6 +531,7 @@ int dttsp_open(RIG *rig)
int ret;
char *p;
char *meterpath;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
@ -561,18 +563,18 @@ int dttsp_open(RIG *rig)
}
/* open DttSP meter pipe */
priv->meter_port.post_write_delay = rig->state.rigport.post_write_delay;
priv->meter_port.timeout = rig->state.rigport.timeout;
priv->meter_port.retry = rig->state.rigport.retry;
priv->meter_port.post_write_delay = rp->post_write_delay;
priv->meter_port.timeout = rp->timeout;
priv->meter_port.retry = rp->retry;
p = getenv("SDR_METERPATH");
if (!p)
{
meterpath = priv->meter_port.pathname;
SNPRINTF(meterpath, HAMLIB_FILPATHLEN, "%s", rig->state.rigport.pathname);
SNPRINTF(meterpath, HAMLIB_FILPATHLEN, "%s", rp->pathname);
if (rig->state.rigport.type.rig == RIG_PORT_UDP_NETWORK)
if (rp->type.rig == RIG_PORT_UDP_NETWORK)
{
p = strrchr(meterpath, ':');
@ -605,7 +607,7 @@ int dttsp_open(RIG *rig)
}
else
{
priv->meter_port.type.rig = rig->state.rigport.type.rig;
priv->meter_port.type.rig = rp->type.rig;
ret = port_open(&priv->meter_port);
if (ret < 0)

Wyświetl plik

@ -216,7 +216,7 @@ int sdr1k_init(RIG *rig)
static void pdelay(RIG *rig)
{
unsigned char r;
par_read_data(&rig->state.rigport, &r); /* ~1us */
par_read_data(RIGPORT(rig), &r); /* ~1us */
}
int sdr1k_open(RIG *rig)
@ -453,7 +453,7 @@ int
write_latch(RIG *rig, latch_t which, unsigned value, unsigned mask)
{
struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv;
hamlib_port_t *pport = &rig->state.rigport;
hamlib_port_t *pport = RIGPORT(rig);
if (!(L_EXT <= which && which <= L_DDS1))
{

Wyświetl plik

@ -110,7 +110,7 @@ static int gs100_init(RIG *rig)
rig->state.priv = (void *)priv;
#ifdef _LOCAL_SIMULATION_
rig->state.rigport.type.rig = RIG_PORT_NONE; // just simulation
RIGPORT(rig)->type.rig = RIG_PORT_NONE; // just simulation
priv->freq_rx = rig->caps->rx_range_list1->startf;
priv->freq_tx = rig->caps->tx_range_list1->startf;
#endif
@ -520,7 +520,7 @@ static int gomx_get(RIG *rig, int table, char *varname, const char *varvalue,
/* Sends a message to the GS100 and parses response lines */
static int gomx_transaction(RIG *rig, char *message, char *response)
{
struct rig_state *rs;
hamlib_port_t *rp;
int retval, n = 0;
char buf[BUFSZ];
@ -531,18 +531,18 @@ static int gomx_transaction(RIG *rig, char *message, char *response)
rig_debug(RIG_DEBUG_TRACE, "%s: msg='%s'\n", __func__,
message == NULL ? "NULL" : message);
rs = &rig->state;
rp = RIGPORT(rig);
// send message to the transceiver
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (uint8_t *)message, strlen(message));
rig_flush(rp);
retval = write_block(rp, (uint8_t *)message, strlen(message));
if (retval != RIG_OK) { return (retval); }
while (1)
{
// read the response line
retval = read_string(&rs->rigport, (unsigned char *)buf, BUFSZ,
retval = read_string(rp, (unsigned char *)buf, BUFSZ,
(const char *)GOM_STOPSET, 0, strlen(GOM_STOPSET), 0);
if (retval < 0) { return (retval); }

Wyświetl plik

@ -241,6 +241,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
struct icmarine_priv_data *priv;
int i, retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ + 1];
char respbuf[BUFSZ + 1];
char *p;
@ -254,7 +255,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
rs = &rig->state;
priv = (struct icmarine_priv_data *)rs->priv;
rig_flush(&rs->rigport);
rig_flush(rp);
/* command formatting */
SNPRINTF(cmdbuf, BUFSZ, "$PICOA,%02d,%02u,%s",
@ -277,7 +278,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
cmd_len += snprintf(cmdbuf + cmd_len, BUFSZ - cmd_len, "*%02X" EOM, csum);
/* I/O */
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, cmd_len);
retval = write_block(rp, (unsigned char *) cmdbuf, cmd_len);
if (retval != RIG_OK)
{
@ -287,7 +288,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
/*
* Transceiver sends an echo of cmd followed by a CR/LF
*/
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, LF,
retval = read_string(rp, (unsigned char *) respbuf, BUFSZ, LF,
strlen(LF), 0, 1);
if (retval < 0)

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
{

Plik diff jest za duży Load Diff

Wyświetl plik

@ -35,7 +35,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20240201"
#define BACKEND_VER "20240204"
#define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31)
#define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51)
@ -293,6 +293,7 @@ struct icom_priv_data
int vfo_flag; // used to skip vfo check when frequencies are equal
int dual_watch_main_sub; // 0=main, 1=sub
int tone_enable; /*!< Re-enable tone after freq change -- IC-705 bug with gpredict */
int filternum; /*!< Filter number to use when setting mode */
};
extern const struct ts_sc_list r8500_ts_sc_list[];

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

@ -67,15 +67,13 @@ int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(rp);
set_transaction_active(rig);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -89,7 +87,7 @@ int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
set_transaction_inactive(rig);
@ -1612,7 +1610,6 @@ int jrc_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
int jrc_decode_event(RIG *rig)
{
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
struct rig_state *rs;
freq_t freq;
rmode_t mode;
pbwidth_t width;
@ -1621,13 +1618,11 @@ int jrc_decode_event(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: jrc_decode called\n", __func__);
rs = &rig->state;
/* "Iabdfg"CR */
//#define SETUP_STATUS_LEN 17
//count = read_string(&rs->rigport, buf, SETUP_STATUS_LEN, "", 0);
count = read_string(&rs->rigport, (unsigned char *) buf, priv->info_len, "", 0,
//count = read_string(RIGPORT(rig), buf, SETUP_STATUS_LEN, "", 0);
count = read_string(RIGPORT(rig), (unsigned char *) buf, priv->info_len, "", 0,
0, 1);
if (count < 0)

Wyświetl plik

@ -298,7 +298,7 @@ static int jst145_open(RIG *rig)
pbwidth_t width;
struct jst145_priv_data *priv = rig->state.priv;
retval = write_block(&rig->state.rigport, (unsigned char *) "H1\r", 3);
retval = write_block(RIGPORT(rig), (unsigned char *) "H1\r", 3);
if (retval != RIG_OK)
{
@ -317,7 +317,7 @@ static int jst145_open(RIG *rig)
static int jst145_close(RIG *rig)
{
return write_block(&rig->state.rigport, (unsigned char *) "H0\r", 3);
return write_block(RIGPORT(rig), (unsigned char *) "H0\r", 3);
}
static int jst145_set_vfo(RIG *rig, vfo_t vfo)
@ -325,7 +325,7 @@ static int jst145_set_vfo(RIG *rig, vfo_t vfo)
char cmd[MAX_LEN];
SNPRINTF(cmd, sizeof(cmd), "F%c\r", vfo == RIG_VFO_A ? 'A' : 'B');
return write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
return write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
}
static int jst145_get_vfo(RIG *rig, vfo_t *vfo)
@ -388,7 +388,7 @@ static int jst145_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv->freqA = freq;
}
retval = write_block(&rig->state.rigport, (unsigned char *) freqbuf,
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf,
strlen(freqbuf));
if (retval != RIG_OK)
@ -475,7 +475,7 @@ static int jst145_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
retval = write_block(&rig->state.rigport, (unsigned char *) modestr,
retval = write_block(RIGPORT(rig), (unsigned char *) modestr,
strlen(modestr));
if (retval != RIG_OK)
@ -542,7 +542,7 @@ static int jst145_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
char *cmd = val.i == RIG_AGC_SLOW ? "G0\r" : (val.i == RIG_AGC_FAST ? "G1\r" :
"G2\r");
return write_block(&rig->state.rigport, (unsigned char *) cmd, 3);
return write_block(RIGPORT(rig), (unsigned char *) cmd, 3);
}
default:
@ -558,7 +558,7 @@ static int jst145_set_mem(RIG *rig, vfo_t vfo, int ch)
SNPRINTF(membuf, sizeof(membuf), "C%03d\r", ch);
return write_block(&rig->state.rigport, (unsigned char *) membuf,
return write_block(RIGPORT(rig), (unsigned char *) membuf,
strlen(membuf));
}
@ -567,7 +567,7 @@ static int jst145_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch (op)
{
case RIG_OP_FROM_VFO:
return write_block(&rig->state.rigport, (unsigned char *) "E1\r", 3);
return write_block(RIGPORT(rig), (unsigned char *) "E1\r", 3);
default:
return -RIG_EINVAL;
@ -583,7 +583,7 @@ static int jst145_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__);
SNPRINTF(cmd, sizeof(cmd), "X%c\r", ptt ? '1' : '0');
priv->ptt = ptt;
return write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
return write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
}
static int jst145_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)

Wyświetl plik

@ -151,12 +151,12 @@ struct rig_caps nrd525_caps =
static int nrd525_open(RIG *rig)
{
return write_block(&rig->state.rigport, (unsigned char *) "H1", 2);
return write_block(RIGPORT(rig), (unsigned char *) "H1", 2);
}
static int nrd525_close(RIG *rig)
{
return write_block(&rig->state.rigport, (unsigned char *) "H0", 2);
return write_block(RIGPORT(rig), (unsigned char *) "H0", 2);
}
static int nrd525_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
@ -165,7 +165,7 @@ static int nrd525_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
SNPRINTF(freqbuf, sizeof(freqbuf), "F%08u", (unsigned)(freq / 10));
return write_block(&rig->state.rigport, (unsigned char *) freqbuf,
return write_block(RIGPORT(rig), (unsigned char *) freqbuf,
strlen(freqbuf));
}
@ -194,7 +194,7 @@ static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
retval = write_block(&rig->state.rigport, (unsigned char *) modestr,
retval = write_block(RIGPORT(rig), (unsigned char *) modestr,
strlen(modestr));
if (retval != RIG_OK)
@ -219,11 +219,11 @@ static int nrd525_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
switch (level)
{
case RIG_LEVEL_ATT:
return write_block(&rig->state.rigport,
return write_block(RIGPORT(rig),
(unsigned char *)(val.i != 0 ? "A1" : "A0"), 2);
case RIG_LEVEL_AGC:
return write_block(&rig->state.rigport,
return write_block(RIGPORT(rig),
(unsigned char *)(val.i == RIG_AGC_SLOW ? "G0" :
(val.i == RIG_AGC_FAST ? "G1" : "G2")), 2);
@ -238,7 +238,7 @@ static int nrd525_set_mem(RIG *rig, vfo_t vfo, int ch)
SNPRINTF(membuf, sizeof(membuf), "C%03d", ch);
return write_block(&rig->state.rigport, (unsigned char *) membuf,
return write_block(RIGPORT(rig), (unsigned char *) membuf,
strlen(membuf));
}
@ -247,7 +247,7 @@ static int nrd525_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
switch (op)
{
case RIG_OP_FROM_VFO:
return write_block(&rig->state.rigport, (unsigned char *) "E1", 2);
return write_block(RIGPORT(rig), (unsigned char *) "E1", 2);
default:
return -RIG_EINVAL;

Wyświetl plik

@ -65,26 +65,24 @@
static int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
{
int count, retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char buf4[4];
rs = &rig->state;
buf4[0] = STX;
buf4[1] = cmd1;
buf4[2] = cmd2;
buf4[3] = ETX;
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, buf4, 4);
retval = write_block(rp, buf4, 4);
if (retval != RIG_OK)
{
return retval;
}
count = read_string(&rs->rigport, buf4, 1, "", 0, 0, 1);
count = read_string(rp, buf4, 1, "", 0, 0, 1);
if (count != 1)
{
@ -98,11 +96,9 @@ static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data,
int data_len)
{
int cmd_len, count, retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char buf[16];
rs = &rig->state;
buf[0] = STX;
buf[1] = cmd1;
memcpy(buf + 2, data, data_len);
@ -110,16 +106,16 @@ static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data,
cmd_len = data_len + 3;
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, buf, cmd_len);
retval = write_block(rp, buf, cmd_len);
if (retval != RIG_OK)
{
return retval;
}
count = read_string(&rs->rigport, buf, 1, "", 0, 0, 1);
count = read_string(rp, buf, 1, "", 0, 0, 1);
if (count != 1)
{
@ -229,6 +225,7 @@ int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int i, count;
unsigned char buf[32];
hamlib_port_t *rp = RIGPORT(rig);
static const char rcv_signal_range[128] =
{
@ -261,9 +258,9 @@ int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* telemetry sent to the PC automatically at a 50msec rate */
rig_flush(&rig->state.rigport);
rig_flush(rp);
count = read_string(&rig->state.rigport, buf, 31, rcv_signal_range,
count = read_string(rp, buf, 31, rcv_signal_range,
128, 0, 1);
if (count < 1)

Wyświetl plik

@ -250,69 +250,72 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return kenwood_set_mode(rig, vfo, mode, width);
}
if (mode == RIG_MODE_CW || mode == RIG_MODE_CWR)
if (width != RIG_PASSBAND_NOCHANGE)
{
const int cw_table[] = { 50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 1000, 1500, 2000, 2500 };
int twidth = 2500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
if (mode == RIG_MODE_CW || mode == RIG_MODE_CWR)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
const int cw_table[] = { 50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 1000, 1500, 2000, 2500 };
int twidth = 2500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
{
const int cw_table[] = { 250, 500, 1000, 1500 };
int twidth = 1500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB)
{
const int pkt_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
// not setting SL since no API for it yet
// we will just set SH based on requested bandwidth not taking SL into account
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(pkt_htable) / sizeof(int); ++i)
{
if (pkt_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_AM || mode == RIG_MODE_PKTAM)
{
const int am_htable[] = { 2500, 3000, 4000, 5000 };
//const int am_ltable[] = { 0, 100, 200, 300 };
for (int i = 0; i < sizeof(am_htable) / sizeof(int); ++i)
{
if (am_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_SSB || mode == RIG_MODE_LSB || mode == RIG_MODE_USB)
{
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(ssb_htable) / sizeof(int); ++i)
{
if (ssb_htable[i] >= width) { hwidth = i; break; }
}
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
SNPRINTF(cmd, sizeof(cmd), "SH%02d;", hwidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
{
const int cw_table[] = { 250, 500, 1000, 1500 };
int twidth = 1500; // maximum
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
{
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
}
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
else if (mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB)
{
const int pkt_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
// not setting SL since no API for it yet
// we will just set SH based on requested bandwidth not taking SL into account
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(pkt_htable) / sizeof(int); ++i)
{
if (pkt_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_AM || mode == RIG_MODE_PKTAM)
{
const int am_htable[] = { 2500, 3000, 4000, 5000 };
//const int am_ltable[] = { 0, 100, 200, 300 };
for (int i = 0; i < sizeof(am_htable) / sizeof(int); ++i)
{
if (am_htable[i] >= width) { hwidth = i; break; }
}
}
else if (mode == RIG_MODE_SSB || mode == RIG_MODE_LSB || mode == RIG_MODE_USB)
{
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
for (int i = 0; i < sizeof(ssb_htable) / sizeof(int); ++i)
{
if (ssb_htable[i] >= width) { hwidth = i; break; }
}
}
SNPRINTF(cmd, sizeof(cmd), "SH%02d;", hwidth);
retval = kenwood_transaction(rig, cmd, NULL, 0);
return retval;
}
@ -1157,7 +1160,8 @@ static int ts590_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
RETURNFUNC(RIG_OK);
}
static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int status)
static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token,
int status)
{
char cmdbuf[20];
int retval;
@ -1183,7 +1187,8 @@ static int ts590_set_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int sta
RETURNFUNC(retval);
}
static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int *status)
static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token,
int *status)
{
int retval;
@ -1216,7 +1221,8 @@ static int ts590_get_ext_func(RIG *rig, vfo_t vfo, hamlib_token_t token, int *st
RETURNFUNC(retval);
}
static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t val)
{
int retval;
@ -1435,7 +1441,8 @@ static int ts590_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_
RETURNFUNC(retval);
}
static int ts590_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val)
static int ts590_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
value_t *val)
{
int retval;
int value;
@ -1694,7 +1701,7 @@ struct rig_caps ts590_caps =
RIG_MODEL(RIG_MODEL_TS590S),
.model_name = "TS-590S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".13",
.version = BACKEND_VER ".14",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

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)
{

Wyświetl plik

@ -52,13 +52,11 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -72,7 +70,7 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -50,15 +50,15 @@ int mds_transaction(RIG *rig, char *cmd, int expected, char **result)
{
char cmd_buf[MAXCMDLEN];
int retval;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct mds_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s\n", __func__, cmd);
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%s\n", cmd);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd_buf, strlen(cmd_buf));
rig_flush(rp);
retval = write_block(rp, (unsigned char *) cmd_buf, strlen(cmd_buf));
if (retval < 0)
{
@ -74,7 +74,7 @@ int mds_transaction(RIG *rig, char *cmd, int expected, char **result)
char cmdtrm_str[2]; /* Default Command/Reply termination char */
cmdtrm_str[0] = 0x0d;
cmdtrm_str[1] = 0x00;
retval = read_string(&rs->rigport, (unsigned char *) priv->ret_data,
retval = read_string(rp, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data), cmdtrm_str, strlen(cmdtrm_str), 0, expected);
if (retval < 0)

Wyświetl plik

@ -164,6 +164,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
int read = 0, tries = 4;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
const struct pcr_priv_caps *caps = pcr_caps(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
@ -172,7 +173,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
/* already in sync? */
if (priv->sync && !caps->always_sync)
{
return read_block(&rs->rigport, (unsigned char *) rxbuffer, count);
return read_block(rp, (unsigned char *) rxbuffer, count);
}
/* read first char */
@ -181,7 +182,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
char *p = &rxbuffer[0];
/* read first char */
int err = read_block(&rs->rigport, (unsigned char *) p, 1);
int err = read_block(rp, (unsigned char *) p, 1);
if (err < 0)
{
@ -204,7 +205,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
count--;
p++;
err = read_block(&rs->rigport, (unsigned char *) p, count);
err = read_block(rp, (unsigned char *) p, count);
if (err < 0)
{
@ -358,7 +359,7 @@ pcr_send(RIG *rig, const char *cmd)
rs->transaction_active = 1;
err = write_block(&rs->rigport, (unsigned char *) priv->cmd_buf, len + 1);
err = write_block(RIGPORT(rig), (unsigned char *) priv->cmd_buf, len + 1);
rs->transaction_active = 0;
@ -379,7 +380,7 @@ pcr_transaction(RIG *rig, const char *cmd)
if (!priv->auto_update)
{
rig_flush(&rs->rigport);
rig_flush(RIGPORT(rig));
}
pcr_send(rig, cmd);
@ -461,8 +462,8 @@ pcr_set_comm_speed(RIG *rig, int rate)
return err;
}
rig->state.rigport.parm.serial.rate = rate;
serial_setup(&rig->state.rigport);
RIGPORT(rig)->parm.serial.rate = rate;
serial_setup(RIGPORT(rig));
/* check if the pcr is still alive */
return pcr_check_ok(rig);
@ -549,6 +550,7 @@ int
pcr_open(RIG *rig)
{
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
int err;
@ -569,14 +571,14 @@ pcr_open(RIG *rig)
startup_serial_rate = 9600;
}
wanted_serial_rate = rs->rigport.parm.serial.rate;
rs->rigport.parm.serial.rate = startup_serial_rate;
wanted_serial_rate = rp->parm.serial.rate;
rp->parm.serial.rate = startup_serial_rate;
serial_setup(&rs->rigport);
serial_setup(rp);
/* let the pcr settle and flush any remaining data*/
hl_usleep(100 * 1000);
rig_flush(&rs->rigport);
rig_flush(rp);
/* try powering on twice, sometimes the pcr answers H100 (off) */
pcr_send(rig, "H101");
@ -585,7 +587,7 @@ pcr_open(RIG *rig)
pcr_send(rig, "H101");
hl_usleep(100 * 250);
rig_flush(&rs->rigport);
rig_flush(rp);
/* return RIG_ERJCTED if power is off */
err = pcr_transaction(rig, "H1?");

Wyświetl plik

@ -245,13 +245,13 @@ static int prm80_transaction(RIG *rig, const char *cmd,
const char *arg1, int wait_prompt)
{
int retval;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
// Get rid of possible prompt sent by the rig
rig_flush(&rs->rigport);
rig_flush(rp);
// Start with the command
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval != RIG_OK)
{
@ -260,7 +260,7 @@ static int prm80_transaction(RIG *rig, const char *cmd,
if (arg1 != NULL)
{
retval = read_colon_prompt_and_send(&rs->rigport, NULL, NULL, arg1);
retval = read_colon_prompt_and_send(rp, NULL, NULL, arg1);
if (retval < 0)
{
@ -270,7 +270,7 @@ static int prm80_transaction(RIG *rig, const char *cmd,
if (wait_prompt)
{
prm80_wait_for_prompt(&rs->rigport);
prm80_wait_for_prompt(rp);
}
return RIG_OK;
@ -374,7 +374,7 @@ static freq_t pll_value_to_rx_freq(unsigned pll_value)
*/
int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
{
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char rx_freq_buf[BUFSZ];
char tx_freq_buf[BUFSZ];
int rc;
@ -397,7 +397,7 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
}
// There's a second line to process after prm80_transaction()
rc = read_colon_prompt_and_send(&rs->rigport, NULL, NULL, tx_freq_buf);
rc = read_colon_prompt_and_send(rp, NULL, NULL, tx_freq_buf);
if (rc != RIG_OK)
{
@ -408,7 +408,7 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
// NB: the [R] command does not update the checksum of the RAM!
prm80_wait_for_prompt(&rs->rigport);
prm80_wait_for_prompt(rp);
return rc;
}
@ -699,7 +699,7 @@ static int prm80_read_system_state(RIG *rig, char *statebuf)
if (rig_check_cache_timeout(&priv->status_tv, PRM80_CACHE_TIMEOUT))
{
ret = prm80_do_read_system_state(&rig->state.rigport, statebuf);
ret = prm80_do_read_system_state(RIGPORT(rig), statebuf);
if (ret == RIG_OK)
{
@ -822,7 +822,7 @@ int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char buf[BUFSZ];
int ret, chanstate;
freq_t tx_freq;
@ -859,7 +859,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
SNPRINTF(buf, sizeof(buf), "%04X", rx_freq_to_pll_value(chan->freq));
// "PLL value to load : $"
ret = read_dollar_prompt_and_send(&rs->rigport, NULL, NULL, buf);
ret = read_dollar_prompt_and_send(rp, NULL, NULL, buf);
if (ret != RIG_OK)
{
@ -883,7 +883,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
SNPRINTF(buf, sizeof(buf), "%02X", chanstate);
// "Channel state : $"
ret = read_dollar_prompt_and_send(&rs->rigport, NULL, NULL, buf);
ret = read_dollar_prompt_and_send(rp, NULL, NULL, buf);
if (ret != RIG_OK)
{
@ -893,7 +893,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
// Determine if prompt came back (CRLF'>') or have to
// handle the possible query from the rig:
// "This channel number doesn't exist. Add new channel (Y/N) ? "
ret = read_block(&rs->rigport, (unsigned char *) buf, 3);
ret = read_block(rp, (unsigned char *) buf, 3);
if (ret < 0)
{
@ -903,7 +903,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (ret == 3 && buf[2] == 'T')
{
// Read the question
ret = read_string(&rs->rigport, (unsigned char *) buf, sizeof(buf), "?", 1, 0,
ret = read_string(rp, (unsigned char *) buf, sizeof(buf), "?", 1, 0,
1);
if (ret < 0)
@ -912,7 +912,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
// Read extra space
ret = read_block(&rs->rigport, (unsigned char *) buf, 1);
ret = read_block(rp, (unsigned char *) buf, 1);
if (ret < 0)
{
@ -920,7 +920,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
// Send confirmation
ret = write_block(&rs->rigport, (unsigned char *) "Y", 1);
ret = write_block(rp, (unsigned char *) "Y", 1);
if (ret < 0)
{
@ -928,7 +928,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
}
prm80_wait_for_prompt(&rs->rigport);
prm80_wait_for_prompt(rp);
}
else
{
@ -1108,6 +1108,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
{
char buf[BUFSZ];
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int ret, i;
/* [U] = Print 80c552 internal RAM. */
@ -1121,7 +1122,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
}
// Read CRLF
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
ret = read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0)
{
@ -1137,7 +1138,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
for (i = 0; i < (RSSI_HOLD_ADDR / 16) + 1; i++)
{
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
ret = read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
if (ret < 0)
{
@ -1153,10 +1154,10 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
// discard the remaining content of RAM print
for (i = 0; i < (16 - RSSI_HOLD_ADDR / 16) - 1; i++)
{
read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0, 1);
read_string(rp, buf, BUFSZ, "\n", 1, 0, 1);
}
prm80_wait_for_prompt(&rs->rigport);
prm80_wait_for_prompt(rp);
return RIG_OK;
}
@ -1261,22 +1262,22 @@ int prm80_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
const char *prm80_get_info(RIG *rig)
{
static char s_buf[BUFSZ];
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char *p;
int ret;
// Get rid of possible prompt sent by the rig
rig_flush(&rs->rigport);
rig_flush(rp);
/* [V] = Print firmware version. */
ret = write_block(&rs->rigport, (unsigned char *) "V", 1);
ret = write_block(rp, (unsigned char *) "V", 1);
if (ret < 0)
{
return NULL;
}
ret = read_string(&rs->rigport, (unsigned char *) s_buf, BUFSZ, ">", 1, 0, 1);
ret = read_string(rp, (unsigned char *) s_buf, BUFSZ, ">", 1, 0, 1);
if (ret < 0)
{

Wyświetl plik

@ -70,7 +70,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
{
const struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)
rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ];
char respbuf[BUFSZ];
int retval;
@ -95,9 +95,9 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%s" EOM, cmd);
}
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval != RIG_OK)
{
@ -113,7 +113,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
do
{
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, EOM,
retval = read_string(rp, (unsigned char *) respbuf, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
@ -124,7 +124,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
/* drop short/invalid packets */
if (retval <= pkt_header_len + 1 || respbuf[0] != '\x0a')
{
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout))
if (!rig_check_cache_timeout(&tv, rp->timeout))
{
continue;
}
@ -137,7 +137,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
/* drop other receiver id, and "pause" (empty) packets */
if ((priv->receiver_id != -1 && (respbuf[1] - '0') != priv->receiver_id))
{
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout))
if (!rig_check_cache_timeout(&tv, rp->timeout))
{
continue;
}
@ -165,7 +165,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
rig_debug(RIG_DEBUG_WARN, "%s: unexpected revertive frame\n",
__func__);
if (!rig_check_cache_timeout(&tv, rs->rigport.timeout))
if (!rig_check_cache_timeout(&tv, rp->timeout))
{
continue;
}
@ -189,7 +189,7 @@ static int ra37xx_transaction(RIG *rig, const char *cmd, char *data,
{
int retval, retry;
retry = rig->state.rigport.retry;
retry = RIGPORT(rig)->retry;
do
{

Wyświetl plik

@ -69,15 +69,15 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
int *data_len)
{
const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ + 1];
int retval;
SNPRINTF(cmdbuf, sizeof(cmdbuf), SOM "%u%s" EOM, priv->receiver_id, cmd);
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval != RIG_OK)
{
@ -91,7 +91,7 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
return retval;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval <= 0)

Wyświetl plik

@ -42,13 +42,11 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -62,7 +60,7 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -54,18 +54,16 @@ ek89x_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len,
cmd);
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(rp);
rig_debug(RIG_DEBUG_VERBOSE, "ek89x_transaction: len=%d,cmd=%s\n",
cmd_len, cmd);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -79,7 +77,7 @@ ek89x_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, RESPSZ,
retval = read_string(rp, (unsigned char *) data, RESPSZ,
CR, 1, 0, 1);
if (retval < 0)

Wyświetl plik

@ -59,18 +59,16 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: len=%d,cmd=%s\n", __func__, cmd_len,
cmd);
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(rp);
rig_debug(RIG_DEBUG_VERBOSE, "gp2000_transaction: len=%d,cmd=%s\n",
cmd_len, cmd);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -84,7 +82,7 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, RESPSZ,
retval = read_string(rp, (unsigned char *) data, RESPSZ,
CR, 1, 0, 1);
if (retval < 0)

Wyświetl plik

@ -56,13 +56,11 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -76,7 +74,7 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, BUFSZ, CR, 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -59,13 +59,11 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
char *data, int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -80,7 +78,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
* Transceiver sends back ">"
*/
char retbuf[BUFSZ + 1];
retval = read_string(&rs->rigport, (unsigned char *) retbuf, BUFSZ, PROMPT,
retval = read_string(rp, (unsigned char *) retbuf, BUFSZ, PROMPT,
strlen(PROMPT), 0, 1);
if (retval < 0)
@ -100,7 +98,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
}
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, LF,
retval = read_string(rp, (unsigned char *) data, BUFSZ, LF,
strlen(LF), 0, 1);
if (retval == -RIG_ETIMEOUT)

Wyświetl plik

@ -180,18 +180,19 @@ static int cu_transaction(RIG *rig, const char *cmd, int cmd_len)
{
int i;
char retchar;
hamlib_port_t *rp = RIGPORT(rig);
for (i = 0; i < cmd_len; i++)
{
int ret = write_block(&rig->state.rigport, (unsigned char *) &cmd[i], 1);
int ret = write_block(rp, (unsigned char *) &cmd[i], 1);
if (ret != RIG_OK)
{
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &retchar, 1);
ret = read_block(rp, (unsigned char *) &retchar, 1);
switch (retchar)
{

Wyświetl plik

@ -45,12 +45,10 @@ static int tapr_cmd(RIG *rig, unsigned char cmd, unsigned char c1,
unsigned char c2, unsigned char c3, unsigned char c4)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char cmdbuf[CMD_LEN];
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(rp);
cmdbuf[0] = ESC;
cmdbuf[1] = cmd;
@ -59,7 +57,7 @@ static int tapr_cmd(RIG *rig, unsigned char cmd, unsigned char c1,
cmdbuf[4] = c3;
cmdbuf[5] = c4;
retval = write_block(&rs->rigport, cmdbuf, 6);
retval = write_block(rp, cmdbuf, 6);
if (retval != RIG_OK)
{

Wyświetl plik

@ -257,19 +257,19 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
const int *data_len)
{
int i, retval = -RIG_EINTERNAL;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
// The original file had "A few XX's" due to sync problems
// So I put this in a try loop which should, hopefully, never be seen
for (i = 0; i < 3; ++i) // We'll try 3 times
{
char xxbuf[32];
rig_flush(&rs->rigport);
rig_flush(rp);
// We add 1 to data_len here for the null byte inserted by read_string eventually
// That way all the callers can use the expected response length for the cmd_len parameter here
// Callers all need to ensure they have enough room in data for this
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval == RIG_OK)
{
@ -284,7 +284,7 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (data)
{
retval = read_string(&rs->rigport, (unsigned char *) data, (*data_len) + 1,
retval = read_string(rp, (unsigned char *) data, (*data_len) + 1,
term, strlen(term), 0,
1);
@ -307,9 +307,9 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
rig_debug(RIG_DEBUG_ERR, "%s: write_block failed, try#%d\n", __func__, i + 1);
}
write_block(&rs->rigport, (unsigned char *) "XX" EOM,
write_block(rp, (unsigned char *) "XX" EOM,
3); // we wont' worry about the response here
retval = read_string(&rs->rigport, (unsigned char *) xxbuf, sizeof(xxbuf), "",
retval = read_string(rp, (unsigned char *) xxbuf, sizeof(xxbuf), "",
0, 0, 1); // this should timeout
if (retval != RIG_OK)

Wyświetl plik

@ -109,7 +109,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int data_len_init, itry;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
static int passcount = 0;
#ifdef TT565_TIME
double ft1, ft2;
@ -122,9 +122,8 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
for (itry = 0; itry < rig->caps->retry; itry++)
{
int retval;
rs = &rig->state;
rig_flush(&rs->rigport); /* discard pending i/p */
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
rig_flush(rp); /* discard pending i/p */
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -148,7 +147,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
ft1 = tt565_timenow();
#endif
*data_len = data_len_init; /* restore orig. buffer length */
*data_len = read_string(&rs->rigport, (unsigned char *) data, *data_len,
*data_len = read_string(rp, (unsigned char *) data, *data_len,
EOM, strlen(EOM), 0, 1);
if (!strncmp(data, "Z!", 2)) // command unrecognized??
@ -189,7 +188,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
"** retry after delay (io=%d, retry=%d) **\n",
passcount, itry);
*data_len = data_len_init; /* restore orig. buffer length */
read_string(&rs->rigport, (unsigned char *) data, *data_len,
read_string(rp, (unsigned char *) data, *data_len,
EOM, strlen(EOM), 0, 1); // purge the input stream...
continue; // now go retry the full command
}
@ -618,7 +617,6 @@ int tt565_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
*/
int tt565_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct rig_state *rs = &rig->state;
char ttmode, ttreceiver;
int retval;
char mdbuf[TT565_BUFSIZE];
@ -674,7 +672,7 @@ int tt565_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
);
}
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) mdbuf, strlen(mdbuf));
return retval;
}
@ -943,9 +941,7 @@ int tt565_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
*/
int tt565_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
struct rig_state *rs = &rig->state;
return write_block(&rs->rigport,
return write_block(RIGPORT(rig),
(unsigned char *)(ptt == RIG_PTT_ON ? "*TK" EOM : "*TU" EOM), 4);
}

Wyświetl plik

@ -275,7 +275,7 @@ int tt585_set_vfo(RIG *rig, vfo_t vfo)
}
/* toggle VFOs */
return write_block(&rig->state.rigport, (unsigned char *) "F", 1);
return write_block(RIGPORT(rig), (unsigned char *) "F", 1);
}
int tt585_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
@ -297,7 +297,7 @@ int tt585_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
}
/* toggle split mode */
return write_block(&rig->state.rigport, (unsigned char *) "J", 1);
return write_block(RIGPORT(rig), (unsigned char *) "J", 1);
}
int tt585_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
@ -370,7 +370,7 @@ int tt585_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_force_cache_timeout(&priv->status_tv);
return write_block(&rig->state.rigport, (unsigned char *) buf, strlen(buf));
return write_block(RIGPORT(rig), (unsigned char *) buf, strlen(buf));
}
/*
@ -455,6 +455,7 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
const char *mcmd, *wcmd;
int ret;
hamlib_port_t *rp = RIGPORT(rig);
switch (mode)
{
@ -476,7 +477,7 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_force_cache_timeout(&priv->status_tv);
ret = write_block(&rig->state.rigport, (unsigned char *) mcmd, strlen(mcmd));
ret = write_block(rp, (unsigned char *) mcmd, strlen(mcmd));
if (ret < 0)
{
@ -511,7 +512,7 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
wcmd = "R";
}
return write_block(&rig->state.rigport, (unsigned char *) wcmd, strlen(mcmd));
return write_block(rp, (unsigned char *) wcmd, strlen(mcmd));
}
int tt585_set_mem(RIG *rig, vfo_t vfo, int ch)
@ -529,7 +530,7 @@ int tt585_set_mem(RIG *rig, vfo_t vfo, int ch)
/* does it work without a command after the channel number? */
SNPRINTF(buf, sizeof(buf), ":%02d", ch);
return write_block(&rig->state.rigport, (unsigned char *) buf, strlen(buf));
return write_block(RIGPORT(rig), (unsigned char *) buf, strlen(buf));
}
int tt585_get_mem(RIG *rig, vfo_t vfo, int *ch)
@ -568,7 +569,7 @@ int tt585_get_status_data(RIG *rig)
hamlib_port_t *rigport;
int ret;
rigport = &rig->state.rigport;
rigport = RIGPORT(rig);
if (!rig_check_cache_timeout(&priv->status_tv, TT585_CACHE_TIMEOUT))
{
@ -608,7 +609,7 @@ int tt585_set_parm(RIG *rig, setting_t parm, value_t val)
{
case RIG_PARM_ANN:
/* FIXME: > is a toggle command only */
ret = write_block(&rig->state.rigport, (unsigned char *) ">", 1);
ret = write_block(RIGPORT(rig), (unsigned char *) ">", 1);
if (ret < 0)
{
@ -678,5 +679,5 @@ int tt585_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
rig_force_cache_timeout(&priv->status_tv);
return write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
return write_block(RIGPORT(rig), (unsigned char *) cmd, strlen(cmd));
}

Wyświetl plik

@ -242,15 +242,13 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int retval;
char str[BUFSZ];
char fmt[16];
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
rs = &rig->state;
rig_flush(&rs->rigport);
rig_flush(rp);
num_snprintf(str, BUFSZ, "$%u%s", priv->receiver_id, cmd);
retval = write_block(&rs->rigport, (unsigned char *) str, strlen(str));
retval = write_block(rp, (unsigned char *) str, strlen(str));
if (retval != RIG_OK)
{
@ -263,7 +261,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM, 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM, 1, 0, 1);
if (retval < 0)
{
@ -395,14 +393,13 @@ int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
int freq_len, retval;
char freqbuf[16];
freq_len = num_snprintf(freqbuf, sizeof(freqbuf), "$%uF%.6f" EOM,
priv->receiver_id, freq / 1e6);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, freq_len);
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf, freq_len);
return retval;
}
@ -443,7 +440,6 @@ int rx331_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
char dmode;
int mdbuf_len, retval;
char mdbuf[32];
@ -494,7 +490,7 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
dmode);
}
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, mdbuf_len);
retval = write_block(RIGPORT(rig), (unsigned char *) mdbuf, mdbuf_len);
return retval;
}
@ -565,7 +561,6 @@ int rx331_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
int retval = RIG_OK;
char cmdbuf[32];
@ -637,7 +632,7 @@ int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL;
}
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) cmdbuf, strlen(cmdbuf));
return retval;
}

Wyświetl plik

@ -194,13 +194,11 @@ static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -213,7 +211,7 @@ static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM, 1, 0, 1);
retval = read_string(rp, (unsigned char *) data, BUFSZ, EOM, 1, 0, 1);
if (retval < 0)
{
@ -273,19 +271,17 @@ int rx340_cleanup(RIG *rig)
int rx340_open(RIG *rig)
{
struct rig_state *rs = &rig->state;
#define REMOTE_CMD "*R1"EOM
return write_block(&rs->rigport, (unsigned char *) REMOTE_CMD,
return write_block(RIGPORT(rig), (unsigned char *) REMOTE_CMD,
strlen(REMOTE_CMD));
}
int rx340_close(RIG *rig)
{
struct rig_state *rs = &rig->state;
#define LOCAL_CMD "*R0"EOM
return write_block(&rs->rigport, (unsigned char *) LOCAL_CMD,
return write_block(RIGPORT(rig), (unsigned char *) LOCAL_CMD,
strlen(LOCAL_CMD));
}
@ -294,13 +290,12 @@ int rx340_close(RIG *rig)
*/
int rx340_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rs = &rig->state;
int retval;
char freqbuf[16];
SNPRINTF(freqbuf, sizeof(freqbuf), "F%.6f" EOM, freq / 1e6);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, strlen(freqbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf, strlen(freqbuf));
return retval;
}
@ -341,7 +336,6 @@ int rx340_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct rig_state *rs = &rig->state;
char dmode;
int retval;
char mdbuf[32];
@ -390,7 +384,7 @@ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
SNPRINTF(mdbuf, sizeof(mdbuf), "D%c" EOM, dmode);
}
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) mdbuf, strlen(mdbuf));
return retval;
}
@ -462,7 +456,6 @@ int rx340_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int rx340_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct rig_state *rs = &rig->state;
int retval = RIG_OK;
char cmdbuf[32];
@ -510,7 +503,7 @@ int rx340_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL;
}
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) cmdbuf, strlen(cmdbuf));
return retval;
}

Wyświetl plik

@ -59,13 +59,11 @@ int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
rs = &rig->state;
rig_flush(rp);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
if (retval != RIG_OK)
{
@ -78,7 +76,7 @@ int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, *data_len, NULL, 0,
retval = read_string(rp, (unsigned char *) data, *data_len, NULL, 0,
0, 1);
if (retval == -RIG_ETIMEOUT)
@ -229,7 +227,6 @@ static void tentec_tuning_factor_calc(RIG *rig)
int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct tentec_priv_data *priv;
struct rig_state *rs = &rig->state;
int retval;
char freqbuf[16];
freq_t old_freq;
@ -245,7 +242,7 @@ int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, strlen(freqbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf, strlen(freqbuf));
if (retval != RIG_OK)
{
@ -277,7 +274,7 @@ int tentec_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
pbwidth_t saved_width;
@ -347,7 +344,7 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -365,7 +362,7 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -401,7 +398,7 @@ int tentec_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int retval = RIG_OK;
char cmdbuf[32];
@ -415,7 +412,7 @@ int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%c" EOM,
val.i == RIG_AGC_SLOW ? '1' : (
val.i == RIG_AGC_FAST ? '3' : '2'));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -429,7 +426,7 @@ int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
* -> need to create RIG_LEVEL_LINEOUT ?
*/
SNPRINTF(cmdbuf, sizeof(cmdbuf), "C\x7f%c" EOM, (int)((1.0 - val.f) * 63.0));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{

Wyświetl plik

@ -66,9 +66,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
/*
* set_transaction_active keeps the asynchronous decode routine from being called
@ -76,9 +74,9 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
*/
set_transaction_active(rig);
rig_flush(&rs->rigport);
rig_flush(rp);
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
if (retval != RIG_OK)
{
@ -95,7 +93,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, *data_len, NULL, 0,
retval = read_string(rp, (unsigned char *) data, *data_len, NULL, 0,
0, 1);
if (retval == -RIG_ETIMEOUT)
@ -126,12 +124,11 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int
tt550_tx_control(RIG *rig, char oper)
{
struct rig_state *rs = &rig->state;
int retval;
char cmdbuf[4];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "#%c" EOM, oper);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) cmdbuf, strlen(cmdbuf));
/*
* if (retval == RIG_OK) not currently saving the state of these operations I'm
* not sure we need to, but if so, this is where it would go.
@ -598,7 +595,6 @@ int
tt550_set_rx_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct tt550_priv_data *priv;
struct rig_state *rs = &rig->state;
int retval;
char freqbuf[16];
@ -612,7 +608,7 @@ tt550_set_rx_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, strlen(freqbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf, strlen(freqbuf));
if (retval != RIG_OK)
{
@ -632,7 +628,6 @@ int
tt550_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct tt550_priv_data *priv;
struct rig_state *rs = &rig->state;
int retval;
char freqbuf[16];
@ -646,7 +641,7 @@ tt550_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, strlen(freqbuf));
retval = write_block(RIGPORT(rig), (unsigned char *) freqbuf, strlen(freqbuf));
if (retval != RIG_OK)
{
@ -681,7 +676,7 @@ int
tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
pbwidth_t saved_width;
@ -756,7 +751,7 @@ tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
tt550_tuning_factor_calc(rig, RECEIVE);
SNPRINTF(mdbuf, sizeof(mdbuf), "M%c%c" EOM, ttmode, ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -772,7 +767,7 @@ tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -796,7 +791,7 @@ int
tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
pbwidth_t saved_width;
@ -889,7 +884,7 @@ tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
tt550_tuning_factor_calc(rig, TRANSMIT);
SNPRINTF(mdbuf, sizeof(mdbuf), "M%c%c" EOM, ttmode, ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -905,7 +900,7 @@ tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
retval = write_block(rp, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
{
@ -994,7 +989,7 @@ int
tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
int retval, ditfactor, dahfactor, spcfactor;
char cmdbuf[32];
@ -1003,7 +998,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AGC:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%c" EOM,
val.i >= 3 ? '3' : (val.i < 2 ? '1' : '2'));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1014,7 +1009,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "V%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1026,7 +1021,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_LINEOUT:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "L%c" EOM, (int)(val.f * 63));
retval = write_block(&rs->rigport, cmdbuf, strlen(cmdbuf));
retval = write_block(rp, cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1038,7 +1033,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "A%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1049,7 +1044,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_SQL:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "S%c" EOM, (int)(val.f * 19));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1060,7 +1055,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_NR:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "D%c" EOM, (int)(val.f * 7));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1074,7 +1069,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
* attenuator is either on or off
*/
SNPRINTF(cmdbuf, sizeof(cmdbuf), "B%c" EOM, val.i < 15 ? '0' : '1');
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1093,7 +1088,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
ditfactor >> 8, ditfactor & 0xff, dahfactor >> 8,
dahfactor & 0xff, spcfactor >> 8,
spcfactor & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1104,7 +1099,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RFPOWER:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "P%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1115,7 +1110,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_VOXGAIN:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "UG%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1126,7 +1121,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_VOXDELAY:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "UH%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1137,7 +1132,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_ANTIVOX:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "UA%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1148,7 +1143,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_COMP:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "Y%c" EOM, (int)(val.f * 127));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1159,7 +1154,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_MICGAIN:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "O1%c%c" EOM, 0, (int)(val.f * 15));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1170,7 +1165,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_BKINDL:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "UQ%c" EOM, (int)(val.f * 255));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
{
@ -1368,11 +1363,10 @@ tt550_get_info(RIG *rig)
int
tt550_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
struct rig_state *rs = &rig->state;
char cmdbuf[16];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "Q%c" EOM, ptt == 0 ? '0' : '1');
return (write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf)));
return (write_block(RIGPORT(rig), (unsigned char *) cmdbuf, strlen(cmdbuf)));
}
@ -1442,7 +1436,7 @@ tt550_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
unsigned char fctbuf[16];
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
/* Optimize:
* sort the switch cases with the most frequent first
@ -1452,20 +1446,20 @@ tt550_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
case RIG_FUNC_VOX:
SNPRINTF((char *) fctbuf, sizeof(fctbuf), "U%c" EOM, status == 0 ? '0' : '1');
priv->vox = status;
return write_block(&rs->rigport, fctbuf, strlen((char *)fctbuf));
return write_block(rp, fctbuf, strlen((char *)fctbuf));
case RIG_FUNC_NR:
SNPRINTF((char *) fctbuf, sizeof(fctbuf), "K%c%c" EOM, status == 0 ? '0' : '1',
priv->anf == 0 ? '0' : '1');
priv->en_nr = status;
return write_block(&rs->rigport, fctbuf, strlen((char *)fctbuf));
return write_block(rp, fctbuf, strlen((char *)fctbuf));
case RIG_FUNC_ANF:
SNPRINTF((char *) fctbuf, sizeof(fctbuf), "K%c%c" EOM,
priv->en_nr == 0 ? '0' : '1',
status == 0 ? '0' : '1');
priv->anf = status;
return write_block(&rs->rigport, fctbuf, strlen((char *)fctbuf));
return write_block(rp, fctbuf, strlen((char *)fctbuf));
case RIG_FUNC_TUNER:
@ -1681,8 +1675,7 @@ tt550_decode_event(RIG *rig)
rs = &rig->state;
priv = (struct tt550_priv_data *) rs->priv;
data_len = read_string(&rs->rigport, buf, MAXFRAMELEN, "\n\r", 2, 0,
data_len = read_string(RIGPORT(rig), buf, MAXFRAMELEN, "\n\r", 2, 0,
1);

Wyświetl plik

@ -151,8 +151,8 @@ struct rig_caps v4l_caps =
int v4l_init(RIG *rig)
{
rig->state.rigport.type.rig = RIG_PORT_DEVICE;
strncpy(rig->state.rigport.pathname, DEFAULT_V4L_PATH, HAMLIB_FILPATHLEN - 1);
RIGPORT(rig)->type.rig = RIG_PORT_DEVICE;
strncpy(RIGPORT(rig)->pathname, DEFAULT_V4L_PATH, HAMLIB_FILPATHLEN - 1);
return RIG_OK;
}
@ -168,7 +168,7 @@ int v4l_open(RIG *rig)
int ret;
double fact;
vt.tuner = i;
ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt);
ret = ioctl(RIGPORT(rig)->fd, VIDIOCGTUNER, &vt);
if (ret < 0)
{
@ -191,6 +191,7 @@ int v4l_open(RIG *rig)
int v4l_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct video_tuner vt;
const freq_range_t *range;
unsigned long f;
@ -209,7 +210,7 @@ int v4l_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vt.tuner = (rs->rx_range_list - range) / sizeof(freq_range_t);
ret = ioctl(rig->state.rigport.fd, VIDIOCSTUNER, &vt); /* set tuner # */
ret = ioctl(rp->fd, VIDIOCSTUNER, &vt); /* set tuner # */
if (ret < 0)
{
@ -222,7 +223,7 @@ int v4l_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
f = rint(freq * fact); /* rounding to nearest int */
ret = ioctl(rig->state.rigport.fd, VIDIOCSFREQ, &f);
ret = ioctl(rp->fd, VIDIOCSFREQ, &f);
if (ret < 0)
{
@ -242,7 +243,7 @@ int v4l_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
double fact;
int ret;
ret = ioctl(rig->state.rigport.fd, VIDIOCGFREQ, &f);
ret = ioctl(RIGPORT(rig)->fd, VIDIOCGFREQ, &f);
if (ret < 0)
{
@ -270,12 +271,13 @@ int v4l_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int v4l_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
struct video_audio va;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
switch (func)
{
case RIG_FUNC_MUTE:
ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va);
ret = ioctl(rp->fd, VIDIOCGAUDIO, &va);
if (ret < 0)
{
@ -285,7 +287,7 @@ int v4l_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
va.flags = status ? VIDEO_AUDIO_MUTE : 0;
ret = ioctl(rig->state.rigport.fd, VIDIOCSAUDIO, &va);
ret = ioctl(rp->fd, VIDIOCSAUDIO, &va);
if (ret < 0)
{
@ -311,7 +313,7 @@ int v4l_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
switch (func)
{
case RIG_FUNC_MUTE:
ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va);
ret = ioctl(RIGPORT(rig)->fd, VIDIOCGAUDIO, &va);
if (ret < 0)
{
@ -334,9 +336,10 @@ int v4l_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
int v4l_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct video_audio va;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va);
ret = ioctl(rp->fd, VIDIOCGAUDIO, &va);
if (ret < 0)
{
@ -355,7 +358,7 @@ int v4l_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL;
}
ret = ioctl(rig->state.rigport.fd, VIDIOCSAUDIO, &va);
ret = ioctl(rp->fd, VIDIOCSAUDIO, &va);
if (ret < 0)
{
@ -371,12 +374,13 @@ int v4l_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct video_audio va;
struct video_tuner vt;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
switch (level)
{
case RIG_LEVEL_AF:
ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va);
ret = ioctl(rp->fd, VIDIOCGAUDIO, &va);
if (ret < 0)
{
@ -389,7 +393,7 @@ int v4l_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
case RIG_LEVEL_RAWSTR:
ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt); /* get info */
ret = ioctl(rp->fd, VIDIOCGTUNER, &vt); /* get info */
if (ret < 0)
{
@ -417,7 +421,7 @@ const char *v4l_get_info(RIG *rig)
int ret;
vt.tuner = 0;
ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt);
ret = ioctl(RIGPORT(rig)->fd, VIDIOCGTUNER, &vt);
if (ret < 0)
{

Wyświetl plik

@ -151,8 +151,8 @@ struct rig_caps v4l2_caps =
int v4l2_init(RIG *rig)
{
rig->state.rigport.type.rig = RIG_PORT_DEVICE;
strncpy(rig->state.rigport.pathname, DEFAULT_V4L2_PATH, HAMLIB_FILPATHLEN - 1);
RIGPORT(rig)->type.rig = RIG_PORT_DEVICE;
strncpy(RIGPORT(rig)->pathname, DEFAULT_V4L2_PATH, HAMLIB_FILPATHLEN - 1);
return RIG_OK;
}
@ -168,7 +168,7 @@ int v4l2_open(RIG *rig)
int ret;
double fact;
vt.index = i;
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt);
ret = ioctl(RIGPORT(rig)->fd, VIDIOC_G_TUNER, &vt);
if (ret < 0)
{
@ -191,6 +191,7 @@ int v4l2_open(RIG *rig)
int v4l2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
struct v4l2_tuner vt;
const freq_range_t *range;
unsigned long f;
@ -209,7 +210,7 @@ int v4l2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vt.index = (rs->rx_range_list - range) / sizeof(freq_range_t);
ret = ioctl(rig->state.rigport.fd, VIDIOC_S_TUNER, &vt); /* set tuner # */
ret = ioctl(rp->fd, VIDIOC_S_TUNER, &vt); /* set tuner # */
if (ret < 0)
{
@ -222,7 +223,7 @@ int v4l2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
f = rint(freq * fact); /* rounding to nearest int */
ret = ioctl(rig->state.rigport.fd, VIDIOC_S_FREQUENCY, &f);
ret = ioctl(rp->fd, VIDIOC_S_FREQUENCY, &f);
if (ret < 0)
{
@ -243,7 +244,7 @@ int v4l2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int ret;
/* FIXME */
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_FREQUENCY, &f);
ret = ioctl(RIGPORT(rig)->fd, VIDIOC_G_FREQUENCY, &f);
if (ret < 0)
{
@ -271,12 +272,13 @@ int v4l2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int v4l2_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
struct v4l2_audio va;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
switch (func)
{
case RIG_FUNC_MUTE:
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va);
ret = ioctl(rp->fd, VIDIOC_G_AUDIO, &va);
if (ret < 0)
{
@ -286,7 +288,7 @@ int v4l2_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
va.capability = status ? V4L2_CID_AUDIO_MUTE : 0;
ret = ioctl(rig->state.rigport.fd, VIDIOC_S_AUDIO, &va);
ret = ioctl(rp->fd, VIDIOC_S_AUDIO, &va);
if (ret < 0)
{
@ -312,7 +314,7 @@ int v4l2_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
switch (func)
{
case RIG_FUNC_MUTE:
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va);
ret = ioctl(RIGPORT(rig)->fd, VIDIOC_G_AUDIO, &va);
if (ret < 0)
{
@ -335,9 +337,10 @@ int v4l2_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
int v4l2_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct v4l2_audio va;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va);
ret = ioctl(rp->fd, VIDIOC_G_AUDIO, &va);
if (ret < 0)
{
@ -358,7 +361,7 @@ int v4l2_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL;
}
ret = ioctl(rig->state.rigport.fd, VIDIOC_S_AUDIO, &va);
ret = ioctl(rp->fd, VIDIOC_S_AUDIO, &va);
if (ret < 0)
{
@ -374,12 +377,13 @@ int v4l2_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct v4l2_audio va;
struct v4l2_tuner vt;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
switch (level)
{
case RIG_LEVEL_AF:
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va);
ret = ioctl(rp->fd, VIDIOC_G_AUDIO, &va);
if (ret < 0)
{
@ -393,7 +397,7 @@ int v4l2_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RAWSTR:
/* FE_READ_SIGNAL_STRENGTH ? */
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt); /* get info */
ret = ioctl(rp->fd, VIDIOC_G_TUNER, &vt); /* get info */
if (ret < 0)
{
@ -421,7 +425,7 @@ const char *v4l2_get_info(RIG *rig)
int ret;
vt.index = 0;
ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt);
ret = ioctl(RIGPORT(rig)->fd, VIDIOC_G_TUNER, &vt);
if (ret < 0)
{

Wyświetl plik

@ -116,6 +116,7 @@ uniden_transaction(RIG *rig, const char *cmdstr, int cmd_len,
char *data, size_t *datasize)
{
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int retval;
int retry_read = 0;
char replybuf[BUFSZ];
@ -126,11 +127,11 @@ uniden_transaction(RIG *rig, const char *cmdstr, int cmd_len,
transaction_write:
rig_flush(&rs->rigport);
rig_flush(rp);
if (cmdstr)
{
retval = write_block(&rs->rigport, (unsigned char *) cmdstr, strlen(cmdstr));
retval = write_block(rp, (unsigned char *) cmdstr, strlen(cmdstr));
if (retval != RIG_OK)
{
@ -150,12 +151,12 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM,
retval = read_string(rp, (unsigned char *) data, *datasize, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -173,7 +174,7 @@ transaction_write:
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n",
__func__, data);
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -251,7 +252,7 @@ transaction_write:
*/
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, data);
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}

Wyświetl plik

@ -97,6 +97,7 @@ uniden_digital_transaction(RIG *rig, const char *cmdstr, int cmd_len,
char *data, size_t *datasize)
{
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
int retval;
int retry_read = 0;
char replybuf[BUFSZ];
@ -107,11 +108,11 @@ uniden_digital_transaction(RIG *rig, const char *cmdstr, int cmd_len,
transaction_write:
rig_flush(&rs->rigport);
rig_flush(rp);
if (cmdstr)
{
retval = write_block(&rs->rigport, (unsigned char *) cmdstr, strlen(cmdstr));
retval = write_block(rp, (unsigned char *) cmdstr, strlen(cmdstr));
if (retval != RIG_OK)
{
@ -131,12 +132,12 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM,
retval = read_string(rp, (unsigned char *) data, *datasize, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}
@ -154,7 +155,7 @@ transaction_write:
* ie: STS command will not return either "\r" or "\n"! */
/*if (strchr(EOM, data[strlen(data)-1])==NULL) {
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, data);
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
goto transaction_write;
retval = -RIG_EPROTO;
goto transaction_quit;
@ -245,7 +246,7 @@ transaction_write:
*/
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, data);
if (retry_read++ < rig->state.rigport.retry)
if (retry_read++ < rp->retry)
{
goto transaction_write;
}

Wyświetl plik

@ -243,7 +243,7 @@ int g3_open(RIG *rig)
struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv;
int device_num;
device_num = atoi(rig->state.rigport.pathname);
device_num = atoi(RIGPORT(rig)->pathname);
/* Open Winradio receiver handle */
priv->hRadio = priv->OpenRadioDevice(device_num);

Wyświetl plik

@ -244,7 +244,7 @@ int g3_open(RIG *rig)
struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv;
int device_num;
device_num = atoi(rig->state.rigport.pathname);
device_num = atoi(RIGPORT(rig)->pathname);
/* Open Winradio receiver handle */
priv->hRadio = priv->OpenRadioDevice(device_num);

Wyświetl plik

@ -178,9 +178,9 @@ int g313_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: found %d rigs 0 is %s\n", __func__, Count,
List[0].Path);
if (rig->state.rigport.pathname[0])
if (RIGPORT(rig)->pathname[0])
{
priv->hRadio = OpenDevice(rig->state.rigport.pathname);
priv->hRadio = OpenDevice(RIGPORT(rig)->pathname);
}
else
{

Wyświetl plik

@ -379,7 +379,7 @@ int g313_open(RIG *rig)
int Count;
int id;
device_num = atoi(rig->state.rigport.pathname);
device_num = atoi(RIGPORT(rig)->pathname);
Count = priv->waveOutGetNumDevs();

Wyświetl plik

@ -44,9 +44,9 @@
int wr_rig_init(RIG *rig)
{
rig->state.rigport.type.rig = RIG_PORT_DEVICE;
strncpy(rig->state.rigport.pathname, DEFAULT_WINRADIO_PATH,
HAMLIB_FILPATHLEN - 1);
hamlib_port_t *rp = RIGPORT(rig);
rp->type.rig = RIG_PORT_DEVICE;
strncpy(rp->pathname, DEFAULT_WINRADIO_PATH, HAMLIB_FILPATHLEN - 1);
return RIG_OK;
}
@ -62,7 +62,7 @@ int wr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
f = (unsigned long)freq;
if (ioctl(rig->state.rigport.fd, RADIO_SET_FREQ, &f)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_SET_FREQ, &f)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -71,7 +71,7 @@ int wr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
unsigned long f;
if (ioctl(rig->state.rigport.fd, RADIO_GET_FREQ, &f) < 0) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_GET_FREQ, &f) < 0) { return -RIG_EINVAL; }
*freq = (freq_t)f;
return RIG_OK;
@ -112,7 +112,7 @@ int wr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
default: return -RIG_EINVAL;
}
if (ioctl(rig->state.rigport.fd, RADIO_SET_MODE, &m)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_SET_MODE, &m)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -121,7 +121,7 @@ int wr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
unsigned long m;
if (ioctl(rig->state.rigport.fd, RADIO_GET_MODE, &m)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_GET_MODE, &m)) { return -RIG_EINVAL; }
*width = RIG_PASSBAND_NORMAL;
@ -159,7 +159,7 @@ int wr_set_powerstat(RIG *rig, powerstat_t status)
unsigned long p = 1;
p = status == RIG_POWER_ON ? 1 : 0;
if (ioctl(rig->state.rigport.fd, RADIO_SET_POWER, &p)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_SET_POWER, &p)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -167,7 +167,7 @@ int wr_get_powerstat(RIG *rig, powerstat_t *status)
{
unsigned long p;
if (ioctl(rig->state.rigport.fd, RADIO_GET_POWER, &p)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_GET_POWER, &p)) { return -RIG_EINVAL; }
*status = p ? RIG_POWER_ON : RIG_POWER_OFF;
return RIG_OK;
@ -181,7 +181,7 @@ int wr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
unsigned long v = status ? 1 : 0;
if (ioctl(rig->state.rigport.fd, RADIO_SET_AGC, &v)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_SET_AGC, &v)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -199,7 +199,7 @@ int wr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
unsigned long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_AGC, &v)) { return -RIG_EINVAL; }
if (ioctl(RIGPORT(rig)->fd, RADIO_GET_AGC, &v)) { return -RIG_EINVAL; }
*status = v;
return RIG_OK;
@ -213,17 +213,18 @@ int wr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
hamlib_port_t *rp = RIGPORT(rig);
switch (level)
{
case RIG_LEVEL_AF:
{
unsigned long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_MAXVOL, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_MAXVOL, &v)) { return -RIG_EINVAL; }
v *= val.f;
if (ioctl(rig->state.rigport.fd, RADIO_SET_VOL, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_SET_VOL, &v)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -232,7 +233,7 @@ int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
unsigned long v = val.i ? 1 : 0;
if (ioctl(rig->state.rigport.fd, RADIO_SET_ATTN, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_SET_ATTN, &v)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -241,7 +242,7 @@ int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
long v = val.i;
if (ioctl(rig->state.rigport.fd, RADIO_SET_IFS, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_SET_IFS, &v)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -250,7 +251,7 @@ int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
long v = val.f * 100; /* iMaxIFGain on wHWVer > RHV_3150 */
if (ioctl(rig->state.rigport.fd, RADIO_SET_IFG, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_SET_IFG, &v)) { return -RIG_EINVAL; }
return RIG_OK;
}
@ -262,15 +263,16 @@ int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
hamlib_port_t *rp = RIGPORT(rig);
switch (level)
{
case RIG_LEVEL_AF:
{
unsigned long v, mv;
if (ioctl(rig->state.rigport.fd, RADIO_GET_MAXVOL, &mv)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_MAXVOL, &mv)) { return -RIG_EINVAL; }
if (ioctl(rig->state.rigport.fd, RADIO_GET_VOL, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_VOL, &v)) { return -RIG_EINVAL; }
val->f = (float)v / mv;
return RIG_OK;
@ -280,7 +282,7 @@ int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
unsigned long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_VOL, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_VOL, &v)) { return -RIG_EINVAL; }
val->i = v ? rig->state.attenuator[0] : 0;
return RIG_OK;
@ -290,7 +292,7 @@ int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
unsigned long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_SS, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_SS, &v)) { return -RIG_EINVAL; }
val->i = v - 60; /* 0..120, Hamlib assumes S9 = 0dB */
return RIG_OK;
@ -300,7 +302,7 @@ int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_IFS, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_IFS, &v)) { return -RIG_EINVAL; }
val->i = v;
return RIG_OK;
@ -310,7 +312,7 @@ int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
long v;
if (ioctl(rig->state.rigport.fd, RADIO_GET_IFG, &v)) { return -RIG_EINVAL; }
if (ioctl(rp->fd, RADIO_GET_IFG, &v)) { return -RIG_EINVAL; }
val->f = (float)v / 100; /* iMaxIFGain on wHWVer > RHV_3150 */
return RIG_OK;
@ -328,7 +330,7 @@ const char *wr_get_info(RIG *rig)
{
static char buf[100];
if (ioctl(rig->state.rigport.fd, RADIO_GET_DESCR, buf) < 0) { return "?"; }
if (ioctl(RIGPORT(rig)->fd, RADIO_GET_DESCR, buf) < 0) { return "?"; }
return buf;
}

Wyświetl plik

@ -67,6 +67,7 @@ const struct confparams wj_cfg_params[] =
static int wj_transaction(RIG *rig, int monitor)
{
struct wj_priv_data *priv = (struct wj_priv_data *)rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char buf[CMDSZ] = { 0x8, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned char rxbuf[CMDSZ];
@ -169,9 +170,9 @@ static int wj_transaction(RIG *rig, int monitor)
/* buf[9]: not used if command byte, but must be transmitted */
rig_flush(&rig->state.rigport);
rig_flush(rp);
retval = write_block(&rig->state.rigport, buf, CMDSZ);
retval = write_block(rp, buf, CMDSZ);
if (retval != RIG_OK)
{
@ -183,7 +184,7 @@ static int wj_transaction(RIG *rig, int monitor)
/*
* Transceiver sends back ">"
*/
retval = read_block(&rig->state.rigport, rxbuf, CMDSZ);
retval = read_block(rp, rxbuf, CMDSZ);
if (retval < 0 || retval > CMDSZ)
{

Wyświetl plik

@ -253,7 +253,7 @@ static int frg100_do_transaction(RIG *rig,
const unsigned char cmd[YAESU_CMD_LENGTH],
unsigned char *retbuf, size_t retbuf_len)
{
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char default_retbuf[1];
int retval;
@ -263,15 +263,14 @@ static int frg100_do_transaction(RIG *rig,
retbuf_len = sizeof(default_retbuf);
}
rs = &rig->state;
memset(retbuf, 0, retbuf_len);
rig_flush(&rs->rigport);
retval = write_block(&rs->rigport, cmd, YAESU_CMD_LENGTH);
rig_flush(rp);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval != RIG_OK) { return retval; }
retval = read_block(&rs->rigport, retbuf, retbuf_len);
retval = read_block(rp, retbuf, retbuf_len);
if (retval != retbuf_len)
{
@ -353,7 +352,7 @@ int frg100_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
/* send 0 delay pacing */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -372,7 +371,7 @@ int frg100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd(cmd, freq / 10, 8);
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -384,7 +383,7 @@ int frg100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* fill in p1 */
cmd[3] = mode2rig(rig, mode, width);
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -400,7 +399,7 @@ int frg100_set_powerstat(RIG *rig, powerstat_t status)
cmd[3] = status == RIG_POWER_OFF ? 0x00 : 0x01;
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -428,7 +427,7 @@ int frg100_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_EINVAL; /* sorry, wrong VFO */
}
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -436,16 +435,17 @@ int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7};
int retval;
hamlib_port_t *rp = RIGPORT(rig);
if (level != RIG_LEVEL_RAWSTR)
{
return -RIG_EINVAL;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
/* send READ STATUS(Meter only) cmd to rig */
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -453,7 +453,7 @@ int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
/* read back the 1 byte */
retval = read_block(&rig->state.rigport, cmd, 5);
retval = read_block(rp, cmd, 5);
if (retval < 1)
{

Wyświetl plik

@ -160,7 +160,7 @@ int frg8800_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
/* send Ext Cntl ON: Activate CAT */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -171,7 +171,7 @@ int frg8800_close(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
/* send Ext Cntl OFF: Deactivate CAT */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -189,7 +189,7 @@ int frg8800_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
cmd[0] = (cmd[0] & 0xf0) | (1 << ((((long long)freq) % 100) / 25));
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -232,7 +232,7 @@ int frg8800_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
cmd[3] = md;
/* Mode set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -246,6 +246,6 @@ int frg8800_set_powerstat(RIG *rig, powerstat_t status)
cmd[3] = status == RIG_POWER_OFF ? 0xff : 0xfe;
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}

Wyświetl plik

@ -148,7 +148,7 @@ int frg9600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd_be(cmd + 1, freq / 10, 8);
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -191,6 +191,6 @@ int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
cmd[0] = md;
/* Mode set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}

Wyświetl plik

@ -526,20 +526,21 @@ static int ft100_send_priv_cmd(RIG *rig, unsigned char cmd_index)
if (!rig) { return -RIG_EINVAL; }
return write_block(&rig->state.rigport, (unsigned char *) &ncmd[cmd_index].nseq,
return write_block(RIGPORT(rig), (unsigned char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
static int ft100_read_status(RIG *rig)
{
struct ft100_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft100_priv_data *)rig->state.priv;
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_STATUS);
@ -548,7 +549,7 @@ static int ft100_read_status(RIG *rig)
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->status,
ret = read_block(rp, (unsigned char *) &priv->status,
sizeof(FT100_STATUS_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read status=%i \n", __func__, ret);
@ -564,10 +565,11 @@ static int ft100_read_flags(RIG *rig)
{
struct ft100_priv_data *priv = (struct ft100_priv_data *)rig->state.priv;
int ret;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_FLAGS);
@ -576,7 +578,7 @@ static int ft100_read_flags(RIG *rig)
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->flags,
ret = read_block(rp, (unsigned char *) &priv->flags,
sizeof(FT100_FLAG_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read flags=%i \n", __func__, ret);
@ -605,7 +607,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
freq = (int) freq / 10;
to_bcd(p_cmd, freq, 8); /* store bcd format in in p_cmd */
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
@ -731,7 +733,7 @@ int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else if (width <= 2400) { p_cmd[3] = 0x00; }
else { p_cmd[3] = 0x01; }
ret = write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
ret = write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
if (ret != RIG_OK)
{
@ -992,7 +994,7 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &ft100_meter,
ret = read_block(RIGPORT(rig), (unsigned char *) &ft100_meter,
sizeof(FT100_METER_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read meters=%d\n", __func__, ret);
@ -1209,7 +1211,7 @@ int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
p_cmd[3] = (char)pcode;
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
@ -1263,7 +1265,7 @@ int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
p_cmd[3] = (char)ptone;
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)

Wyświetl plik

@ -633,7 +633,6 @@ static int ft1000d_cleanup(RIG *rig)
*/
static int ft1000d_open(RIG *rig)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
int err;
@ -645,12 +644,11 @@ static int ft1000d_open(RIG *rig)
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
rig_s = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, rig_s->rigport.write_delay);
__func__, RIGPORT(rig)->write_delay);
rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n",
__func__, rig_s->rigport.post_write_delay);
__func__, RIGPORT(rig)->post_write_delay);
rig_debug(RIG_DEBUG_TRACE,
"%s: read pacing = %i\n", __func__, priv->pacing);
@ -2648,7 +2646,7 @@ static int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level,
return err;
}
err = read_block(&rig->state.rigport, mdata, FT1000D_READ_METER_LENGTH);
err = read_block(RIGPORT(rig), mdata, FT1000D_READ_METER_LENGTH);
if (err < 0)
{
@ -3451,7 +3449,7 @@ static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
unsigned short ch)
{
struct rig_state *rig_s;
hamlib_port_t *rp = RIGPORT(rig);
struct ft1000d_priv_data *priv;
int n;
int err;
@ -3470,9 +3468,8 @@ static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
rig_s = &rig->state;
retry = rig_s->rigport.retry;
retry = rp->retry;
do
{
@ -3541,7 +3538,7 @@ static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
return -RIG_EINVAL;
}
n = read_block(&rig->state.rigport, p, rl);
n = read_block(rp, p, rl);
}
while (n < 0 && retry-- >= 0);
@ -3575,6 +3572,7 @@ static int ft1000d_get_update_data(RIG *rig, unsigned char ci,
static int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
{
int err;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: ci = 0x%02x\n", __func__, ci);
@ -3591,15 +3589,14 @@ static int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
err = write_block(&rig->state.rigport, ncmd[ci].nseq,
YAESU_CMD_LENGTH);
err = write_block(rp, ncmd[ci].nseq, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
return err;
}
hl_usleep(rig->state.rigport.write_delay * 1000);
hl_usleep(rp->write_delay * 1000);
return RIG_OK;
}
@ -3621,6 +3618,7 @@ static int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p3, unsigned char p4)
{
struct ft1000d_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3652,15 +3650,14 @@ static int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[1] = p3;
priv->p_cmd[0] = p4;
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
err = write_block(rp, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
return err;
}
hl_usleep(rig->state.rigport.write_delay * 1000);
hl_usleep(rp->write_delay * 1000);
return RIG_OK;
}
@ -3679,6 +3676,7 @@ static int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
static int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct ft1000d_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
int err;
// cppcheck-suppress *
char *fmt = "%s: requested freq after conversion = %"PRIll" Hz\n";
@ -3711,15 +3709,14 @@ static int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT1000D_BCD_DIAL) * 10);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
err = write_block(rp, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
return err;
}
hl_usleep(rig->state.rigport.write_delay * 1000);
hl_usleep(rp->write_delay * 1000);
return RIG_OK;
}
@ -3737,6 +3734,7 @@ static int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
static int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct ft1000d_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3777,15 +3775,14 @@ static int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
// Store bcd format into privat command storage area
to_bcd(priv->p_cmd, labs(rit) / 10, FT1000D_BCD_RIT);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
err = write_block(rp, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
return err;
}
hl_usleep(rig->state.rigport.write_delay * 1000);
hl_usleep(rp->write_delay * 1000);
return RIG_OK;
}

Wyświetl plik

@ -796,6 +796,7 @@ static int ft1000mp_cleanup(RIG *rig)
static int ft1000mp_open(RIG *rig)
{
struct rig_state *rig_s;
hamlib_port_t *rp = RIGPORT(rig);
struct ft1000mp_priv_data *p;
unsigned char *cmd; /* points to sequence to send */
@ -805,10 +806,10 @@ static int ft1000mp_open(RIG *rig)
p = (struct ft1000mp_priv_data *)rig_s->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: write_delay = %i msec \n", __func__,
rig_s->rigport.write_delay);
rp->write_delay);
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: post_write_delay = %i msec \n",
__func__,
rig_s->rigport.post_write_delay);
rp->post_write_delay);
/*
* Copy native cmd PACING to private cmd storage area
@ -819,7 +820,7 @@ static int ft1000mp_open(RIG *rig)
/* send PACING cmd to rig */
cmd = p->p_cmd;
write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
write_block(rp, cmd, YAESU_CMD_LENGTH);
ft1000mp_get_vfo(rig, &rig->state.current_vfo);
/* TODO */
@ -881,7 +882,7 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
(freq_t)from_bcd(p->p_cmd, 8) * 10);
cmd = p->p_cmd; /* get native sequence */
write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
}
@ -1308,11 +1309,10 @@ static int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
struct ft1000mp_priv_data *priv;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char *cmd;
ENTERFUNC;
rs = &rig->state;
priv = (struct ft1000mp_priv_data *)rig->state.priv;
switch (func)
@ -1329,7 +1329,7 @@ static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
cmd = priv->p_cmd;
write_block(&rs->rigport, cmd, YAESU_CMD_LENGTH);
write_block(rp, cmd, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
case RIG_FUNC_XIT:
@ -1344,7 +1344,7 @@ static int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
cmd = priv->p_cmd;
write_block(&rs->rigport, cmd, YAESU_CMD_LENGTH);
write_block(rp, cmd, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
default:
@ -1486,7 +1486,7 @@ static int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit)
priv->p_cmd[2] = direction;
cmd = priv->p_cmd; /* get native sequence */
write_block(&rs->rigport, cmd, YAESU_CMD_LENGTH);
write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
}
@ -1548,10 +1548,11 @@ static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
{
struct ft1000mp_priv_data *priv;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char lvl_data[YAESU_CMD_LENGTH];
int m;
int retval;
int retry = rig->state.rigport.retry;
int retry = rp->retry;
ENTERFUNC;
rs = &rig->state;
@ -1611,9 +1612,9 @@ static int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level,
do
{
write_block(&rs->rigport, priv->p_cmd, YAESU_CMD_LENGTH);
write_block(rp, priv->p_cmd, YAESU_CMD_LENGTH);
retval = read_block(&rs->rigport, lvl_data, YAESU_CMD_LENGTH);
retval = read_block(rp, lvl_data, YAESU_CMD_LENGTH);
}
while (retry-- && retval == -RIG_ETIMEOUT);
@ -1688,7 +1689,7 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
/* send UPDATE command to fetch data*/
ft1000mp_send_priv_cmd(rig, ci);
n = read_block(&rig->state.rigport, p->update_data, rl);
n = read_block(RIGPORT(rig), p->update_data, rl);
if (n == -RIG_ETIMEOUT)
{
@ -1717,7 +1718,7 @@ static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
RETURNFUNC(-RIG_EINVAL);
}
write_block(&rig->state.rigport, ncmd[ci].nseq, YAESU_CMD_LENGTH);
write_block(RIGPORT(rig), ncmd[ci].nseq, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);

Wyświetl plik

@ -389,20 +389,21 @@ static int ft600_send_priv_cmd(RIG *rig, unsigned char cmd_index)
if (!rig) { return -RIG_EINVAL; }
return write_block(&rig->state.rigport, (unsigned char *) &ncmd[cmd_index].nseq,
return write_block(RIGPORT(rig), (unsigned char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
static int ft600_read_status(RIG *rig)
{
struct ft600_priv_data *priv;
hamlib_port_t *rp = RIGPORT(rig);
int ret;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct ft600_priv_data *)rig->state.priv;
rig_flush(&rig->state.rigport);
rig_flush(rp);
ret = ft600_send_priv_cmd(rig, FT600_NATIVE_CAT_READ_STATUS);
@ -412,8 +413,8 @@ static int ft600_read_status(RIG *rig)
}
ret = read_block(&rig->state.rigport,
(unsigned char *) &priv->status, FT600_STATUS_UPDATE_DATA_LENGTH);
ret = read_block(rp, (unsigned char *) &priv->status,
FT600_STATUS_UPDATE_DATA_LENGTH);
rig_debug(RIG_DEBUG_VERBOSE, "%s: read status=%i \n", __func__, ret);
@ -444,7 +445,7 @@ static int ft600_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_debug(RIG_DEBUG_VERBOSE, "%s: read tx status=%i \n", __func__, ret);
ret = read_block(&rig->state.rigport, &priv->s_meter, 5);
ret = read_block(RIGPORT(rig), &priv->s_meter, 5);
if (ret < 0)
{
@ -475,7 +476,7 @@ static int ft600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
freq = (int)freq / 10;
to_bcd(p_cmd, freq, 8); /* store bcd format in in p_cmd */
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
static int ft600_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
@ -643,7 +644,7 @@ static int ft600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else if (width <= 2400) { p_cmd[3] = 0x00; }
else { p_cmd[3] = 0x01; }
ret = write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
ret = write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
if (ret != RIG_OK)
{

Wyświetl plik

@ -240,7 +240,7 @@ int ft736_open(RIG *rig)
/* send Ext Cntl ON: Activate CAT */
ret = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
ret = write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
if (ret != RIG_OK)
{
@ -259,7 +259,7 @@ int ft736_close(RIG *rig)
free(rig->state.priv);
/* send Ext Cntl OFF: Deactivate CAT */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -287,7 +287,7 @@ int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
cmd[0] = (cmd[0] & 0x0f) | 0xc0;
}
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
if (retval == RIG_OK) { rig_set_cache_freq(rig, vfo, freq); }
@ -358,7 +358,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
cmd[0] = md;
/* Mode set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -375,7 +375,7 @@ int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
*/
cmd[4] = split == RIG_SPLIT_ON ? 0x0e : 0x8e;
ret = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
ret = write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
if (ret == RIG_OK)
{
@ -403,7 +403,7 @@ int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
/* Frequency set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -444,7 +444,7 @@ int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
cmd[0] = md;
/* Mode set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -457,17 +457,18 @@ int ft736_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
cmd[4] = ptt == RIG_PTT_ON ? 0x08 : 0x88;
/* Tx/Rx set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xe7};
int retval;
hamlib_port_t *rp = RIGPORT(rig);
rig_flush(&rig->state.rigport);
rig_flush(rp);
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -475,7 +476,7 @@ int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
}
/* read back the 1 byte */
retval = read_block(&rig->state.rigport, cmd, 5);
retval = read_block(rp, cmd, 5);
if (retval < 1)
{
@ -494,16 +495,17 @@ int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7};
int retval;
hamlib_port_t *rp = RIGPORT(rig);
if (level != RIG_LEVEL_RAWSTR)
{
return -RIG_EINVAL;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
/* send Test S-meter cmd to rig */
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -511,7 +513,7 @@ int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
/* read back the 1 byte */
retval = read_block(&rig->state.rigport, cmd, 5);
retval = read_block(rp, cmd, 5);
if (retval < 1)
{
@ -553,7 +555,7 @@ int ft736_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
@ -564,7 +566,7 @@ int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
to_bcd_be(cmd, offs / 10, 8);
/* Offset set */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
int ft736_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
@ -585,7 +587,7 @@ int ft736_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
int ft736_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
@ -608,7 +610,7 @@ int ft736_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
cmd[0] = 0x3e - i;
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
int ft736_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)

Wyświetl plik

@ -483,17 +483,17 @@ int ft747_cleanup(RIG *rig)
int ft747_open(RIG *rig)
{
struct rig_state *rig_s;
hamlib_port_t *rp = RIGPORT(rig);
struct ft747_priv_data *p;
int ret;
rig_s = &rig->state;
p = (struct ft747_priv_data *)rig_s->priv;
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: write_delay = %i msec \n",
rig_s->rigport.write_delay);
rp->write_delay);
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: post_write_delay = %i msec \n",
rig_s->rigport.post_write_delay);
rp->post_write_delay);
/*
* Copy native cmd PACING to private cmd storage area
@ -507,7 +507,7 @@ int ft747_open(RIG *rig)
/* send PACING cmd to rig, once for all */
ret = write_block(&rig->state.rigport, p->p_cmd, YAESU_CMD_LENGTH);
ret = write_block(rp, p->p_cmd, YAESU_CMD_LENGTH);
if (ret < 0)
{
@ -568,7 +568,7 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_force_cache_timeout(&p->status_tv);
cmd = p->p_cmd; /* get native sequence */
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -958,7 +958,7 @@ int ft747_set_mem(RIG *rig, vfo_t vfo, int ch)
rig_force_cache_timeout(&p->status_tv);
return write_block(&rig->state.rigport, p->p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p->p_cmd, YAESU_CMD_LENGTH);
}
int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch)
@ -1003,7 +1003,7 @@ static int ft747_get_update_data(RIG *rig)
//unsigned char last_byte;
p = (struct ft747_priv_data *)rig->state.priv;
rigport = &rig->state.rigport;
rigport = RIGPORT(rig);
if (rig->state.cache.ptt == RIG_PTT_ON
|| !rig_check_cache_timeout(&p->status_tv, FT747_CACHE_TIMEOUT))
@ -1064,7 +1064,7 @@ static int ft747_send_priv_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, ft747_ncmd[ci].nseq, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), ft747_ncmd[ci].nseq, YAESU_CMD_LENGTH);
}

Wyświetl plik

@ -465,7 +465,7 @@ static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
to_bcd(cmd, freq / 10, BCD_LEN);
priv->curfreq = freq;
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -491,7 +491,7 @@ static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* fill in p1 */
cmd[3] = mode2rig(rig, mode, width);
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
}
@ -622,7 +622,7 @@ static int ft757_set_vfo(RIG *rig, vfo_t vfo)
priv->current_vfo = vfo;
RETURNFUNC(write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH));
RETURNFUNC(write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH));
}
static int ft757gx_get_vfo(RIG *rig, vfo_t *vfo)
@ -687,6 +687,7 @@ static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, 0x10};
int retval;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
@ -700,10 +701,10 @@ static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return -RIG_EINVAL;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
/* send READ STATUS(Meter only) cmd to rig */
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -711,7 +712,7 @@ static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
/* read back the 1 byte */
retval = read_block(&rig->state.rigport, cmd, 1);
retval = read_block(rp, cmd, 1);
if (retval != 1)
{
@ -738,22 +739,23 @@ static int ft757_get_update_data(RIG *rig)
{
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10};
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
int retval = 0;
long nbtries;
/* Maximum number of attempts to ask/read the data. */
int maxtries = rig->state.rigport.retry ;
int maxtries = rp->retry ;
rig_debug(RIG_DEBUG_VERBOSE, "%s called Timeout=%d ms, Retry=%d\n",
__func__, rig->state.rigport.timeout, maxtries);
__func__, rp->timeout, maxtries);
/* At least on one model, returns erraticaly a timeout. Increasing the timeout
does not fix things. So we restart the read from scratch, it works most of times. */
for (nbtries = 0 ; nbtries < maxtries ; nbtries++)
{
rig_flush(&rig->state.rigport);
rig_flush(rp);
/* send READ STATUS cmd to rig */
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
retval = write_block(rp, cmd, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -761,8 +763,7 @@ static int ft757_get_update_data(RIG *rig)
}
/* read back the 75 status bytes */
retval = read_block(&rig->state.rigport,
priv->update_data,
retval = read_block(rp, priv->update_data,
FT757GX_STATUS_UPDATE_DATA_LENGTH);
if (retval == FT757GX_STATUS_UPDATE_DATA_LENGTH)

Wyświetl plik

@ -456,7 +456,7 @@ int ft767_open(RIG *rig)
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
int retval;
rig_flush(&rig->state.rigport);
rig_flush(RIGPORT(rig));
/* send 0 delay PACING cmd to rig */
retval = ft767_enter_CAT(rig);
@ -1232,7 +1232,7 @@ int ft767_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return -RIG_EINVAL; /* sorry, wrong VFO */
}
rig_flush(&rig->state.rigport);
rig_flush(RIGPORT(rig));
retval = ft767_enter_CAT(rig);
@ -1407,6 +1407,7 @@ int ft767_leave_CAT(RIG *rig)
int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length)
{
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
size_t replylen, cpycnt;
unsigned char cmd_echo_buf[5];
int retval;
@ -1480,12 +1481,10 @@ int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length)
}
/* send the command block */
write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
write_block(rp, cmd, YAESU_CMD_LENGTH);
/* read back the command block echo */
retval = read_block(&rig->state.rigport,
cmd_echo_buf,
YAESU_CMD_LENGTH);
retval = read_block(rp, cmd_echo_buf, YAESU_CMD_LENGTH);
if (retval < 0)
{
@ -1503,12 +1502,10 @@ int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length)
}
/* send the ACK */
write_block(&rig->state.rigport, priv->ack_cmd, YAESU_CMD_LENGTH);
write_block(rp, priv->ack_cmd, YAESU_CMD_LENGTH);
/* read back the response (status bytes) */
retval = read_block(&rig->state.rigport,
priv->rx_data,
replylen);
retval = read_block(rp, priv->rx_data, replylen);
// update data
if (retval != replylen)
@ -1545,7 +1542,7 @@ int ft767_get_update_data(RIG *rig)
struct ft767_priv_data *priv = (struct ft767_priv_data *)rig->state.priv;
int retval;
rig_flush(&rig->state.rigport);
rig_flush(RIGPORT(rig));
/* Entering CAT updates our data structures */
retval = ft767_enter_CAT(rig);
@ -1576,7 +1573,7 @@ int ft767_set_split(RIG *rig, unsigned int split)
int retval;
unsigned int curr_split;
rig_flush(&rig->state.rigport);
rig_flush(RIGPORT(rig));
/* Entering CAT updates our data structures */
retval = ft767_enter_CAT(rig);

Wyświetl plik

@ -829,6 +829,7 @@ static int check_cache_timeout(struct timeval *tv)
static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
{
unsigned char data[YAESU_CMD_LENGTH];
hamlib_port_t *rp = RIGPORT(rig);
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -838,9 +839,9 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
data[0] = addr >> 8;
data[1] = addr & 0xff;
write_block(&rig->state.rigport, data, YAESU_CMD_LENGTH);
write_block(rp, data, YAESU_CMD_LENGTH);
if ((n = read_block(&rig->state.rigport, data, 2)) < 0)
if ((n = read_block(rp, data, 2)) < 0)
{
return n;
}
@ -869,11 +870,12 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
static int ft817_get_status(RIG *rig, int status)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
struct timeval *tv;
unsigned char *data;
int len;
int n;
int retries = rig->state.rigport.retry;
int retries = rp->retry;
unsigned char result[2];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -913,10 +915,9 @@ static int ft817_get_status(RIG *rig, int status)
do
{
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, ncmd[status].nseq,
YAESU_CMD_LENGTH);
n = read_block(&rig->state.rigport, data, len);
rig_flush(rp);
write_block(rp, ncmd[status].nseq, YAESU_CMD_LENGTH);
n = read_block(rp, data, len);
}
while (retries-- && n < 0);
@ -987,7 +988,7 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
freq_t f1 = 0, f2 = 0;
int retries = rig->state.rigport.retry +
int retries = RIGPORT(rig)->retry +
1; // +1 because, because 2 steps are needed even in best scenario
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, vfo=%s, ptt=%d, split=%d\n", __func__,
@ -1488,16 +1489,17 @@ static int ft818_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
int ft817_read_ack(RIG *rig)
{
unsigned char dummy;
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.rigport.post_write_delay == 0)
if (rp->post_write_delay == 0)
{
if (read_block(&rig->state.rigport, &dummy, 1) < 0)
if (read_block(rp, &dummy, 1) < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: error reading ack\n", __func__);
rig_debug(RIG_DEBUG_ERR, "%s: adjusting post_write_delay to avoid ack\n",
__func__);
rig->state.rigport.post_write_delay =
rp->post_write_delay =
10; // arbitrary choice right now of max 100 cmds/sec
return RIG_OK; // let it continue without checking for ack now
}
@ -1519,6 +1521,7 @@ int ft817_read_ack(RIG *rig)
*/
static int ft817_send_cmd(RIG *rig, int index)
{
hamlib_port_t *rp = RIGPORT(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (ncmd[index].ncomp == 0)
@ -1527,8 +1530,8 @@ static int ft817_send_cmd(RIG *rig, int index)
return -RIG_EINTERNAL;
}
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, ncmd[index].nseq, YAESU_CMD_LENGTH);
rig_flush(rp);
write_block(rp, ncmd[index].nseq, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -1550,7 +1553,7 @@ static int ft817_send_icmd(RIG *rig, int index, const unsigned char *data)
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -1746,7 +1749,7 @@ static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
int index;
ptt_t ptt_response = -1;
int retries = rig->state.rigport.retry;
int retries = RIGPORT(rig)->retry;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
@ -2059,10 +2062,10 @@ int ft817_set_powerstat(RIG *rig, powerstat_t status)
case RIG_POWER_ON:
// send 5 bytes first, snooze a bit, then PWR_ON
write_block(&rig->state.rigport,
write_block(RIGPORT(rig),
ncmd[FT817_NATIVE_CAT_PWR_WAKE].nseq, YAESU_CMD_LENGTH);
hl_usleep(200 * 1000);
write_block(&rig->state.rigport, ncmd[FT817_NATIVE_CAT_PWR_ON].nseq,
write_block(RIGPORT(rig), ncmd[FT817_NATIVE_CAT_PWR_ON].nseq,
YAESU_CMD_LENGTH);
return RIG_OK;

Wyświetl plik

@ -440,7 +440,6 @@ static int ft840_cleanup(RIG *rig)
static int ft840_open(RIG *rig)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int err;
@ -452,12 +451,11 @@ static int ft840_open(RIG *rig)
}
priv = (struct ft840_priv_data *)rig->state.priv;
rig_s = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
__func__, rig_s->rigport.write_delay);
__func__, RIGPORT(rig)->write_delay);
rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n",
__func__, rig_s->rigport.post_write_delay);
__func__, RIGPORT(rig)->post_write_delay);
rig_debug(RIG_DEBUG_TRACE,
"%s: read pacing = %i\n", __func__, priv->pacing);
@ -1746,7 +1744,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return err;
}
n = read_block(&rig->state.rigport, priv->update_data, rl);
n = read_block(RIGPORT(rig), priv->update_data, rl);
if (n < 0)
{
@ -1789,7 +1787,7 @@ static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
err = write_block(&rig->state.rigport, ncmd[ci].nseq,
err = write_block(RIGPORT(rig), ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1850,7 +1848,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[P3] = p3;
priv->p_cmd[P4] = p4;
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
err = write_block(RIGPORT(rig), (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1911,7 +1909,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT840_BCD_DIAL) * 10);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
err = write_block(RIGPORT(rig), (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1993,7 +1991,7 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv->p_cmd[P1] = p1; /* ick */
priv->p_cmd[P2] = p2;
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
err = write_block(RIGPORT(rig), (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)

Wyświetl plik

@ -1119,7 +1119,7 @@ static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
return -RIG_EINVAL;
}
return write_block(&rig->state.rigport, ncmd[cmd_index].nseq,
return write_block(RIGPORT(rig), ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
@ -1213,7 +1213,7 @@ static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
}
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
#define MD_LSB 0x00
@ -1230,7 +1230,7 @@ static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
pbwidth_t *width)
{
struct rig_state *rs = &rig->state;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */
unsigned char cmd_index; /* index of sequence to send */
unsigned char data[8];
@ -1270,14 +1270,14 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
return n;
}
n = write_block(&rs->rigport, p_cmd, YAESU_CMD_LENGTH);
n = write_block(rp, p_cmd, YAESU_CMD_LENGTH);
if (n < 0)
{
return n;
}
n = read_block(&rs->rigport, data, YAESU_CMD_LENGTH);
n = read_block(rp, data, YAESU_CMD_LENGTH);
if (n != YAESU_CMD_LENGTH)
{
@ -1358,7 +1358,6 @@ static int ft847_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
unsigned char cmd_index; /* index of sequence to send */
struct rig_state *rs = &rig->state;
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */
int ret;
@ -1467,7 +1466,7 @@ static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return ret;
}
return write_block(&rs->rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
@ -1595,6 +1594,7 @@ static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int ft847_get_status(RIG *rig, int status_ci)
{
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
hamlib_port_t *rp = RIGPORT(rig);
unsigned char *data;
int len;
int n;
@ -1621,17 +1621,16 @@ static int ft847_get_status(RIG *rig, int status_ci)
return -RIG_EINTERNAL;
}
rig_flush(&rig->state.rigport);
rig_flush(rp);
n = write_block(&rig->state.rigport, ncmd[status_ci].nseq,
YAESU_CMD_LENGTH);
n = write_block(rp, ncmd[status_ci].nseq, YAESU_CMD_LENGTH);
if (n < 0)
{
return n;
}
n = read_block(&rig->state.rigport, data, len);
n = read_block(rp, data, len);
if (n < 0)
{
@ -1873,7 +1872,7 @@ static int ft847_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
return ret;
}
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
@ -1918,7 +1917,7 @@ static int ft847_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
/* get associated CAT code */
p_cmd[0] = ft847_ctcss_cat[i];
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
static int ft847_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
@ -1944,7 +1943,7 @@ static int ft847_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
/* DCS Code # (i.e. 07, 54=DCS Code 754) */
to_bcd_be(p_cmd, code, 4); /* store bcd format in in p_cmd */
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}
@ -1987,6 +1986,6 @@ static int ft847_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs)
to_bcd_be(p_cmd, rptr_offs / 10, 8); /* store bcd format in in p_cmd */
return write_block(&rig->state.rigport, p_cmd, YAESU_CMD_LENGTH);
return write_block(RIGPORT(rig), p_cmd, YAESU_CMD_LENGTH);
}

Some files were not shown because too many files have changed in this diff Show More