astyle source code

pull/976/head
Mike Black W9MDB 2022-02-05 15:27:43 -06:00
rodzic db1de6bfd2
commit 8c34ce1a2d
120 zmienionych plików z 3412 dodań i 2377 usunięć

Wyświetl plik

@ -127,7 +127,8 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, (unsigned char *) response, response_len, ";", 1, 0, 1);
len = read_string(&rs->ampport, (unsigned char *) response, response_len, ";",
1, 0, 1);
if (len < 0) { return len; }
}
@ -141,7 +142,8 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (response) // if response expected get it
{
response[0] = 0;
len = read_string(&rs->ampport, (unsigned char *) response, response_len, ";", 1, 0, 1);
len = read_string(&rs->ampport, (unsigned char *) response, response_len, ";",
1, 0, 1);
if (len < 0)
{
@ -167,7 +169,8 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, (unsigned char *) responsebuf, KPABUFSZ, ";", 1, 0, 1);
len = read_string(&rs->ampport, (unsigned char *) responsebuf, KPABUFSZ, ";", 1,
0, 1);
if (len < 0) { return len; }
}
@ -370,7 +373,8 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
//
do
{
retval = read_string(&rs->ampport, (unsigned char *) responsebuf, sizeof(responsebuf), ";", 1, 0,
retval = read_string(&rs->ampport, (unsigned char *) responsebuf,
sizeof(responsebuf), ";", 1, 0,
1);
if (retval != RIG_OK) { return retval; }
@ -487,7 +491,8 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
}
rig_debug(RIG_DEBUG_ERR, "%s unknown fault from %s\n", __func__, responsebuf);
SNPRINTF(priv->tmpbuf, sizeof(priv->tmpbuf), "Unknown fault code=0x%02x", fault);
SNPRINTF(priv->tmpbuf, sizeof(priv->tmpbuf), "Unknown fault code=0x%02x",
fault);
val->s = priv->tmpbuf;
return RIG_OK;

Wyświetl plik

@ -6,13 +6,15 @@
static volatile long pipe_serial_nunber;
int async_pipe_create(hamlib_async_pipe_t **pipe_out, unsigned long pipe_buffer_size, unsigned long pipe_connect_timeout_millis)
int async_pipe_create(hamlib_async_pipe_t **pipe_out,
unsigned long pipe_buffer_size, unsigned long pipe_connect_timeout_millis)
{
DWORD error_code;
CHAR pipe_name[MAX_PATH];
hamlib_async_pipe_t *pipe;
pipe = calloc(1, sizeof(hamlib_async_pipe_t));
if (pipe == NULL)
{
return -RIG_ENOMEM;
@ -24,20 +26,20 @@ int async_pipe_create(hamlib_async_pipe_t **pipe_out, unsigned long pipe_buffer_
}
SNPRINTF(pipe_name, sizeof(pipe_name),
"\\\\.\\Pipe\\Hamlib.%08lx.%08lx",
GetCurrentProcessId(),
InterlockedIncrement(&pipe_serial_nunber)
"\\\\.\\Pipe\\Hamlib.%08lx.%08lx",
GetCurrentProcessId(),
InterlockedIncrement(&pipe_serial_nunber)
);
pipe->read = CreateNamedPipe(
pipe_name,
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_WAIT,
1, // Number of pipes
pipe_buffer_size, // Out buffer size
pipe_buffer_size, // In buffer size
pipe_connect_timeout_millis, // Timeout in ms
NULL);
pipe_name,
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_WAIT,
1, // Number of pipes
pipe_buffer_size, // Out buffer size
pipe_buffer_size, // In buffer size
pipe_connect_timeout_millis, // Timeout in ms
NULL);
if (!pipe->read)
{
@ -45,14 +47,14 @@ int async_pipe_create(hamlib_async_pipe_t **pipe_out, unsigned long pipe_buffer_
}
pipe->write = CreateFile(
pipe_name,
GENERIC_WRITE,
0, // No sharing
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL // Template file
);
pipe_name,
GENERIC_WRITE,
0, // No sharing
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL // Template file
);
if (pipe->write == INVALID_HANDLE_VALUE)
{
@ -64,10 +66,10 @@ int async_pipe_create(hamlib_async_pipe_t **pipe_out, unsigned long pipe_buffer_
}
pipe->read_overlapped.hEvent = CreateEvent(
NULL, // default security attribute
TRUE, // manual-reset event
FALSE, // initial state = not signaled
NULL); // unnamed event object
NULL, // default security attribute
TRUE, // manual-reset event
FALSE, // initial state = not signaled
NULL); // unnamed event object
if (pipe->read_overlapped.hEvent == NULL)
{
@ -80,10 +82,10 @@ int async_pipe_create(hamlib_async_pipe_t **pipe_out, unsigned long pipe_buffer_
}
pipe->write_overlapped.hEvent = CreateEvent(
NULL, // default security attribute
TRUE, // manual-reset event
FALSE, // initial state = not signaled
NULL); // unnamed event object
NULL, // default security attribute
TRUE, // manual-reset event
FALSE, // initial state = not signaled
NULL); // unnamed event object
if (pipe->write_overlapped.hEvent == NULL)
{
@ -108,6 +110,7 @@ void async_pipe_close(hamlib_async_pipe_t *pipe)
CloseHandle(pipe->read);
pipe->read = NULL;
}
if (pipe->write != NULL)
{
CloseHandle(pipe->write);
@ -119,6 +122,7 @@ void async_pipe_close(hamlib_async_pipe_t *pipe)
CloseHandle(pipe->read_overlapped.hEvent);
pipe->read_overlapped.hEvent = NULL;
}
if (pipe->write_overlapped.hEvent != NULL)
{
CloseHandle(pipe->write_overlapped.hEvent);
@ -128,9 +132,11 @@ void async_pipe_close(hamlib_async_pipe_t *pipe)
free(pipe);
}
ssize_t async_pipe_read(hamlib_async_pipe_t *pipe, void *buf, size_t count, int timeout)
ssize_t async_pipe_read(hamlib_async_pipe_t *pipe, void *buf, size_t count,
int timeout)
{
HANDLE event_handles[1] = {
HANDLE event_handles[1] =
{
pipe->read_overlapped.hEvent,
};
HANDLE read_handle = pipe->read;
@ -140,63 +146,75 @@ ssize_t async_pipe_read(hamlib_async_pipe_t *pipe, void *buf, size_t count, int
ssize_t bytes_read;
result = ReadFile(read_handle, buf, count, NULL, overlapped);
if (!result)
{
result = GetLastError();
switch (result)
{
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
wait_result = WaitForMultipleObjects(1, event_handles, FALSE, timeout);
case ERROR_SUCCESS:
// No error?
break;
switch (wait_result)
case ERROR_IO_PENDING:
wait_result = WaitForMultipleObjects(1, event_handles, FALSE, timeout);
switch (wait_result)
{
case WAIT_OBJECT_0 + 0:
break;
case WAIT_TIMEOUT:
if (count == 0)
{
case WAIT_OBJECT_0 + 0:
break;
case WAIT_TIMEOUT:
if (count == 0)
{
// Zero-length reads are used to wait for incoming data,
// so the I/O operation needs to be cancelled in case of a timeout
CancelIo(read_handle);
return -RIG_ETIMEOUT;
}
else
{
// Should not happen, as reads with count > 0 are used only when there is data available in the pipe
return -RIG_EINTERNAL;
}
default:
result = GetLastError();
rig_debug(RIG_DEBUG_ERR, "%s: WaitForMultipleObjects() error: %d\n", __func__, result);
return -RIG_EINTERNAL;
// Zero-length reads are used to wait for incoming data,
// so the I/O operation needs to be cancelled in case of a timeout
CancelIo(read_handle);
return -RIG_ETIMEOUT;
}
break;
else
{
// Should not happen, as reads with count > 0 are used only when there is data available in the pipe
return -RIG_EINTERNAL;
}
default:
rig_debug(RIG_DEBUG_ERR, "%s: ReadFile() error: %d\n", __func__, result);
return -RIG_EIO;
result = GetLastError();
rig_debug(RIG_DEBUG_ERR, "%s: WaitForMultipleObjects() error: %d\n", __func__,
result);
return -RIG_EINTERNAL;
}
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: ReadFile() error: %d\n", __func__, result);
return -RIG_EIO;
}
}
result = GetOverlappedResult(read_handle, overlapped, (LPDWORD) &bytes_read, FALSE);
result = GetOverlappedResult(read_handle, overlapped, (LPDWORD) &bytes_read,
FALSE);
if (!result)
{
result = GetLastError();
switch (result)
{
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
// Shouldn't happen?
return -RIG_ETIMEOUT;
default:
rig_debug(RIG_DEBUG_ERR, "%s: GetOverlappedResult() error: %d\n", __func__, result);
return -RIG_EIO;
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
// Shouldn't happen?
return -RIG_ETIMEOUT;
default:
rig_debug(RIG_DEBUG_ERR, "%s: GetOverlappedResult() error: %d\n", __func__,
result);
return -RIG_EIO;
}
}
@ -219,9 +237,11 @@ int async_pipe_wait_for_data(hamlib_async_pipe_t *pipe, int timeout)
return result;
}
ssize_t async_pipe_write(hamlib_async_pipe_t *pipe, const unsigned char *buf, size_t count, int timeout)
ssize_t async_pipe_write(hamlib_async_pipe_t *pipe, const unsigned char *buf,
size_t count, int timeout)
{
HANDLE event_handles[1] = {
HANDLE event_handles[1] =
{
pipe->write_overlapped.hEvent,
};
HANDLE write_handle = pipe->write;
@ -231,53 +251,65 @@ ssize_t async_pipe_write(hamlib_async_pipe_t *pipe, const unsigned char *buf, si
ssize_t bytes_written;
result = WriteFile(write_handle, buf, count, NULL, overlapped);
if (!result)
{
result = GetLastError();
switch (result)
{
case ERROR_SUCCESS:
// No error?
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
wait_result = WaitForMultipleObjects(1, event_handles, FALSE, timeout);
switch (wait_result)
{
case WAIT_OBJECT_0 + 0:
break;
case ERROR_IO_PENDING:
wait_result = WaitForMultipleObjects(1, event_handles, FALSE, timeout);
switch (wait_result)
{
case WAIT_OBJECT_0 + 0:
break;
case WAIT_TIMEOUT:
CancelIo(write_handle);
return -RIG_ETIMEOUT;
case WAIT_TIMEOUT:
CancelIo(write_handle);
return -RIG_ETIMEOUT;
default:
result = GetLastError();
rig_debug(RIG_DEBUG_ERR, "%s: WaitForMultipleObjects() error: %d\n", __func__, result);
return -RIG_EINTERNAL;
}
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: WriteFile() error: %d\n", __func__, result);
return -RIG_EIO;
result = GetLastError();
rig_debug(RIG_DEBUG_ERR, "%s: WaitForMultipleObjects() error: %d\n", __func__,
result);
return -RIG_EINTERNAL;
}
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: WriteFile() error: %d\n", __func__, result);
return -RIG_EIO;
}
}
result = GetOverlappedResult(write_handle, overlapped, (LPDWORD) &bytes_written, FALSE);
result = GetOverlappedResult(write_handle, overlapped, (LPDWORD) &bytes_written,
FALSE);
if (!result)
{
result = GetLastError();
switch (result)
{
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
// Shouldn't happen?
return -RIG_ETIMEOUT;
default:
rig_debug(RIG_DEBUG_ERR, "%s: GetOverlappedResult() error: %d\n", __func__, result);
return -RIG_EIO;
case ERROR_SUCCESS:
// No error?
break;
case ERROR_IO_PENDING:
// Shouldn't happen?
return -RIG_ETIMEOUT;
default:
rig_debug(RIG_DEBUG_ERR, "%s: GetOverlappedResult() error: %d\n", __func__,
result);
return -RIG_EIO;
}
}

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1335,21 +1335,21 @@ static int check_port_capabilities(struct termios_list *index)
if (!(cp.dwProvCapabilities & PCF_DTRDSR))
{
SNPRINTF(message, sizeof(message),
"%s: no DTR & DSR support\n", __func__);
"%s: no DTR & DSR support\n", __func__);
report(message);
}
if (!(cp.dwProvCapabilities & PCF_RLSD))
{
SNPRINTF(message, sizeof(message), "%s: no carrier detect (RLSD) support\n",
__func__);
__func__);
report(message);
}
if (!(cp.dwProvCapabilities & PCF_RTSCTS))
{
SNPRINTF(message, sizeof(message),
"%s: no RTS & CTS support\n", __func__);
"%s: no RTS & CTS support\n", __func__);
report(message);
}
@ -1422,8 +1422,9 @@ int win32_serial_open(const char *filename, int flags, ...)
if (open_port(index))
{
SNPRINTF(message, sizeof(message), "serial_open(): Invalid Port Reference for %s\n",
fullfilename);
SNPRINTF(message, sizeof(message),
"serial_open(): Invalid Port Reference for %s\n",
fullfilename);
report(message);
win32_serial_close(index->fd);
return -1;
@ -1456,7 +1457,7 @@ int win32_serial_open(const char *filename, int flags, ...)
if (!first_tl->hComm)
{
SNPRINTF(message, sizeof(message), "open(): Invalid Port Reference for %s\n",
index->filename);
index->filename);
report(message);
}
@ -1678,7 +1679,7 @@ int win32_serial_read(int fd, void *vb, int size)
#ifdef DEBUG_VERBOSE
/* warning Roy Rogers! */
SNPRINTF(message, sizeof(message), " ========== ReadFile = %i 0x%x\n",
(int) nBytes, *((char *) dest + total));
(int) nBytes, *((char *) dest + total));
report(message);
#endif /* DEBUG_VERBOSE */
@ -1725,7 +1726,7 @@ int win32_serial_read(int fd, void *vb, int size)
{
now = GetTickCount();
SNPRINTF(message, sizeof(message), "size > 0: spent=%ld have=%d\n", now - start,
index->ttyset->c_cc[VTIME] * 100);
index->ttyset->c_cc[VTIME] * 100);
report(message);
/* we should use -1 for disabled
@ -1880,7 +1881,7 @@ int win32_serial_read(int fd, void *vb, int size)
#ifdef DEBUG_VERBOSE
/* warning Roy Rogers! */
SNPRINTF(message, sizeof(message), " ========== ReadFile = %i %s\n",
(int) nBytes, (char *) dest + total);
(int) nBytes, (char *) dest + total);
report(message);
#endif /* DEBUG_VERBOSE */
@ -1927,7 +1928,7 @@ int win32_serial_read(int fd, void *vb, int size)
{
now = GetTickCount();
SNPRINTF(message, sizeof(message), "size > 0: spent=%ld have=%d\n", now - start,
index->ttyset->c_cc[VTIME] * 100);
index->ttyset->c_cc[VTIME] * 100);
report(message);
/* we should use -1 for disabled
@ -2350,7 +2351,7 @@ static void show_DCB(DCB myDCB)
default:
SNPRINTF(message, sizeof(message),
"unknown Parity (%#x ):", myDCB.Parity);
"unknown Parity (%#x ):", myDCB.Parity);
report(message);
break;
}
@ -2597,8 +2598,8 @@ int tcgetattr(int fd, struct termios *s_termios)
#ifdef DEBUG_VERBOSE
SNPRINTF(message, sizeof(message),
"tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME],
s_termios->c_cc[VMIN]);
"tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME],
s_termios->c_cc[VMIN]);
report(message);
#endif /* DEBUG_VERBOSE */
@ -2788,8 +2789,9 @@ int tcsetattr(int fd, int when, struct termios *s_termios)
#ifdef DEBUG_VERBOSE
{
char message[32];
SNPRINTF(message, sizeof(message), "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME],
s_termios->c_cc[VMIN]);
SNPRINTF(message, sizeof(message), "VTIME:%d, VMIN:%d\n",
s_termios->c_cc[VTIME],
s_termios->c_cc[VMIN]);
report(message);
}
#endif /* DEBUG_VERBOSE */
@ -2818,19 +2820,19 @@ int tcsetattr(int fd, int when, struct termios *s_termios)
{
char message[64];
SNPRINTF(message, sizeof(message), "ReadIntervalTimeout=%ld\n",
timeouts.ReadIntervalTimeout);
timeouts.ReadIntervalTimeout);
report(message);
SNPRINTF(message, sizeof(message), "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n",
s_termios->c_cc[VTIME], s_termios->c_cc[VMIN]);
s_termios->c_cc[VTIME], s_termios->c_cc[VMIN]);
report(message);
SNPRINTF(message, sizeof(message), "ReadTotalTimeoutConstant: %ld\n",
timeouts.ReadTotalTimeoutConstant);
timeouts.ReadTotalTimeoutConstant);
report(message);
SNPRINTF(message, sizeof(message), "ReadIntervalTimeout : %ld\n",
timeouts.ReadIntervalTimeout);
timeouts.ReadIntervalTimeout);
report(message);
SNPRINTF(message, sizeof(message), "ReadTotalTimeoutMultiplier: %ld\n",
timeouts.ReadTotalTimeoutMultiplier);
timeouts.ReadTotalTimeoutMultiplier);
report(message);
}
#endif /* DEBUG_VERBOSE */
@ -2938,7 +2940,7 @@ int tcdrain(int fd)
0.
*/
SNPRINTF(message, sizeof(message), "FlushFileBuffers() %i\n",
(int) GetLastError());
(int) GetLastError());
report(message);
if (GetLastError() == 0)
@ -3352,7 +3354,8 @@ int win32_serial_ioctl(int fd, int request, ...)
report("DTR is unchanged\n");
}
SNPRINTF(message, sizeof(message), "DTR %i %i\n", *arg & TIOCM_DTR, index->MSR & TIOCM_DTR);
SNPRINTF(message, sizeof(message), "DTR %i %i\n", *arg & TIOCM_DTR,
index->MSR & TIOCM_DTR);
report(message);
if (*arg & TIOCM_DTR)
@ -3380,7 +3383,8 @@ int win32_serial_ioctl(int fd, int request, ...)
report("RTS is unchanged\n");
}
SNPRINTF(message, sizeof(message), "RTS %i %i\n", *arg & TIOCM_RTS, index->MSR & TIOCM_RTS);
SNPRINTF(message, sizeof(message), "RTS %i %i\n", *arg & TIOCM_RTS,
index->MSR & TIOCM_RTS);
report(message);
if (*arg & TIOCM_RTS)
@ -3579,7 +3583,7 @@ int win32_serial_ioctl(int fd, int request, ...)
*arg = (int) Stat.cbInQue;
#ifdef DEBUG_VERBOSE
SNPRINTF(message, sizeof(message), "FIONREAD: %i bytes available\n",
(int) Stat.cbInQue);
(int) Stat.cbInQue);
report(message);
if (*arg)
@ -3600,8 +3604,8 @@ int win32_serial_ioctl(int fd, int request, ...)
default:
SNPRINTF(message, sizeof(message),
"FIXME: ioctl: unknown request: %#x\n",
request);
"FIXME: ioctl: unknown request: %#x\n",
request);
report(message);
va_end(ap);
return -ENOIOCTLCMD;
@ -3791,7 +3795,8 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
while (timeout_usec > 0)
{
SNPRINTF(message, sizeof(message), "wait for data in read buffer%d\n", (int)Stat.cbInQue);
SNPRINTF(message, sizeof(message), "wait for data in read buffer%d\n",
(int)Stat.cbInQue);
report(message);
if (Stat.cbInQue != 0)
@ -3938,7 +3943,8 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
if (GetLastError() != ERROR_IO_PENDING)
{
SNPRINTF(message, sizeof(message), "WaitCommEvent filename = %s\n", index->filename);
SNPRINTF(message, sizeof(message), "WaitCommEvent filename = %s\n",
index->filename);
report(message);
return (1);
/*

Wyświetl plik

@ -1264,7 +1264,8 @@ int adat_send(RIG *pRig,
rig_flush(&pRigState->rigport);
nRC = write_block(&pRigState->rigport, (unsigned char *) pcData, strlen(pcData));
nRC = write_block(&pRigState->rigport, (unsigned char *) pcData,
strlen(pcData));
rig_debug(RIG_DEBUG_TRACE,
"*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n",
@ -1293,7 +1294,7 @@ int adat_receive(RIG *pRig,
gFnLevel, __func__, __FILE__, __LINE__, pRig);
nRC = read_string(&pRigState->rigport, (unsigned char *) pcData, ADAT_RESPSZ,
ADAT_EOL, 1, 0, 1);
ADAT_EOL, 1, 0, 1);
if (nRC > 0)
{
@ -3723,10 +3724,10 @@ DECLARE_PROBERIG_BACKEND(adat)
memset(acBuf, 0, ADAT_RESPSZ + 1);
nRC = write_block(port,
(unsigned char *)ADAT_CMD_DEF_STRING_GET_ID_CODE,
(unsigned char *)ADAT_CMD_DEF_STRING_GET_ID_CODE,
strlen(ADAT_CMD_DEF_STRING_GET_ID_CODE));
nRead = read_string(port, (unsigned char *) acBuf, ADAT_RESPSZ,
ADAT_EOM, 1, 0, 1);
ADAT_EOM, 1, 0, 1);
close(port->fd);
if ((nRC != RIG_OK || nRead < 0))

Wyświetl plik

@ -320,7 +320,7 @@ int dx77_transaction(RIG *rig,
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, (unsigned char *) echobuf, BUFSZ,
LF, strlen(LF), 0, 1);
LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -337,7 +337,7 @@ int dx77_transaction(RIG *rig,
if (data == NULL)
{
retval = read_string(&rs->rigport, (unsigned char *) echobuf, BUFSZ,
LF, strlen(LF), 0, 1);
LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -359,7 +359,7 @@ int dx77_transaction(RIG *rig,
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
LF, strlen(LF), 0, 1);
LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -683,8 +683,8 @@ int dx77_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
char cmdbuf[BUFSZ];
SNPRINTF(cmdbuf, sizeof(cmdbuf),
AL CMD_SPLT "%d" EOM,
split == RIG_SPLIT_ON ? 1 : 0);
AL CMD_SPLT "%d" EOM,
split == RIG_SPLIT_ON ? 1 : 0);
return dx77_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
}
@ -759,7 +759,8 @@ int dx77_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
}
/* at least 6 digits */
SNPRINTF(freqbuf, sizeof(freqbuf), AL CMD_TXFREQ "%06"PRIll EOM, (int64_t)tx_freq);
SNPRINTF(freqbuf, sizeof(freqbuf), AL CMD_TXFREQ "%06"PRIll EOM,
(int64_t)tx_freq);
retval = dx77_transaction(rig, freqbuf, strlen(freqbuf), NULL, NULL);
@ -1274,7 +1275,8 @@ int dx77_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
SNPRINTF((char *) tonebuf, sizeof(tonebuf), AL CMD_CTCSS "%02d" EOM, i + 1);
return dx77_transaction(rig, (char *) tonebuf, strlen((char*)tonebuf), NULL, NULL);
return dx77_transaction(rig, (char *) tonebuf, strlen((char *)tonebuf), NULL,
NULL);
}

Wyświetl plik

@ -263,7 +263,7 @@ int dxsr8_transaction(RIG *rig,
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, (unsigned char *) replybuf, BUFSZ,
LF, strlen(LF), 0, 1);
LF, strlen(LF), 0, 1);
if (retval < 0)
{
@ -272,7 +272,7 @@ int dxsr8_transaction(RIG *rig,
retval = read_string(&rs->rigport, (unsigned char *) replybuf, BUFSZ,
LF, strlen(LF), 0, 1);
LF, strlen(LF), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -101,7 +101,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,
strlen(EOM), 0, 1);
strlen(EOM), 0, 1);
if (retval < 0)
{
@ -353,7 +353,8 @@ int aor_get_vfo(RIG *rig, vfo_t *vfo)
return RIG_OK;
}
int format8k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode, pbwidth_t width)
int format8k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode,
pbwidth_t width)
{
int aormode;
@ -965,7 +966,7 @@ int aor_set_mem(RIG *rig, vfo_t vfo, int ch)
}
SNPRINTF(membuf, sizeof(membuf), "MR%c%02d" EOM,
bank_base + ch / 100, mem_num);
bank_base + ch / 100, mem_num);
return aor_transaction(rig, membuf, strlen(membuf), NULL, NULL);
}
@ -1021,7 +1022,7 @@ int aor_set_bank(RIG *rig, vfo_t vfo, int bank)
char membuf[BUFSZ];
SNPRINTF(membuf, sizeof(membuf), "MR%c" EOM, (bank % 10) + (bank < 10 ?
priv->bank_base1 : priv->bank_base2));
priv->bank_base1 : priv->bank_base2));
return aor_transaction(rig, membuf, strlen(membuf), NULL, NULL);
}
@ -1034,7 +1035,7 @@ int aor_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
int cmd_len;
SNPRINTF(aorcmd, sizeof(aorcmd), "MX%c%02d ",
chan->bank_num, chan->channel_num % 100);
chan->bank_num, chan->channel_num % 100);
cmd_len = strlen(aorcmd);
cmd_len += format_freq(aorcmd + cmd_len, sizeof(aorcmd) - cmd_len, chan->freq);
@ -1043,12 +1044,14 @@ int aor_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
* FIXME: automode
*/
cmd_len += snprintf(aorcmd + cmd_len, sizeof(aorcmd) - cmd_len, " AU%d ST%06d ",
0, (int)chan->tuning_step);
0, (int)chan->tuning_step);
cmd_len += priv->format_mode(rig, aorcmd + cmd_len, sizeof(aorcmd) - cmd_len, chan->mode, chan->width);
cmd_len += priv->format_mode(rig, aorcmd + cmd_len, sizeof(aorcmd) - cmd_len,
chan->mode, chan->width);
cmd_len += snprintf(aorcmd + cmd_len, sizeof(aorcmd) - cmd_len, " AT%d TM%12s%s",
chan->levels[LVL_ATT].i ? 1 : 0, chan->channel_desc, EOM);
cmd_len += snprintf(aorcmd + cmd_len, sizeof(aorcmd) - cmd_len,
" AT%d TM%12s%s",
chan->levels[LVL_ATT].i ? 1 : 0, chan->channel_desc, EOM);
return aor_transaction(rig, aorcmd, cmd_len, NULL, NULL);
}
@ -1303,7 +1306,7 @@ int aor_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
}
SNPRINTF(aorcmd, sizeof(aorcmd), "MR%c%02d" EOM,
bank_base + channel_num / 100, mem_num);
bank_base + channel_num / 100, mem_num);
retval = aor_transaction(rig, aorcmd, strlen(aorcmd), chanbuf, &chan_len);
/* is the channel empty? */
@ -1379,7 +1382,7 @@ int aor_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg)
}
SNPRINTF(aorcmd, sizeof(aorcmd), "MA%c" EOM,
priv->bank_base1);
priv->bank_base1);
for (i = 0; i < chan_count / LINES_PER_MA; i++)
{
@ -1427,7 +1430,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,
EOM, strlen(EOM), 0,1);
EOM, strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -58,7 +58,8 @@
.funcs = RIG_FUNC_ABM, \
}
static int format2700_mode(RIG *rig, char *buf, int buf_len, rmode_t mode, pbwidth_t width);
static int format2700_mode(RIG *rig, char *buf, int buf_len, rmode_t mode,
pbwidth_t width);
static int parse2700_aor_mode(RIG *rig, char aormode, char aorwidth,
rmode_t *mode, pbwidth_t *width);
@ -210,7 +211,8 @@ const struct rig_caps ar2700_caps =
#define AR2700_NFM '1'
#define AR2700_AM '2'
int format2700_mode(RIG *rig, char *buf, int buf_len, rmode_t mode, pbwidth_t width)
int format2700_mode(RIG *rig, char *buf, int buf_len, rmode_t mode,
pbwidth_t width)
{
int aormode;

Wyświetl plik

@ -210,7 +210,7 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
EOM, strlen(EOM), 0, 1);
EOM, strlen(EOM), 0, 1);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -246,7 +246,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
{
/* expecting 0x0d0x0a on all commands so wait for the 0x0a */
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
"\x0a", 1, 0, 1);
"\x0a", 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -482,8 +482,8 @@ int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else
{
SNPRINTF(mdbuf, sizeof(mdbuf), "%dB%c" CR,
width < rig_passband_normal(rig, mode) ? 1 : 0,
aormode);
width < rig_passband_normal(rig, mode) ? 1 : 0,
aormode);
}
retval = ar3030_transaction(rig, mdbuf, strlen(mdbuf), NULL, NULL);

Wyświetl plik

@ -79,7 +79,8 @@
}
static int format5k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode, pbwidth_t width);
static int format5k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode,
pbwidth_t width);
static int parse5k_aor_mode(RIG *rig, char aormode, char aorwidth,
rmode_t *mode, pbwidth_t *width);
@ -398,7 +399,8 @@ const struct rig_caps ar5000a_caps =
#define AR5K_SAL '6'
#define AR5K_SAH '7'
int format5k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode, pbwidth_t width)
int format5k_mode(RIG *rig, char *buf, int buf_len, rmode_t mode,
pbwidth_t width)
{
int aormode;

Wyświetl plik

@ -305,7 +305,8 @@ 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, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -200,7 +200,7 @@ int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return retval;
}
if (strstr(response,"E5"))
if (strstr(response, "E5"))
{
freq_rx = freq_tx = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: new channel being programmed\n", __func__);
@ -224,7 +224,8 @@ int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// New freq so let's update the channel
// We do not support split mode -- too many writes to EEPROM to support it
SNPRINTF((char *) cmd_buf, sizeof(cmd_buf), "PC%04dR%08.0lfT%08.0lf", chan, freq, freq);
SNPRINTF((char *) cmd_buf, sizeof(cmd_buf), "PC%04dR%08.0lfT%08.0lf", chan,
freq, freq);
retval = barrett_transaction(rig, cmd_buf, 0, &response);
if (retval != RIG_OK || strncmp(response, "OK", 2) != 0)

Wyświetl plik

@ -273,16 +273,20 @@ int barrett_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_strvfo(vfo), freq);
retval = rig_get_freq(rig, vfo, &tfreq);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_freq failed: %s\n", __func__, strerror(retval));
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_freq failed: %s\n", __func__,
strerror(retval));
return retval;
}
if (tfreq == freq)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: freq not changing\n", __func__);
return RIG_OK;
}
// If we are not explicitly asking for VFO_B then we'll set the receive side also
if (vfo != RIG_VFO_B)
{
@ -423,11 +427,14 @@ int barrett_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: get_mode failed %s\n", __func__, strerror(retval));
rig_debug(RIG_DEBUG_ERR, "%s: get_mode failed %s\n", __func__,
strerror(retval));
}
if (tmode == mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: already mode %s so not changing\n", __func__, rig_strrmode(mode));
rig_debug(RIG_DEBUG_VERBOSE, "%s: already mode %s so not changing\n", __func__,
rig_strrmode(mode));
return RIG_OK;
}

Wyświetl plik

@ -302,7 +302,8 @@ int codan_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_strvfo(vfo), freq);
// Purportedly can't do split so we just set VFOB=VFOA
SNPRINTF(cmd_buf, sizeof(cmd_buf), "connect tcvr rf %.0f %.0f\rfreq", freq, freq);
SNPRINTF(cmd_buf, sizeof(cmd_buf), "connect tcvr rf %.0f %.0f\rfreq", freq,
freq);
char *response = NULL;
retval = codan_transaction(rig, cmd_buf, 0, &response);
@ -395,7 +396,8 @@ int codan_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt=%d\n", __func__, ptt);
SNPRINTF(cmd_buf, sizeof(cmd_buf), "connect tcvr rf ptt %s\rptt", ptt == 0 ? "off" : "on");
SNPRINTF(cmd_buf, sizeof(cmd_buf), "connect tcvr rf ptt %s\rptt",
ptt == 0 ? "off" : "on");
response = NULL;
retval = codan_transaction(rig, cmd_buf, 0, &response);

Wyświetl plik

@ -83,7 +83,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ,
LF, 1, 0, 1);
LF, 1, 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -139,8 +139,10 @@ int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
* 10Hz resolution
* TODO: round nearest?
*/
SNPRINTF((char *) freqbuf, sizeof(freqbuf), "F%07u" EOM, (unsigned int)freq / 10);
retval = drake_transaction(rig, (char *) freqbuf, strlen((char*)freqbuf), (char *) ackbuf,
SNPRINTF((char *) freqbuf, sizeof(freqbuf), "F%07u" EOM,
(unsigned int)freq / 10);
retval = drake_transaction(rig, (char *) freqbuf, strlen((char *)freqbuf),
(char *) ackbuf,
&ack_len);
return retval;
@ -226,7 +228,8 @@ int drake_set_vfo(RIG *rig, vfo_t vfo)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "%c" EOM, vfo_function);
}
retval = drake_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) ackbuf,
retval = drake_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) ackbuf,
&ack_len);
return retval;
}
@ -313,7 +316,8 @@ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
SNPRINTF((char *) mdbuf, sizeof(mdbuf), "M%c" EOM, mode_sel);
retval = drake_transaction(rig, (char *) mdbuf, strlen((char*)mdbuf), (char *) ackbuf,
retval = drake_transaction(rig, (char *) mdbuf, strlen((char *)mdbuf),
(char *) ackbuf,
&ack_len);
if (retval != RIG_OK)
@ -354,7 +358,8 @@ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
}
SNPRINTF((char *) mdbuf, sizeof(mdbuf), "W%c" EOM, width_sel);
retval = drake_transaction(rig, (char *) mdbuf, strlen((char*)mdbuf), (char *) ackbuf,
retval = drake_transaction(rig, (char *) mdbuf, strlen((char *)mdbuf),
(char *) ackbuf,
&ack_len);
}
}
@ -364,10 +369,11 @@ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
(mode == RIG_MODE_AM) || (mode == RIG_MODE_USB) || (mode == RIG_MODE_LSB))
{
SNPRINTF((char *) mdbuf, sizeof(mdbuf), "S%c" EOM,
((mode == RIG_MODE_AMS) || (mode == RIG_MODE_ECSSUSB)
|| (mode == RIG_MODE_ECSSLSB))
? 'O' : 'F');
retval = drake_transaction(rig, (char *) mdbuf, strlen((char*)mdbuf), (char *) ackbuf,
((mode == RIG_MODE_AMS) || (mode == RIG_MODE_ECSSUSB)
|| (mode == RIG_MODE_ECSSLSB))
? 'O' : 'F');
retval = drake_transaction(rig, (char *) mdbuf, strlen((char *)mdbuf),
(char *) ackbuf,
&ack_len);
}
@ -491,9 +497,10 @@ int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
int ack_len, retval;
SNPRINTF((char *) buf, sizeof(buf), "A%c" EOM,
ant == RIG_ANT_1 ? '1' : (ant == RIG_ANT_2 ? '2' : 'C'));
ant == RIG_ANT_1 ? '1' : (ant == RIG_ANT_2 ? '2' : 'C'));
retval = drake_transaction(rig, (char *) buf, strlen((char*)buf), (char *) ackbuf, &ack_len);
retval = drake_transaction(rig, (char *) buf, strlen((char *)buf),
(char *) ackbuf, &ack_len);
return retval;
}
@ -913,6 +920,7 @@ int drake_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
default:
return -RIG_EINVAL;
}
len = strlen(buf);
retval = drake_transaction(rig, buf, len, buf[len - 1] == 0x0d ? ackbuf : NULL,
&ack_len);
@ -1019,8 +1027,8 @@ int drake_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AGC:
SNPRINTF(buf, sizeof(buf), "A%c" EOM,
val.i == RIG_AGC_OFF ? 'O' :
(val.i == RIG_AGC_FAST ? 'F' : 'S'));
val.i == RIG_AGC_OFF ? 'O' :
(val.i == RIG_AGC_FAST ? 'F' : 'S'));
break;
default:

Wyświetl plik

@ -50,7 +50,8 @@ static int netampctl_transaction(AMP *amp, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
{
@ -93,7 +94,8 @@ static int netampctl_open(AMP *amp)
return -RIG_EPROTO;
}
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -102,7 +104,8 @@ static int netampctl_open(AMP *amp)
do
{
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&amp->state.ampport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret > 0)
{

Wyświetl plik

@ -77,7 +77,8 @@ static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret < 0)
{
@ -308,14 +309,16 @@ static int netrigctl_open(RIG *rig)
return -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -326,7 +329,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -356,7 +360,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -398,7 +403,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -422,7 +428,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -449,7 +456,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -458,7 +466,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -467,7 +476,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -476,7 +486,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -485,7 +496,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -512,7 +524,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -539,7 +552,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -548,7 +562,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -557,7 +572,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -579,7 +595,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -588,7 +605,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -597,7 +615,8 @@ 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(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -640,7 +659,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);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -928,7 +948,7 @@ static int netrigctl_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
if (ret != RIG_OK) { return ret; }
SNPRINTF(cmd, sizeof(cmd), "M%s %s %li\n",
vfostr, rig_strrmode(mode), width);
vfostr, rig_strrmode(mode), width);
ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
@ -970,7 +990,8 @@ 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, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -1542,7 +1563,7 @@ static int netrigctl_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
if (ret != RIG_OK) { return ret; }
SNPRINTF(cmd, sizeof(cmd), "X%s %s %li\n",
vfostr, rig_strrmode(tx_mode), tx_width);
vfostr, rig_strrmode(tx_mode), tx_width);
ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
@ -1583,7 +1604,8 @@ 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, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -1650,7 +1672,8 @@ 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, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -1914,7 +1937,7 @@ static int netrigctl_set_level(RIG *rig, vfo_t vfo, setting_t level,
if (ret != RIG_OK) { return ret; }
SNPRINTF(cmd, sizeof(cmd), "L%s %s %s\n", vfostr, rig_strlevel(level),
lstr);
lstr);
ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
@ -2172,7 +2195,8 @@ 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, 0, 1);
ret = read_string(&rig->state.rigport, (unsigned char *) buf, BUF_MAX, "\n", 1,
0, 1);
if (ret <= 0)
{
@ -2567,7 +2591,8 @@ static int netrigctl_mW2power(RIG *rig, float *power, unsigned int mwpower,
ENTERFUNC;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\mW2power %u %.0f %s\n", mwpower, freq, rig_strrmode(mode));
SNPRINTF(cmdbuf, sizeof(cmdbuf), "\\mW2power %u %.0f %s\n", mwpower, freq,
rig_strrmode(mode));
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (ret <= 0)

Wyświetl plik

@ -55,7 +55,8 @@ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret < 0)
{
@ -98,14 +99,16 @@ static int netrotctl_open(ROT *rot)
return -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -114,7 +117,8 @@ static int netrotctl_open(ROT *rot)
rs->min_az = atof(buf);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -123,7 +127,8 @@ static int netrotctl_open(ROT *rot)
rs->max_az = atof(buf);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -132,7 +137,8 @@ static int netrotctl_open(ROT *rot)
rs->min_el = atof(buf);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{
@ -196,7 +202,8 @@ 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", sizeof("\n"), 0, 1);
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
sizeof("\n"), 0, 1);
if (ret <= 0)
{

Wyświetl plik

@ -261,10 +261,10 @@ static int check_vfo(vfo_t vfo)
break; // will default to A in which_vfo
default:
return(FALSE);
return (FALSE);
}
return(TRUE);
return (TRUE);
}
/*
@ -509,7 +509,7 @@ static const char *modeMapGetTCI(rmode_t modeHamlib)
static rmode_t modeMapGetHamlib(const char *modeTCI)
{
int i;
char modeTCICheck[MAXBUFLEN+2];
char modeTCICheck[MAXBUFLEN + 2];
SNPRINTF(modeTCICheck, sizeof(modeTCICheck), "|%s|", modeTCI);
@ -521,13 +521,13 @@ static rmode_t modeMapGetHamlib(const char *modeTCI)
if (modeMap[i].mode_tci1x
&& strcmp(modeMap[i].mode_tci1x, modeTCICheck) == 0)
{
return(modeMap[i].mode_hamlib);
return (modeMap[i].mode_hamlib);
}
}
rig_debug(RIG_DEBUG_TRACE, "%s: mode requested: %s, not in modeMap\n", __func__,
modeTCI);
return(RIG_MODE_NONE);
return (RIG_MODE_NONE);
}
@ -940,7 +940,7 @@ static int tci1x_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><double>%.0f</double></value></param></params>", freq);
"<params><param><value><double>%.0f</double></value></param></params>", freq);
value_t val;
rig_get_ext_parm(rig, TOK_TCI1X_VERIFY_FREQ, &val);
@ -997,8 +997,8 @@ static int tci1x_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
}
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><i4>%d</i4></value></param></params>",
ptt);
"<params><param><value><i4>%d</i4></value></param></params>",
ptt);
value_t val;
char *cmd = "rig.set_ptt";
@ -1196,7 +1196,8 @@ static int tci1x_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (p) { *p = 0; } // remove any other pipe
SNPRINTF(cmd_arg, sizeof(cmd_arg), "<params><param><value>%s</value></param></params>", pttmode);
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value>%s</value></param></params>", pttmode);
free(ttmode);
if (!priv->has_get_modeA)
@ -1252,8 +1253,9 @@ static int tci1x_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
// Need to update the bandwidth
if (width > 0 && needBW)
{
SNPRINTF(cmd_arg, sizeof(cmd_arg), "<params><param><value><i4>%ld</i4></value></param></params>",
width);
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><i4>%ld</i4></value></param></params>",
width);
retval = tci1x_transaction(rig, "rig.set_bandwidth", cmd_arg, NULL, 0);
@ -1489,8 +1491,9 @@ static int tci1x_set_vfo(RIG *rig, vfo_t vfo)
vfo = rig->state.current_vfo;
}
SNPRINTF(cmd_arg, sizeof(cmd_arg), "<params><param><value>%s</value></param></params>",
vfo == RIG_VFO_A ? "A" : "B");
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value>%s</value></param></params>",
vfo == RIG_VFO_A ? "A" : "B");
retval = tci1x_transaction(rig, "rig.set_AB", cmd_arg, NULL, 0);
if (retval != RIG_OK)
@ -1507,8 +1510,9 @@ static int tci1x_set_vfo(RIG *rig, vfo_t vfo)
/* so if we are in split and asked for A we have to turn split back on */
if (priv->split && vfo == RIG_VFO_A)
{
SNPRINTF(cmd_arg, sizeof(cmd_arg), "<params><param><value><i4>%d</i4></value></param></params>",
priv->split);
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><i4>%d</i4></value></param></params>",
priv->split);
retval = tci1x_transaction(rig, "rig.set_split", cmd_arg, NULL, 0);
if (retval < 0)
@ -1601,8 +1605,8 @@ static int tci1x_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (tx_freq == qtx_freq) { RETURNFUNC(RIG_OK); }
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><double>%.6f</double></value></param></params>",
tx_freq);
"<params><param><value><double>%.6f</double></value></param></params>",
tx_freq);
retval = tci1x_transaction(rig, "rig.set_vfoB", cmd_arg, NULL, 0);
if (retval < 0)
@ -1661,8 +1665,9 @@ static int tci1x_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
RETURNFUNC(RIG_OK); // just return OK and ignore this
}
SNPRINTF(cmd_arg, sizeof(cmd_arg), "<params><param><value><i4>%d</i4></value></param></params>",
split);
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><i4>%d</i4></value></param></params>",
split);
retval = tci1x_transaction(rig, "rig.set_split", cmd_arg, NULL, 0);
if (retval < 0)
@ -1813,8 +1818,8 @@ static int tci1x_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF(cmd_arg, sizeof(cmd_arg),
"<params><param><value><%s>%d</%s></value></param></params>",
param_type, (int)val.f, param_type);
"<params><param><value><%s>%d</%s></value></param></params>",
param_type, (int)val.f, param_type);
retval = tci1x_transaction(rig, cmd, cmd_arg, NULL, 0);

Wyświetl plik

@ -241,7 +241,8 @@ static int read_transaction(RIG *rig, char *response, int response_len)
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
len = read_string(&rs->rigport, (unsigned char *) response, response_len, delims,
len = read_string(&rs->rigport, (unsigned char *) response, response_len,
delims,
strlen(delims), 0, 1);
if (len <= 0)

Wyświetl plik

@ -241,7 +241,7 @@ transaction_write:
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,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
goto transaction_quit;
}
@ -252,7 +252,7 @@ transaction_read:
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 13,
ELAD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
cmdtrm, strlen(cmdtrm), 0, 1);
cmdtrm, strlen(cmdtrm), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -263,9 +263,9 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
/* command formatting */
SNPRINTF(cmdbuf, BUFSZ, "$PICOA,%02d,%02u,%s",
CONTROLLER_ID,
priv->remote_id,
cmd);
CONTROLLER_ID,
priv->remote_id,
cmd);
cmd_len = strlen(cmdbuf);
if (param)
@ -292,7 +292,8 @@ 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, strlen(LF), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, LF,
strlen(LF), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -44,7 +44,8 @@
* NB: the frame array must be big enough to hold the frame.
* The smallest frame is 6 bytes, the biggest is at least 13 bytes.
*/
int make_cmd_frame(unsigned char frame[], unsigned char re_id, unsigned char ctrl_id,
int make_cmd_frame(unsigned char frame[], unsigned char re_id,
unsigned char ctrl_id,
unsigned char cmd, int subcmd,
const unsigned char *data, int data_len)
{
@ -83,7 +84,7 @@ int make_cmd_frame(unsigned char frame[], unsigned char re_id, unsigned char ctr
frame[i++] = FI; /* EOM code */
return(i);
return (i);
}
int icom_frame_fix_preamble(int frame_len, unsigned char *frame)
@ -101,7 +102,7 @@ int icom_frame_fix_preamble(int frame_len, unsigned char *frame)
{
rig_debug(RIG_DEBUG_WARN, "%s: invalid Icom CI-V frame, no preamble found\n",
__func__);
return(-RIG_EPROTO);
return (-RIG_EPROTO);
}
return frame_len;
@ -196,16 +197,22 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
set_transaction_inactive(rig);
RETURNFUNC(-RIG_EPROTO);
}
// we might have 0xfe string during rig wakeup
rig_debug(RIG_DEBUG_TRACE, "%s: DEBUG retval=%d, frm_len=%d, cmd=0x%02x\n", __func__, retval, frm_len, cmd);
rig_debug(RIG_DEBUG_TRACE, "%s: DEBUG retval=%d, frm_len=%d, cmd=0x%02x\n",
__func__, retval, frm_len, cmd);
if (retval != frm_len && cmd == C_SET_PWR)
{
rig_debug(RIG_DEBUG_TRACE, "%s: removing 0xfe power up echo, len=%d", __func__, frm_len);
while(buf[2] == 0xfe)
rig_debug(RIG_DEBUG_TRACE, "%s: removing 0xfe power up echo, len=%d", __func__,
frm_len);
while (buf[2] == 0xfe)
{
memmove(buf,&buf[1],frm_len--);
memmove(buf, &buf[1], frm_len--);
}
dump_hex(buf,frm_len);
dump_hex(buf, frm_len);
}
switch (buf[retval - 1])
@ -458,7 +465,8 @@ static const char icom_block_end[2] = { FI, COL};
* TODO: strips padding/collisions
* FIXME: check return codes/bytes read
*/
static int read_icom_frame_generic(hamlib_port_t *p, const unsigned char rxbuffer[],
static int read_icom_frame_generic(hamlib_port_t *p,
const unsigned char rxbuffer[],
size_t rxbuffer_len, int direct)
{
int read = 0;
@ -476,27 +484,28 @@ static int read_icom_frame_generic(hamlib_port_t *p, const unsigned char rxbuffe
do
{
int i;
if (direct)
{
i = read_string_direct(p, rx_ptr, MAXFRAMELEN - read,
icom_block_end, icom_block_end_length, 0, 1);
icom_block_end, icom_block_end_length, 0, 1);
}
else
{
i = read_string(p, rx_ptr, MAXFRAMELEN - read,
icom_block_end, icom_block_end_length, 0, 1);
icom_block_end, icom_block_end_length, 0, 1);
}
if (i < 0 && i != RIG_BUSBUSY) /* die on errors */
{
return(i);
return (i);
}
if (i == 0) /* nothing read?*/
{
if (--retries <= 0) /* Tried enough times? */
{
return(read);
return (read);
}
}
@ -510,7 +519,7 @@ static int read_icom_frame_generic(hamlib_port_t *p, const unsigned char rxbuffe
while ((read < rxbuffer_len) && (rxbuffer[read - 1] != FI)
&& (rxbuffer[read - 1] != COL));
return(read);
return (read);
}
int read_icom_frame(hamlib_port_t *p, const unsigned char rxbuffer[],

Wyświetl plik

@ -248,7 +248,8 @@ const char *ic92d_get_info(RIG *rig)
return NULL;
}
SNPRINTF(info, sizeof(info), "ID %02x%02x%02x\n", ackbuf[1], ackbuf[2], ackbuf[3]);
SNPRINTF(info, sizeof(info), "ID %02x%02x%02x\n", ackbuf[1], ackbuf[2],
ackbuf[3]);
return info;
}

Wyświetl plik

@ -754,8 +754,10 @@ int icom_get_usb_echo_off(RIG *rig)
// we should have a freq response so we'll read it and don't really care
// flushing doesn't always work as it depends on timing
retval = read_icom_frame(&rs->rigport, buf, sizeof(buf));
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo on detected, get freq retval=%d\n", __func__, retval);
if (retval <= 0) RETURNFUNC(-RIG_ETIMEOUT);
rig_debug(RIG_DEBUG_VERBOSE, "%s: USB echo on detected, get freq retval=%d\n",
__func__, retval);
if (retval <= 0) { RETURNFUNC(-RIG_ETIMEOUT); }
}
else
{
@ -940,7 +942,8 @@ icom_rig_open(RIG *rig)
retry_open:
retval_echo = icom_get_usb_echo_off(rig);
rig_debug(RIG_DEBUG_TRACE, "%s: echo status result=%d\n", __func__, retval_echo);
rig_debug(RIG_DEBUG_TRACE, "%s: echo status result=%d\n", __func__,
retval_echo);
if (retval_echo == 0 || retval_echo == 1)
{
@ -953,17 +956,19 @@ retry_open:
if (retval == RIG_OK) // then we know our echo status
{
rig_debug(RIG_DEBUG_TRACE, "%s: echo status known, getting frequency\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: echo status known, getting frequency\n",
__func__);
rs->rigport.retry = 0;
rig->state.current_vfo = icom_current_vfo(rig);
// some rigs like the IC7100 still echo when in standby
// so asking for freq now should timeout if such a rig
freq_t tfreq;
retval = rig_get_freq(rig, RIG_VFO_CURR, &tfreq);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig error getting frequency retry=%d, err=%s\n",
__func__, retry_flag, rigerror(retval));
__func__, retry_flag, rigerror(retval));
}
}
else
@ -984,11 +989,12 @@ retry_open:
rs->rigport.retry = retry_save;
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_powerstat failed: %s\n", __func__,
rigerror(retval));
rigerror(retval));
if (retval == RIG_ENIMPL || retval == RIG_ENAVAIL)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_powerstat not implemented for rig\n", __func__);
rig_debug(RIG_DEBUG_ERR, "%s: rig_set_powerstat not implemented for rig\n",
__func__);
RETURNFUNC(-RIG_ECONF);
}
@ -2527,7 +2533,9 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
else
{
priv_data->filter = 0;
if (mode_len == 2) priv_data->filter = modebuf[2];
if (mode_len == 2) { priv_data->filter = modebuf[2]; }
rig_debug(RIG_DEBUG_TRACE,
"%s: modebuf[0]=0x%02x, modebuf[1]=0x%02x, mode_len=%d\n", __func__, modebuf[0],
modebuf[1], mode_len);
@ -6932,7 +6940,7 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
case RIG_FUNC_DUAL_WATCH:
if ((rig->caps->rig_model == RIG_MODEL_IC9100) ||
(rig->caps->rig_model == RIG_MODEL_IC9700))
(rig->caps->rig_model == RIG_MODEL_IC9700))
{
fct_cn = C_CTL_FUNC;
fct_sc = S_MEM_DUALMODE;
@ -7171,7 +7179,7 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
case RIG_FUNC_DUAL_WATCH:
if ((rig->caps->rig_model == RIG_MODEL_IC9100) ||
(rig->caps->rig_model == RIG_MODEL_IC9700))
(rig->caps->rig_model == RIG_MODEL_IC9700))
{
fct_cn = C_CTL_FUNC;
fct_sc = S_MEM_DUALMODE;
@ -7181,6 +7189,7 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
fct_cn = C_SET_VFO;
fct_sc = S_DUAL;
}
break;
case RIG_FUNC_SATMODE:
@ -8735,7 +8744,8 @@ static int icom_parse_spectrum_frame(RIG *rig, size_t length,
RETURNFUNC(RIG_OK);
}
int icom_is_async_frame(RIG *rig, size_t frame_length, const unsigned char *frame)
int icom_is_async_frame(RIG *rig, size_t frame_length,
const unsigned char *frame)
{
if (frame_length < ACKFRMLEN)
{
@ -8767,7 +8777,8 @@ int icom_process_async_frame(RIG *rig, size_t frame_length,
*/
switch (frame[4])
{
case C_SND_FREQ: {
case C_SND_FREQ:
{
// TODO: The freq length might be less than 4 or 5 bytes on older rigs!
// TODO: Disable cache timeout for frequency after first transceive packet once we figure out how to get active VFO reliably with transceive updates
// TODO: rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_FREQ, HAMLIB_CACHE_ALWAYS);
@ -8790,6 +8801,7 @@ int icom_process_async_frame(RIG *rig, size_t frame_length,
{
icom_parse_spectrum_frame(rig, frame_length - (6 + 1), frame + 6);
}
break;
default:
@ -8873,7 +8885,8 @@ int icom_decode_event(RIG *rig)
RETURNFUNC(icom_process_async_frame(rig, frm_len, buf));
}
int icom_read_frame_direct(RIG *rig, size_t buffer_length, const unsigned char *buffer)
int icom_read_frame_direct(RIG *rig, size_t buffer_length,
const unsigned char *buffer)
{
return read_icom_frame_direct(&rig->state.rigport, buffer, buffer_length);
}
@ -9302,12 +9315,12 @@ DECLARE_PROBERIG_BACKEND(icom)
if (!port)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
if (port->type.rig != RIG_PORT_SERIAL)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
port->write_delay = port->post_write_delay = 0;
@ -9326,7 +9339,7 @@ DECLARE_PROBERIG_BACKEND(icom)
if (retval != RIG_OK)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
/*
@ -9365,7 +9378,7 @@ DECLARE_PROBERIG_BACKEND(icom)
* is this a CI-V device?
*/
close(port->fd);
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
else if (buf[4] == NAK)
{
@ -9476,11 +9489,11 @@ DECLARE_PROBERIG_BACKEND(icom)
*/
if (model != RIG_MODEL_NONE)
{
return(model);
return (model);
}
}
return(model);
return (model);
}
/*
@ -9578,5 +9591,5 @@ DECLARE_INITRIG_BACKEND(icom)
rig_register(&x6100_caps);
rig_register(&g90_caps);
return(RIG_OK);
return (RIG_OK);
}

Wyświetl plik

@ -165,10 +165,10 @@ const char *optoscan_get_info(RIG *rig)
}
SNPRINTF(info, sizeof(info), "OptoScan%c%c%c, software version %d.%d, "
"interface version %d.%d\n",
ackbuf[2], ackbuf[3], ackbuf[4],
ackbuf[5] >> 4, ackbuf[5] & 0xf,
ackbuf[6] >> 4, ackbuf[6] & 0xf);
"interface version %d.%d\n",
ackbuf[2], ackbuf[3], ackbuf[4],
ackbuf[5] >> 4, ackbuf[5] & 0xf,
ackbuf[6] >> 4, ackbuf[6] & 0xf);
return info;
}

Wyświetl plik

@ -123,9 +123,11 @@ static int x108g_rig_open(RIG *rig)
int retval;
retval = icom_rig_open(rig);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig_open failed with %s\n", __func__, rigerror(retval));
rig_debug(RIG_DEBUG_ERR, "%s: rig_open failed with %s\n", __func__,
rigerror(retval));
RETURNFUNC(retval);
}

Wyświetl plik

@ -65,7 +65,8 @@
* Otherwise, you'll get a nice seg fault. You've been warned!
* TODO: error case handling
*/
int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
{
int retval;
struct rig_state *rs;
@ -90,7 +91,8 @@ int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *dat
return 0;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
set_transaction_inactive(rig);
@ -295,7 +297,8 @@ int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// cppcheck-suppress *
// suppressing bogus cppcheck error in ver 1.90
SNPRINTF(freqbuf, sizeof(freqbuf), "F%0*"PRIll EOM, priv->max_freq_len, (int64_t)freq);
SNPRINTF(freqbuf, sizeof(freqbuf), "F%0*"PRIll EOM, priv->max_freq_len,
(int64_t)freq);
return jrc_transaction(rig, freqbuf, strlen(freqbuf), NULL, NULL);
}
@ -378,7 +381,8 @@ int jrc_set_vfo(RIG *rig, vfo_t vfo)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "%c" EOM, vfo_function);
retval = jrc_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = jrc_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
return retval;
}
@ -476,7 +480,7 @@ int jrc_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
case RIG_FUNC_FAGC:
/* FIXME: FAGC levels */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%d" EOM, status ? 1 : 2);
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%d" EOM, status ? 1 : 2);
return jrc_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -734,8 +738,8 @@ int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (val.i < 10)
{
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%d" EOM,
val.i == RIG_AGC_SLOW ? 0 :
val.i == RIG_AGC_FAST ? 1 : 2);
val.i == RIG_AGC_SLOW ? 0 :
val.i == RIG_AGC_FAST ? 1 : 2);
}
else
{
@ -1041,7 +1045,7 @@ int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_CWPITCH:
SNPRINTF(cwbuf, sizeof(cwbuf), "%s" EOM, priv->cw_pitch);
cw_len = strlen(cwbuf);
retval = jrc_transaction(rig, cwbuf, strlen(cwbuf), lvlbuf, &lvl_len);
if (retval != RIG_OK)
@ -1118,14 +1122,14 @@ int jrc_set_parm(RIG *rig, setting_t parm, value_t val)
case RIG_PARM_BEEP:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "U%0*d" EOM, priv->beep_len,
(priv->beep + val.i) ? 1 : 0);
(priv->beep + val.i) ? 1 : 0);
return jrc_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
case RIG_PARM_TIME:
minutes = val.i / 60;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "R1%02d%02d" EOM,
minutes / 60, minutes % 60);
minutes / 60, minutes % 60);
return jrc_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -1430,7 +1434,8 @@ int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan)
return retval;
}
SNPRINTF(cmdbuf + 7, sizeof(cmdbuf)-7, "%0*"PRIll, priv->max_freq_len, (int64_t)chan->freq);
SNPRINTF(cmdbuf + 7, sizeof(cmdbuf) - 7, "%0*"PRIll, priv->max_freq_len,
(int64_t)chan->freq);
if (priv->mem_len == 17)
{
@ -1447,8 +1452,9 @@ int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan)
}
else
{
SNPRINTF(cmdbuf + priv->mem_len - 4, sizeof(cmdbuf)-(priv->mem_len - 4), "%03d",
chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i);
SNPRINTF(cmdbuf + priv->mem_len - 4, sizeof(cmdbuf) - (priv->mem_len - 4),
"%03d",
chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i);
}
return jrc_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -1491,7 +1497,7 @@ int jrc_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
strcpy(chan->channel_desc, "");
SNPRINTF(cmdbuf, sizeof(cmdbuf), "L%03d%03d" EOM, chan->channel_num,
chan->channel_num);
chan->channel_num);
retval = jrc_transaction(rig, cmdbuf, strlen(cmdbuf), membuf, &mem_len);
if (retval != RIG_OK)
@ -1625,7 +1631,8 @@ int jrc_decode_event(RIG *rig)
//#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, 0, 1);
count = read_string(&rs->rigport, (unsigned char *) buf, priv->info_len, "", 0,
0, 1);
if (count < 0)
{

Wyświetl plik

@ -387,7 +387,8 @@ 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, strlen(freqbuf));
retval = write_block(&rig->state.rigport, (unsigned char *) freqbuf,
strlen(freqbuf));
if (retval != RIG_OK)
{
@ -471,7 +472,8 @@ 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, strlen(modestr));
retval = write_block(&rig->state.rigport, (unsigned char *) modestr,
strlen(modestr));
if (retval != RIG_OK)
{
@ -533,8 +535,10 @@ static int jst145_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
switch (level)
{
case RIG_LEVEL_AGC: {
char *cmd = val.i == RIG_AGC_SLOW ? "G0\r" : (val.i == RIG_AGC_FAST ? "G1\r" : "G2\r");
case RIG_LEVEL_AGC:
{
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);
}
@ -551,7 +555,8 @@ 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, strlen(membuf));
return write_block(&rig->state.rigport, (unsigned char *) membuf,
strlen(membuf));
}
static int jst145_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)

Wyświetl plik

@ -167,7 +167,8 @@ 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, strlen(freqbuf));
return write_block(&rig->state.rigport, (unsigned char *) freqbuf,
strlen(freqbuf));
}
static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
@ -195,7 +196,8 @@ 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, strlen(modestr));
retval = write_block(&rig->state.rigport, (unsigned char *) modestr,
strlen(modestr));
if (retval != RIG_OK)
{
@ -219,12 +221,13 @@ 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, (unsigned char *) (val.i != 0 ? "A1" : "A0"), 2);
return write_block(&rig->state.rigport,
(unsigned char *)(val.i != 0 ? "A1" : "A0"), 2);
case RIG_LEVEL_AGC:
return write_block(&rig->state.rigport,
(unsigned char *) (val.i == RIG_AGC_SLOW ? "G0" :
(val.i == RIG_AGC_FAST ? "G1" : "G2")), 2);
(unsigned char *)(val.i == RIG_AGC_SLOW ? "G0" :
(val.i == RIG_AGC_FAST ? "G1" : "G2")), 2);
default:
return -RIG_EINVAL;
@ -237,7 +240,8 @@ 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, strlen(membuf));
return write_block(&rig->state.rigport, (unsigned char *) membuf,
strlen(membuf));
}
static int nrd525_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)

Wyświetl plik

@ -136,7 +136,7 @@ int elecraft_open(RIG *rig)
}
err = read_string(&rs->rigport, (unsigned char *) buf, sizeof(buf),
";", 1, 0, 1);
";", 1, 0, 1);
if (err < 0)
{

Wyświetl plik

@ -101,13 +101,15 @@ transaction:
char buffer[50];
struct kenwood_priv_data *priv = rig->state.priv;
if (RIG_OK != (retval = write_block(&rs->rigport, (unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
if (RIG_OK != (retval = write_block(&rs->rigport,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
return retval;
}
// this should be the ID response
retval = read_string(&rs->rigport, (unsigned char *) buffer, sizeof(buffer), ";", 1, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) buffer, sizeof(buffer),
";", 1, 0, 1);
// might be ?; too
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
@ -468,7 +470,8 @@ int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
// cppcheck-suppress *
SNPRINTF(freqbuf, sizeof(freqbuf), "F%c%011"PRIll";", vfo_letter, (int64_t)freq);
SNPRINTF(freqbuf, sizeof(freqbuf), "F%c%011"PRIll";", vfo_letter,
(int64_t)freq);
retval = ic10_transaction(rig, freqbuf, strlen(freqbuf), NULL, 0);
return retval;
@ -766,10 +769,10 @@ int ic10_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
/* MWnxrrggmmmkkkhhhdzxxxx; */
SNPRINTF(membuf, sizeof(membuf), "MW0 %02d%011"PRIll"%c0 ;",
chan->channel_num,
freq,
md
);
chan->channel_num,
freq,
md
);
retval = ic10_transaction(rig, membuf, strlen(membuf), NULL, 0);
if (retval != RIG_OK)
@ -806,10 +809,10 @@ int ic10_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
/* MWnxrrggmmmkkkhhhdzxxxx; */
SNPRINTF(membuf, sizeof(membuf), "MW1 %02d%011"PRIll"%c0 ;",
chan->channel_num,
freq,
md
);
chan->channel_num,
freq,
md
);
retval = ic10_transaction(rig, membuf, strlen(membuf), NULL, 0);
// I assume we need to check the retval here -- W9MDB

Wyświetl plik

@ -357,7 +357,8 @@ 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, (unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
if (RIG_OK != (retval = write_block(&rs->rigport,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
{
goto transaction_quit;
}
@ -368,7 +369,7 @@ transaction_read:
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
KENWOOD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
cmdtrm_str, strlen(cmdtrm_str), 0, 1);
cmdtrm_str, strlen(cmdtrm_str), 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string(len=%d)='%s'\n", __func__,
(int)strlen(buffer), buffer);
@ -659,10 +660,10 @@ rmode_t kenwood2rmode(unsigned char mode, const rmode_t mode_table[])
if (mode >= KENWOOD_MODE_TABLE_MAX)
{
return(RIG_MODE_NONE);
return (RIG_MODE_NONE);
}
return(mode_table[mode]);
return (mode_table[mode]);
}
char rmode2kenwood(rmode_t mode, const rmode_t mode_table[])
@ -679,12 +680,12 @@ char rmode2kenwood(rmode_t mode, const rmode_t mode_table[])
if (mode_table[i] == mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: returning %d\n", __func__, i);
return(i);
return (i);
}
}
}
return(-1);
return (-1);
}
int kenwood_init(RIG *rig)
@ -1317,7 +1318,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) vfo = vfo_fixup(rig, vfo, split);
if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) { vfo = vfo_fixup(rig, vfo, split); }
switch (vfo)
{
@ -1666,7 +1667,8 @@ int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo)
switch (priv->info[30])
{
case '0':
*vfo = rig->state.rx_vfo = rig->state.tx_vfo = priv->tx_vfo = split_and_transmitting ? RIG_VFO_B : RIG_VFO_A;
*vfo = rig->state.rx_vfo = rig->state.tx_vfo = priv->tx_vfo =
split_and_transmitting ? RIG_VFO_B : RIG_VFO_A;
if (priv->info[32] == '1') { priv->tx_vfo = RIG_VFO_B; }
@ -2467,7 +2469,8 @@ static int kenwood_get_filter_width(RIG *rig, rmode_t mode, pbwidth_t *width)
}
}
}
if (filter_value >=50) // then it's probably a custom filter width
if (filter_value >= 50) // then it's probably a custom filter width
{
*width = filter_value;
return (RIG_OK);
@ -2699,7 +2702,8 @@ static int kenwood_get_micgain_minmax(RIG *rig, int *micgain_now,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf), NULL, 0, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf),
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -2798,7 +2802,8 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf), NULL, 0, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf),
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -5432,12 +5437,12 @@ DECLARE_PROBERIG_BACKEND(kenwood)
if (!port)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
if (port->type.rig != RIG_PORT_SERIAL)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
port->write_delay = port->post_write_delay = 0;
@ -5458,7 +5463,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
{
port->write_delay = write_delay;
port->retry = retry;
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
retval = write_block(port, (unsigned char *) "ID;", 3);
@ -5475,7 +5480,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
{
port->write_delay = write_delay;
port->retry = retry;
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
/*
@ -5489,7 +5494,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
6, id_len, idbuf);
port->write_delay = write_delay;
port->retry = retry;
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
@ -5508,7 +5513,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
port->write_delay = write_delay;
port->retry = retry;
return(kenwood_id_string_list[i].model);
return (kenwood_id_string_list[i].model);
}
}
@ -5525,7 +5530,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
if (retval != RIG_OK)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
retval = write_block(port, (unsigned char *) "K2;", 3);
@ -5534,7 +5539,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
if (retval != RIG_OK)
{
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
/*
@ -5549,7 +5554,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
(*cfunc)(port, RIG_MODEL_K2, data);
}
return(RIG_MODEL_K2);
return (RIG_MODEL_K2);
}
}
@ -5565,7 +5570,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
(*cfunc)(port, kenwood_id_list[i].model, data);
}
return(kenwood_id_list[i].model);
return (kenwood_id_list[i].model);
}
}
@ -5579,7 +5584,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay=%d\n", __func__,
port->post_write_delay);
return(RIG_MODEL_NONE);
return (RIG_MODEL_NONE);
}
@ -5645,5 +5650,5 @@ DECLARE_INITRIG_BACKEND(kenwood)
rig_register(&malachite_caps);
rig_register(&tx500_caps);
return(RIG_OK);
return (RIG_OK);
}

Wyświetl plik

@ -734,21 +734,21 @@ int pihspdr_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
/* P-number 2-3 4 5 6 7 8 9 101112 13 141516 */
SNPRINTF(buf, sizeof(buf), "MW0%03d%011u%c%c%c%02d%02d%03d%c%c%09d0%c%c%s;",
chan->channel_num,
(unsigned) chan->freq, /* 4 - frequency */
'0' + mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* 15 - Memory group no */
chan->channel_desc /* 16 - description */
);
chan->channel_num,
(unsigned) chan->freq, /* 4 - frequency */
'0' + mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* 15 - Memory group no */
chan->channel_desc /* 16 - description */
);
rig_debug(RIG_DEBUG_VERBOSE, "The command will be: %s\n", buf);
err = kenwood_transaction(rig, buf, NULL, 0);

Wyświetl plik

@ -1344,17 +1344,17 @@ int th_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RFPOWER :
SNPRINTF(buf, sizeof(buf), "PC %c,%01d", vch,
(int)(val.f * (rig->caps->level_gran[LVL_RFPOWER].max.i -
rig->caps->level_gran[LVL_RFPOWER].min.i))
+ rig->caps->level_gran[LVL_RFPOWER].min.i);
(int)(val.f * (rig->caps->level_gran[LVL_RFPOWER].max.i -
rig->caps->level_gran[LVL_RFPOWER].min.i))
+ rig->caps->level_gran[LVL_RFPOWER].min.i);
return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_SQL :
SNPRINTF(buf, sizeof(buf), "SQ %c,%02x", vch,
(int)(val.f * (rig->caps->level_gran[LVL_SQL].max.i -
rig->caps->level_gran[LVL_SQL].min.i))
+ rig->caps->level_gran[LVL_SQL].min.i);
(int)(val.f * (rig->caps->level_gran[LVL_SQL].max.i -
rig->caps->level_gran[LVL_SQL].min.i))
+ rig->caps->level_gran[LVL_SQL].min.i);
return kenwood_transaction(rig, buf, NULL, 0);
case RIG_LEVEL_AF :
@ -1979,7 +1979,8 @@ int th_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
else
{
SNPRINTF(req, sizeof(req), "MR %s0,PR%01d", mr_extra, channel_num + 1);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "Pr%01d", channel_num + 1);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "Pr%01d",
channel_num + 1);
}
break;
@ -1995,7 +1996,8 @@ int th_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
case RIG_MTYPE_BAND:
SNPRINTF(req, sizeof(req), "VR %01X", channel_num);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "BAND %01X", channel_num);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "BAND %01X",
channel_num);
break;
default:
@ -2433,11 +2435,12 @@ int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
/* Without DCS,mode */
SNPRINTF(membuf, sizeof(membuf), "%s,%011"PRIll",%X,%d,%d,%d,%d,,%02d,,%02d,%09"PRIll"%s",
req, (int64_t)chan->freq, step, shift, rev, tone,
ctcss, tonefq, ctcssfq,
(int64_t)labs((long)(chan->rptr_offs)), lockoutstr
);
SNPRINTF(membuf, sizeof(membuf),
"%s,%011"PRIll",%X,%d,%d,%d,%d,,%02d,,%02d,%09"PRIll"%s",
req, (int64_t)chan->freq, step, shift, rev, tone,
ctcss, tonefq, ctcssfq,
(int64_t)labs((long)(chan->rptr_offs)), lockoutstr
);
}
retval = kenwood_transaction(rig, membuf, membuf, sizeof(membuf));
@ -2455,7 +2458,8 @@ int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
req[3 + strlen(mr_extra)] = '1';
SNPRINTF(membuf, sizeof(membuf), "%s,%011"PRIll",%X", req, (int64_t)chan->tx_freq, step);
SNPRINTF(membuf, sizeof(membuf), "%s,%011"PRIll",%X", req,
(int64_t)chan->tx_freq, step);
retval = kenwood_transaction(rig, membuf, membuf, sizeof(membuf));
if (retval != RIG_OK)
@ -2470,11 +2474,13 @@ int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
/* TODO: check strlen(channel_desc) < rig->caps->chan_desc_sz */
if (chan_caps[1].type == RIG_MTYPE_PRIO)
{
SNPRINTF(membuf, sizeof(membuf), "MNA %sI-%01d,%s", mr_extra, channel_num, channel_desc);
SNPRINTF(membuf, sizeof(membuf), "MNA %sI-%01d,%s", mr_extra, channel_num,
channel_desc);
}
else
{
SNPRINTF(membuf, sizeof(membuf), "MNA %s%03d,%s", mr_extra, channel_num, channel_desc);
SNPRINTF(membuf, sizeof(membuf), "MNA %s%03d,%s", mr_extra, channel_num,
channel_desc);
}
retval = kenwood_transaction(rig, membuf, membuf, sizeof(membuf));

Wyświetl plik

@ -645,7 +645,7 @@ static int thd74_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
return RIG_OK;
}
}
for (tsinx = 0; tsinx < 10; tsinx++)
{

Wyświetl plik

@ -420,7 +420,7 @@ int tmv7_set_vfo(RIG *rig, vfo_t vfo)
break;
case RIG_VFO_B:
SNPRINTF(vfobuf, sizeof(vfobuf),"BC 1,1");
SNPRINTF(vfobuf, sizeof(vfobuf), "BC 1,1");
break;
case RIG_VFO_MEM:
@ -515,22 +515,26 @@ int tmv7_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
else if (chan->channel_num < 204)
{
SNPRINTF(req, sizeof(req), "MR 0,0,L%01d", chan->channel_num - 200);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "L%01d/V", chan->channel_num - 200);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "L%01d/V",
chan->channel_num - 200);
}
else if (chan->channel_num < 211)
{
SNPRINTF(req, sizeof(req), "MR 1,0,L%01d", chan->channel_num - 203);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "L%01d/U", chan->channel_num - 203);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "L%01d/U",
chan->channel_num - 203);
}
else if (chan->channel_num < 214)
{
SNPRINTF(req, sizeof(req), "MR 0,0,U%01d", chan->channel_num - 210);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "U%01d/V", chan->channel_num - 210);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "U%01d/V",
chan->channel_num - 210);
}
else if (chan->channel_num < 220)
{
SNPRINTF(req, sizeof(req), "MR 1,0,U%01d", chan->channel_num - 213);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "U%01d/U", chan->channel_num - 213);
SNPRINTF(chan->channel_desc, sizeof(chan->channel_desc), "U%01d/U",
chan->channel_num - 213);
}
else if (chan->channel_num < 223)
{
@ -775,15 +779,17 @@ int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (chan->channel_num < 221)
{
SNPRINTF(membuf, sizeof(membuf), "%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,0,0",
req, (long)freq, step, shift, tone,
ctcss, tonefq, ctcssfq);
SNPRINTF(membuf, sizeof(membuf),
"%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,0,0",
req, (long)freq, step, shift, tone,
ctcss, tonefq, ctcssfq);
}
else
{
SNPRINTF(membuf, sizeof(membuf), "%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,",
req, (long)freq, step, shift, tone,
ctcss, tonefq, ctcssfq);
SNPRINTF(membuf, sizeof(membuf),
"%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,",
req, (long)freq, step, shift, tone,
ctcss, tonefq, ctcssfq);
}
retval = kenwood_transaction(rig, membuf, NULL, 0);
@ -797,7 +803,8 @@ int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
req[5] = '1';
// cppcheck-suppress *
SNPRINTF(membuf, sizeof(membuf), "%s,%011"PRIll",%01d", req, (int64_t)chan->tx_freq, step);
SNPRINTF(membuf, sizeof(membuf), "%s,%011"PRIll",%01d", req,
(int64_t)chan->tx_freq, step);
retval = kenwood_transaction(rig, membuf, NULL, 0);
if (retval != RIG_OK)
@ -810,11 +817,13 @@ int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
if (chan->channel_num < 100)
{
SNPRINTF(membuf, sizeof(membuf), "MNA 0,%03d,%s", chan->channel_num, chan->channel_desc);
SNPRINTF(membuf, sizeof(membuf), "MNA 0,%03d,%s", chan->channel_num,
chan->channel_desc);
}
else
{
SNPRINTF(membuf, sizeof(membuf), "MNA 1,%03d,%s", chan->channel_num - 100, chan->channel_desc);
SNPRINTF(membuf, sizeof(membuf), "MNA 1,%03d,%s", chan->channel_num - 100,
chan->channel_desc);
}
retval = kenwood_transaction(rig, membuf, NULL, 0);

Wyświetl plik

@ -70,7 +70,7 @@ static int ts140_set_vfo(RIG *rig, vfo_t vfo)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "FN%c",
vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
return kenwood_transaction(rig, cmdbuf, NULL, 0);
}

Wyświetl plik

@ -788,21 +788,21 @@ int ts2000_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (chan->split == RIG_SPLIT_ON)
{
SNPRINTF(buf, sizeof(buf), "MW1%03d%011u%c%c%c%02d%02d%03d%c%c%09d0%c%c%s;\n",
chan->channel_num,
(unsigned) chan->tx_freq, /* 4 - frequency */
'0' + tx_mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode + 1, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* Memory group no */
chan->channel_desc /* 16 - description */
);
chan->channel_num,
(unsigned) chan->tx_freq, /* 4 - frequency */
'0' + tx_mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode + 1, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* Memory group no */
chan->channel_desc /* 16 - description */
);
rig_debug(RIG_DEBUG_VERBOSE, "Split, the command will be: %s\n", buf);
err = kenwood_transaction(rig, buf, NULL, 0);

Wyświetl plik

@ -440,7 +440,8 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
// TS-480 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1, NULL, 0, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
NULL, 0, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);

Wyświetl plik

@ -712,7 +712,7 @@ int ts570_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "MW0 %02d%011d%c0%c%02d ",
num, freq, mode, tones, tone);
num, freq, mode, tones, tone);
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
@ -722,7 +722,7 @@ int ts570_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "MW1 %02d%011d%c0%c%02d ",
num, tx_freq, tx_mode, tones, tone);
num, tx_freq, tx_mode, tones, tone);
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);

Wyświetl plik

@ -592,6 +592,7 @@ int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
__func__, lvlbuf[2]);
RETURNFUNC(-RIG_EPROTO);
}
return retval;
case RIG_LEVEL_ATT:
@ -617,6 +618,7 @@ int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
__func__, lvlbuf[2]);
RETURNFUNC(-RIG_EPROTO);
}
return retval;
case RIG_LEVEL_RAWSTR:

Wyświetl plik

@ -70,7 +70,7 @@ static int ts680_set_vfo(RIG *rig, vfo_t vfo)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "FN%c",
vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
vfo_function); /* The 680 and 140 need this to set the VFO on the radio */
return kenwood_transaction(rig, cmdbuf, NULL, 0);
}

Wyświetl plik

@ -552,7 +552,7 @@ int ts850_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "MW0 %02d%011d%c0%c%02d ",
num, freq, mode, tones, tone);
num, freq, mode, tones, tone);
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK)
@ -561,7 +561,7 @@ int ts850_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "MW1 %02d%011d%c0%c%02d ",
num, tx_freq, tx_mode, tones, tone);
num, tx_freq, tx_mode, tones, tone);
retval = kenwood_transaction(rig, cmdbuf, NULL, 0);
if (retval != RIG_OK)

Wyświetl plik

@ -787,21 +787,21 @@ int ts2000_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (chan->split == RIG_SPLIT_ON)
{
SNPRINTF(buf, sizeof(buf), "MW1%03d%011u%c%c%c%02d%02d%03d%c%c%09d0%c%c%s;\n",
chan->channel_num,
(unsigned) chan->tx_freq, /* 4 - frequency */
'0' + tx_mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode + 1, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* Memory group no */
chan->channel_desc /* 16 - description */
);
chan->channel_num,
(unsigned) chan->tx_freq, /* 4 - frequency */
'0' + tx_mode, /* 5 - mode */
(chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */
sqltype, /* 7 - squelch and tone type */
tone + 1, /* 8 - tone code */
code + 1, /* 9 - CTCSS code */
dcscode + 1, /* 10 - DCS code */
(chan->funcs & RIG_FUNC_REV) ? '1' : '0', /* 11 - Reverse status */
shift, /* 12 - shift type */
(int) chan->rptr_offs, /* 13 - offset frequency */
tstep + '0', /* 14 - Step size */
chan->scan_group + '0', /* Memory group no */
chan->channel_desc /* 16 - description */
);
rig_debug(RIG_DEBUG_VERBOSE, "Split, the command will be: %s\n", buf);
err = kenwood_transaction(rig, buf, NULL, 0);

Wyświetl plik

@ -284,7 +284,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
retval = read_string(&rs->rigport, (unsigned char *) replybuf, replysize,
";", 1, 0, 1);
";", 1, 0, 1);
if (retval < 0)
{
@ -462,7 +462,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
}
retval = read_string(&rs->rigport, (unsigned char *) freqbuf, freqsize,
";", 1, 0, 1);
";", 1, 0, 1);
if (retval < 0)
{
@ -515,7 +515,7 @@ int xg3_get_powerstat(RIG *rig, powerstat_t *status)
{
char reply[32];
retval = read_string(&rs->rigport, (unsigned char *) reply, sizeof(reply),
";", 1, 0, 1);
";", 1, 0, 1);
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
@ -580,7 +580,7 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
}
retval = read_string(&rs->rigport, (unsigned char *) reply, sizeof(reply),
";", 1, 0, 1);
";", 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -196,14 +196,17 @@ static int send_command(RIG *rig)
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
int ret;
ret = write_block(&rig->state.rigport, (unsigned char *) priv->control_frame, CTRL_FRAME_LEN);
ret = write_block(&rig->state.rigport, (unsigned char *) priv->control_frame,
CTRL_FRAME_LEN);
#if 0
ret = read_block(&rig->state.rigport, (unsigned char *) priv->control_frame, CTRL_FRAME_LEN);
ret = read_block(&rig->state.rigport, (unsigned char *) priv->control_frame,
CTRL_FRAME_LEN);
if (ret != CTRL_FRAME_LEN)
{
ret = ret < 0 ? ret : -RIG_EPROTO;
}
#endif
return ret;

Wyświetl plik

@ -46,9 +46,11 @@ static int miniVNA_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_flush(&rig->state.rigport);
SNPRINTF(cmdstr, sizeof(cmdstr), "0\r%lu\r1\r0\r", (unsigned long int)(freq * DDS_RATIO));
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(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
{

Wyświetl plik

@ -93,7 +93,8 @@ static int rshfiq_open(RIG *rig)
rig_flush(&rig->state.rigport);
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, strlen(versionstr));
retval = write_block(&rig->state.rigport, (unsigned char *) versionstr,
strlen(versionstr));
if (retval != RIG_OK)
{
@ -101,7 +102,7 @@ static int rshfiq_open(RIG *rig)
}
retval = read_string(&rig->state.rigport, (unsigned char *) versionstr, 20,
stopset, 2, 0, 1);
stopset, 2, 0, 1);
}
if (retval <= 0)
@ -160,7 +161,8 @@ static int rshfiq_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
SNPRINTF(cmdstr, sizeof(cmdstr), "*f%lu\r", (unsigned long int)(freq));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr, strlen(cmdstr));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
{
@ -183,7 +185,8 @@ 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, strlen(cmdstr));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
{
@ -191,7 +194,7 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
}
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
stopset, 2, 0, 1);
if (retval <= 0)
{
@ -232,7 +235,8 @@ 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, strlen(cmdstr));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
return retval;
}
@ -266,7 +270,8 @@ 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 command=%s\n", cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr, strlen(cmdstr));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
{
@ -277,7 +282,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER reply=%s\n", cmdstr);
@ -305,7 +310,8 @@ 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 command=%s\n", cmdstr);
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr, strlen(cmdstr));
retval = write_block(&rig->state.rigport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (retval != RIG_OK)
{
@ -316,7 +322,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, (unsigned char *) cmdstr, 9,
stopset, 2, 0, 1);
stopset, 2, 0, 1);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER reply=%s\n", cmdstr);

Wyświetl plik

@ -1102,8 +1102,9 @@ const char *si570xxxusb_get_info(RIG *rig)
/* always succeeds since libusb-1.0.16 */
libusb_get_device_descriptor(libusb_get_device(udh), &desc);
SNPRINTF(buf, sizeof(buf), "USB dev %04d, version: %d.%d", desc.bcdDevice, buffer[1],
buffer[0]);
SNPRINTF(buf, sizeof(buf), "USB dev %04d, version: %d.%d", desc.bcdDevice,
buffer[1],
buffer[0]);
return buf;
}

Wyświetl plik

@ -760,9 +760,9 @@ pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// cppcheck-suppress *
SNPRINTF((char *) buf, sizeof(buf), "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) freq,
rcvr->last_mode, rcvr->last_filter);
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) freq,
rcvr->last_mode, rcvr->last_filter);
err = pcr_transaction(rig, (char *) buf);
@ -901,8 +901,8 @@ pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
__func__, (int)width, pcrfilter);
SNPRINTF((char *) buf, sizeof(buf), "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) rcvr->last_freq, pcrmode, pcrfilter);
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) rcvr->last_freq, pcrmode, pcrfilter);
err = pcr_transaction(rig, (char *) buf);
@ -916,8 +916,8 @@ pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else
{
SNPRINTF((char *) buf, sizeof(buf), "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) rcvr->last_freq, pcrmode, rcvr->last_filter);
is_sub_rcvr(rig, vfo) ? '1' : '0',
(int64_t) rcvr->last_freq, pcrmode, rcvr->last_filter);
err = pcr_transaction(rig, (char *) buf);
@ -1059,13 +1059,13 @@ pcr_get_info(RIG *rig)
}
SNPRINTF(priv->info, sizeof(priv->info), "Firmware v%d.%d, Protocol v%d.%d, "
"Optional devices:%s%s%s, Country: %s",
priv->firmware / 10, priv->firmware % 10,
priv->protocol / 10, priv->protocol % 10,
(priv->options & OPT_UT106) ? " DSP" : "",
(priv->options & OPT_UT107) ? " DARC" : "",
priv->options ? "" : " none",
country);
"Optional devices:%s%s%s, Country: %s",
priv->firmware / 10, priv->firmware % 10,
priv->protocol / 10, priv->protocol % 10,
(priv->options & OPT_UT106) ? " DSP" : "",
(priv->options & OPT_UT107) ? " DARC" : "",
priv->options ? "" : " none",
country);
rig_debug(RIG_DEBUG_VERBOSE, "%s: Firmware v%d.%d, Protocol v%d.%d, "
"Optional devices:%s%s%s, Country: %s\n",

Wyświetl plik

@ -168,7 +168,8 @@ static int read_prompt_and_send(hamlib_port_t *rigport,
buflen = (data_len == NULL) ? sizeof(buf) : *data_len;
retval = read_string(rigport, (unsigned char *) data, buflen, delimiter, 1, 0, 1);
retval = read_string(rigport, (unsigned char *) data, buflen, delimiter, 1, 0,
1);
if (retval < 0)
{
@ -384,9 +385,9 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
// for RX, compute the PLL word without the IF
SNPRINTF(rx_freq_buf, sizeof(rx_freq_buf), "%04X",
rx_freq_to_pll_value(rx_freq));
rx_freq_to_pll_value(rx_freq));
SNPRINTF(tx_freq_buf, sizeof(tx_freq_buf), "%04X",
(unsigned)(tx_freq / FREQ_DIV));
(unsigned)(tx_freq / FREQ_DIV));
// The protocol is like this :
// "RX frequency : " XXXX
@ -644,7 +645,7 @@ static int prm80_do_read_system_state(hamlib_port_t *rigport, char *statebuf)
if (ret < 0)
{
return(ret);
return (ret);
}
// The response length is fixed
@ -664,7 +665,7 @@ static int prm80_do_read_system_state(hamlib_port_t *rigport, char *statebuf)
{
rig_debug(RIG_DEBUG_ERR, "%s: len=%d < %d, statebuf='%s'\n", __func__,
ret, CMD_E_RSP_LEN, statebuf);
return(-RIG_EPROTO);
return (-RIG_EPROTO);
}
p = strchr(statebuf, '>');
@ -673,7 +674,8 @@ static int prm80_do_read_system_state(hamlib_port_t *rigport, char *statebuf)
{
int left_to_read = (p - statebuf) + 1;
memmove(statebuf, p + 1, CMD_E_RSP_LEN - left_to_read);
ret = read_block(rigport, (unsigned char *) statebuf + CMD_E_RSP_LEN - left_to_read,
ret = read_block(rigport,
(unsigned char *) statebuf + CMD_E_RSP_LEN - left_to_read,
left_to_read);
if (ret < 0)
@ -908,7 +910,8 @@ 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, 1);
ret = read_string(&rs->rigport, (unsigned char *) buf, sizeof(buf), "?", 1, 0,
1);
if (ret < 0)
{

Wyświetl plik

@ -119,7 +119,8 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
do
{
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, EOM, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) respbuf, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{
@ -578,7 +579,8 @@ int ra37xx_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
default: return -RIG_EINVAL;
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "AGC%d,%d", val.i == RIG_AGC_USER ? 1 : 0, agc);
SNPRINTF(cmdbuf, sizeof(cmdbuf), "AGC%d,%d", val.i == RIG_AGC_USER ? 1 : 0,
agc);
break;
default:

Wyświetl plik

@ -97,7 +97,8 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
return retval;
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, EOM,
strlen(EOM), 0, 1);
if (retval <= 0)
{
@ -561,7 +562,7 @@ const char *racal_get_info(RIG *rig)
}
SNPRINTF(infobuf, sizeof(infobuf), "BITE errors: %s, Filters: %s\n",
bitebuf + 1, filterbuf);
bitebuf + 1, filterbuf);
return infobuf;
}

Wyświetl plik

@ -88,7 +88,7 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
}
retval = read_string(&rs->rigport, (unsigned char *) data, RESPSZ,
CR, 1, 0, 1);
CR, 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -86,7 +86,8 @@ 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, strlen(PROMPT), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) retbuf, BUFSZ, PROMPT,
strlen(PROMPT), 0, 1);
if (retval < 0)
{
@ -105,7 +106,8 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
}
}
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, LF, strlen(LF), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, BUFSZ, LF,
strlen(LF), 0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -274,7 +276,7 @@ int skanti_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RFPOWER:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "M%cO" EOM,
val.f < 0.33 ? 'L' : (val.f < 0.66 ? 'M' : 'F'));
val.f < 0.33 ? 'L' : (val.f < 0.66 ? 'M' : 'F'));
return skanti_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);

Wyświetl plik

@ -438,8 +438,8 @@ int cu_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
char cmdbuf[16];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "w%c"CR,
ts >= s_kHz(1) ? '2' :
ts >= s_Hz(100) ? '1' : '0');
ts >= s_kHz(1) ? '2' :
ts >= s_Hz(100) ? '1' : '0');
return cu_transaction(rig, cmdbuf, strlen(cmdbuf));
}
@ -447,13 +447,14 @@ int cu_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
int cu_set_parm(RIG *rig, setting_t parm, value_t val)
{
char cmdbuf[16];
switch (parm)
{
case RIG_PARM_TIME:
/* zap seconds */
val.i /= 60;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "f%02d%02d"CR,
val.i / 60, val.i % 60);
val.i / 60, val.i % 60);
break;
case RIG_PARM_BACKLIGHT:

Wyświetl plik

@ -402,7 +402,8 @@ int tt538_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?%c" EOM, which_vfo(rig, vfo));
resp_len = 7;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -452,10 +453,11 @@ int tt538_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
bytes[0] = (int) freq & 0xff;
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*%c%c%c%c%c" EOM,
which_vfo(rig, vfo),
bytes[3], bytes[2], bytes[1], bytes[0]);
which_vfo(rig, vfo),
bytes[3], bytes[2], bytes[1], bytes[0]);
return tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
return tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
}
/*
@ -521,7 +523,8 @@ int tt538_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* Query mode */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);
resp_len = 5;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -574,7 +577,8 @@ int tt538_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* Query passband width (filter) */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?W" EOM);
resp_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -636,7 +640,8 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* Query mode for both VFOs. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);
resp_len = 5;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -691,7 +696,8 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -709,7 +715,8 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = tt538_filter_number((int) width);
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*W%c" EOM, (unsigned char) width);
return tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
return tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
return RIG_OK;
}
@ -831,7 +838,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Read rig's AGC level setting. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?G" EOM);
lvl_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -866,7 +874,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Volume returned as single byte. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?U" EOM);
lvl_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -888,7 +897,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?I" EOM);
lvl_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -913,7 +923,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?P" EOM);
lvl_len = 5;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
& lvl_len);
if (retval != RIG_OK)
@ -935,7 +946,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?J" EOM);
lvl_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -957,7 +969,8 @@ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?H" EOM);
lvl_len = 4;
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), (char *) lvlbuf,
retval = tt538_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1048,7 +1061,7 @@ int tt538_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return -RIG_EINVAL;
}
retval = tt538_transaction(rig, cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt538_transaction(rig, cmdbuf, strlen((char *)cmdbuf), NULL, NULL);
if (retval != RIG_OK)
{

Wyświetl plik

@ -286,7 +286,8 @@ 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, term, strlen(term), 0,
retval = read_string(&rs->rigport, (unsigned char *) data, (*data_len) + 1,
term, strlen(term), 0,
1);
if (retval != -RIG_ETIMEOUT)
@ -475,7 +476,8 @@ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?%c" EOM, which_vfo(rig, vfo));
resp_len = 6;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -544,10 +546,11 @@ int tt588_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
bytes[0] = (int) freq & 0xff;
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*%c%c%c%c%c" EOM,
which_vfo(rig, vfo),
bytes[3], bytes[2], bytes[1], bytes[0]);
which_vfo(rig, vfo),
bytes[3], bytes[2], bytes[1], bytes[0]);
return tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
return tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
}
/*
@ -619,7 +622,8 @@ int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
// Query mode
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);
resp_len = 4;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (resp_len > 4)
@ -677,7 +681,8 @@ int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* Query passband width (filter) */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?W" EOM);
resp_len = 3;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -819,7 +824,8 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* Query mode for both VFOs. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);
resp_len = 4;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) respbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) respbuf,
&resp_len);
if (retval != RIG_OK)
@ -874,7 +880,8 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL;
}
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -891,7 +898,8 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width = tt588_filter_number((int) width);
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*W%c" EOM, (unsigned char) width);
return tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
return tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
}
/*
@ -1009,7 +1017,8 @@ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Read rig's AGC level setting. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?G" EOM);
lvl_len = 3;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1043,7 +1052,8 @@ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Volume returned as single byte. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?U" EOM);
lvl_len = 3;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1069,7 +1079,8 @@ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RF:
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?I" EOM);
lvl_len = 3;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1090,7 +1101,8 @@ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?J" EOM);
lvl_len = 33;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1119,7 +1131,8 @@ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?H" EOM);
lvl_len = 3;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), (char *) lvlbuf,
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf),
(char *) lvlbuf,
&lvl_len);
if (retval != RIG_OK)
@ -1188,7 +1201,8 @@ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
/* Volume */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*U%c" EOM, (char)(val.f * 127));
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -1200,8 +1214,10 @@ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_RF:
/* RF gain. Omni-VII expects value 0 for full gain, and 127 for lowest gain */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*I%c" EOM, 127 - (char)(val.f * 127));
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*I%c" EOM,
127 - (char)(val.f * 127));
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -1227,7 +1243,8 @@ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*Gx" EOM);
cmdbuf[2] = agcmode;
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -1246,7 +1263,8 @@ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*J%c" EOM, ii + '0');
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -1258,7 +1276,8 @@ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_SQL:
/* Squelch level, float 0.0 - 1.0 */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "*H%c" EOM, (int)(val.f * 127));
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char*)cmdbuf), NULL, NULL);
retval = tt588_transaction(rig, (char *) cmdbuf, strlen((char *)cmdbuf), NULL,
NULL);
if (retval != RIG_OK)
{
@ -1413,7 +1432,8 @@ int tt588_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
cmdbuf[2] = 0;
}
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, 0); // no response
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL,
0); // no response
if (retval != RIG_OK)
{
@ -1436,7 +1456,8 @@ const char *tt588_get_info(RIG *rig)
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?V" EOM);
memset(firmware, 0, sizeof(firmware));
rig_debug(RIG_DEBUG_VERBOSE, "%s: firmware_len=%d\n", __func__, firmware_len);
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), firmware, &firmware_len);
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), firmware,
&firmware_len);
// Response should be "VER 1010-588 " plus "RADIO x\r" or "REMOTEx\r"
// if x=blank ham band transmit only
@ -1519,7 +1540,8 @@ static int set_rit_xit(RIG *rig, vfo_t vfo, shortfreq_t rit, int which)
cmdbuf[2] = which; // set xit bit. 0=off,1=rit, 2=xit, 3=both
cmdbuf[3] = rit >> 8;
cmdbuf[4] = rit & 0xff;
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, 0); // no response
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL,
0); // no response
if (retval != RIG_OK)
{
@ -1617,7 +1639,8 @@ int tt588_set_ant(RIG *rig, vfo_t vfo, ant_t ant)
// 3 = RX=RXAUC, TX=ANT2
cmdbuf[4] = ant;
// this should be the only line needing change for remote operation
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, 0); // no response
retval = tt588_transaction(rig, cmdbuf, strlen(cmdbuf), NULL,
0); // no response
if (retval != RIG_OK)
{

Wyświetl plik

@ -401,8 +401,8 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
/* Use ASCII mode to set frequencies */
// cppcheck-suppress *
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*%cF%"PRIll EOM,
which_vfo(rig, vfo),
(int64_t)freq);
which_vfo(rig, vfo),
(int64_t)freq);
#else
/* Use binary mode */
/* Set frequency using Orion's binary mode (short) sequence.
@ -442,11 +442,11 @@ int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
#ifdef TT565_ASCII_FREQ
/* use ASCII mode */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?%cF" EOM,
which_vfo(rig, vfo));
which_vfo(rig, vfo));
#else
/* Get freq with Orion binary mode short sequence. */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?%c" EOM,
which_vfo(rig, vfo));
which_vfo(rig, vfo));
#endif
resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
@ -500,7 +500,7 @@ int tt565_set_vfo(RIG *rig, vfo_t vfo)
char vfobuf[TT565_BUFSIZE];
/* Select Sub or Main RX */
SNPRINTF(vfobuf, sizeof(vfobuf), "*K%c" EOM,
vfo == RIG_VFO_SUB ? 'S' : 'M');
vfo == RIG_VFO_SUB ? 'S' : 'M');
return tt565_transaction(rig, vfobuf, strlen(vfobuf), NULL, NULL);
}
@ -541,9 +541,9 @@ int tt565_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
char cmdbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*KV%c%c%c" EOM,
which_vfo(rig, vfo),
'N', /* FIXME */
which_vfo(rig, RIG_SPLIT_ON == split ? tx_vfo : vfo));
which_vfo(rig, vfo),
'N', /* FIXME */
which_vfo(rig, RIG_SPLIT_ON == split ? tx_vfo : vfo));
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -659,11 +659,11 @@ int tt565_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ttreceiver = which_receiver(rig, vfo);
SNPRINTF(mdbuf, sizeof(mdbuf), "*R%cM%c" EOM "*R%cF%d" EOM,
ttreceiver,
ttmode,
ttreceiver,
(int)width
);
ttreceiver,
ttmode,
ttreceiver,
(int)width
);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
@ -766,8 +766,8 @@ int tt565_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
char cmdbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cI%d" EOM,
which_receiver(rig, vfo),
(int)ts);
which_receiver(rig, vfo),
(int)ts);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -787,7 +787,7 @@ int tt565_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cI" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
@ -823,8 +823,8 @@ int tt565_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
char cmdbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cR%d" EOM,
which_receiver(rig, vfo),
(int)rit);
which_receiver(rig, vfo),
(int)rit);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -844,7 +844,7 @@ int tt565_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cR" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
@ -882,8 +882,8 @@ int tt565_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
/* Sub receiver does not contain an XIT setting */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cX%d" EOM,
'M',
(int)xit);
'M',
(int)xit);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL);
@ -903,7 +903,7 @@ int tt565_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cX" EOM,
'M');
'M');
resp_len = sizeof(respbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), respbuf, &resp_len);
@ -937,7 +937,7 @@ int tt565_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
struct rig_state *rs = &rig->state;
return write_block(&rs->rigport,
(unsigned char *) (ptt == RIG_PTT_ON ? "*TK" EOM : "*TU" EOM), 4);
(unsigned char *)(ptt == RIG_PTT_ON ? "*TK" EOM : "*TU" EOM), 4);
}
/**
@ -1076,7 +1076,7 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
case RIG_LEVEL_RFPOWER:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*TP%d" EOM,
(int)(val.f * 100));
(int)(val.f * 100));
break;
case RIG_LEVEL_AGC:
@ -1096,29 +1096,29 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cA%c" EOM,
which_receiver(rig, vfo),
cc);
which_receiver(rig, vfo),
cc);
break;
case RIG_LEVEL_AF:
/* AF Gain, float 0.0 - 1.0 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*U%c%d" EOM,
which_receiver(rig, vfo),
(int)(val.f * 255));
which_receiver(rig, vfo),
(int)(val.f * 255));
break;
case RIG_LEVEL_IF:
/* This is passband tuning int Hz */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cP%d" EOM,
which_receiver(rig, vfo),
val.i);
which_receiver(rig, vfo),
val.i);
break;
case RIG_LEVEL_RF:
/* This is IF Gain, float 0.0 - 1.0 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cG%d" EOM,
which_receiver(rig, vfo),
(int)(val.f * 100));
which_receiver(rig, vfo),
(int)(val.f * 100));
break;
case RIG_LEVEL_ATT:
@ -1131,8 +1131,8 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cT%d" EOM,
which_receiver(rig, vfo),
ii);
which_receiver(rig, vfo),
ii);
break;
case RIG_LEVEL_PREAMP:
@ -1145,26 +1145,26 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
/* RF Preamp (main Rx), int 0 or 1 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*RME%d" EOM,
val.i == 0 ? 0 : 1);
val.i == 0 ? 0 : 1);
break;
case RIG_LEVEL_SQL:
/* Squelch level, float 0.0 - 1.0 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cS%d" EOM,
which_receiver(rig, vfo),
(int)((val.f * 127) - 127));
which_receiver(rig, vfo),
(int)((val.f * 127) - 127));
break;
case RIG_LEVEL_MICGAIN:
/* Mic gain, float 0.0 - 1.0 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*TM%d" EOM,
(int)(val.f * 100));
(int)(val.f * 100));
break;
case RIG_LEVEL_COMP:
/* Speech Processor, float 0.0 - 1.0 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*TS%d" EOM,
(int)(val.f * 9));
(int)(val.f * 9));
break;
case RIG_LEVEL_CWPITCH:
@ -1177,7 +1177,7 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
else if (val.i < TT565_TONE_MIN) { val.i = TT565_TONE_MIN; }
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*CT%d" EOM,
val.i);
val.i);
break;
case RIG_LEVEL_KEYSPD:
@ -1190,7 +1190,7 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
else if (val.i < TT565_CW_MIN) { val.i = TT565_CW_MIN; }
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*CS%d" EOM,
val.i);
val.i);
break;
case RIG_LEVEL_NR:
@ -1200,8 +1200,8 @@ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
FOR NOW -- RIG_LEVEL_NR controls the Orion NB setting
*/
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*R%cNB%d" EOM,
which_receiver(rig, vfo),
(int)(val.f * 9));
which_receiver(rig, vfo),
(int)(val.f * 9));
break;
case RIG_LEVEL_VOXDELAY:
@ -1367,7 +1367,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_AGC:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cA" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1404,7 +1404,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_AF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?U%c" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1426,7 +1426,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_IF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cP" EOM, /* passband tuning */
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1448,7 +1448,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cG" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1470,7 +1470,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_ATT:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cT" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1527,7 +1527,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_SQL:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cS" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1626,7 +1626,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_NR:
/* RIG_LEVEL_NR controls Orion NB setting - TEMP */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "?R%cNB" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
lvl_len = sizeof(lvlbuf);
retval = tt565_transaction(rig, cmdbuf, strlen(cmdbuf), lvlbuf, &lvl_len);
@ -1770,9 +1770,9 @@ int tt565_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
case RIG_OP_TO_VFO:
case RIG_OP_FROM_VFO:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*K%c%c%d" EOM,
op == RIG_OP_TO_VFO ? 'R' : 'W',
which_vfo(rig, vfo),
priv->ch);
op == RIG_OP_TO_VFO ? 'R' : 'W',
which_vfo(rig, vfo),
priv->ch);
break;
case RIG_OP_TUNE:
@ -1782,8 +1782,8 @@ int tt565_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
case RIG_OP_UP:
case RIG_OP_DOWN:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "*%cS%c1" EOM,
which_vfo(rig, vfo),
op == RIG_OP_UP ? '+' : '-');
which_vfo(rig, vfo),
op == RIG_OP_UP ? '+' : '-');
break;
default:
@ -1891,8 +1891,8 @@ int tt565_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
case RIG_FUNC_LOCK:
SNPRINTF(fcmdbuf, sizeof(fcmdbuf), "*%c%c" EOM,
which_vfo(rig, vfo),
!status ? 'U' : 'L');
which_vfo(rig, vfo),
!status ? 'U' : 'L');
break;
case RIG_FUNC_NB:
@ -1901,8 +1901,8 @@ int tt565_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
limitation.
*/
SNPRINTF(fcmdbuf, sizeof(fcmdbuf), "*R%cNB%c" EOM,
which_receiver(rig, vfo),
!status ? '0' : '4');
which_receiver(rig, vfo),
!status ? '0' : '4');
break;
default:
@ -1952,7 +1952,7 @@ int tt565_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
case RIG_FUNC_LOCK:
SNPRINTF(fcmdbuf, sizeof(fcmdbuf), "?%cU" EOM,
which_vfo(rig, vfo));
which_vfo(rig, vfo));
/* needs special treatment */
fresplen = sizeof(frespbuf);
retval = tt565_transaction(rig, fcmdbuf, strlen(fcmdbuf),
@ -1972,7 +1972,7 @@ int tt565_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
available through LEVEL_NR
*/
SNPRINTF(fcmdbuf, sizeof(fcmdbuf), "?R%cNB" EOM,
which_receiver(rig, vfo));
which_receiver(rig, vfo));
/* needs special treatment */
fresplen = sizeof(frespbuf);
retval = tt565_transaction(rig, fcmdbuf, strlen(fcmdbuf),

Wyświetl plik

@ -589,7 +589,7 @@ int tt585_get_status_data(RIG *rig)
return ret;
}
ret = read_block(rigport, (unsigned char *) (char *) priv->status_data,
ret = read_block(rigport, (unsigned char *)(char *) priv->status_data,
sizeof(priv->status_data));
if (ret < 0)

Wyświetl plik

@ -274,7 +274,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return retval;
}
SNPRINTF(fmt, sizeof(fmt)-1, "%%i%%%ds", BUFSZ);
SNPRINTF(fmt, sizeof(fmt) - 1, "%%i%%%ds", BUFSZ);
sscanf(data + 1, fmt, &rig_id, data);
if (rig_id != priv->receiver_id)
@ -402,7 +402,7 @@ int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char freqbuf[16];
freq_len = num_snprintf(freqbuf, sizeof(freqbuf), "$%uF%.6f" EOM,
priv->receiver_id, freq / 1e6);
priv->receiver_id, freq / 1e6);
retval = write_block(&rs->rigport, (unsigned char *) freqbuf, freq_len);
@ -483,15 +483,17 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/*
* Set DETECTION MODE and IF FILTER
*/
mdbuf_len = num_snprintf(mdbuf, sizeof(mdbuf), "$%uD%cI%.02f" EOM, priv->receiver_id,
dmode, (float)width / 1e3);
mdbuf_len = num_snprintf(mdbuf, sizeof(mdbuf), "$%uD%cI%.02f" EOM,
priv->receiver_id,
dmode, (float)width / 1e3);
}
else
{
/*
* Set DETECTION MODE
*/
mdbuf_len = num_snprintf(mdbuf, sizeof(mdbuf), "$%uD%c" EOM, priv->receiver_id, dmode);
mdbuf_len = num_snprintf(mdbuf, sizeof(mdbuf), "$%uD%c" EOM, priv->receiver_id,
dmode);
}
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, mdbuf_len);
@ -573,14 +575,14 @@ int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
case RIG_LEVEL_ATT:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "$%uK%i" EOM,
priv->receiver_id,
val.i ? RX331_ATT_ON : RX331_ATT_OFF);
priv->receiver_id,
val.i ? RX331_ATT_ON : RX331_ATT_OFF);
break;
case RIG_LEVEL_PREAMP:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "$%uK%i" EOM,
priv->receiver_id,
val.i ? RX331_PREAMP_ON : RX331_PREAMP_OFF);
priv->receiver_id,
val.i ? RX331_PREAMP_ON : RX331_PREAMP_OFF);
break;
case RIG_LEVEL_AGC:
@ -602,33 +604,33 @@ int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF(cmdbuf, sizeof(cmdbuf), "$%uM%i" EOM,
priv->receiver_id, val.i);
priv->receiver_id, val.i);
break;
case RIG_LEVEL_RF:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "$%uA%d" EOM, priv->receiver_id,
120 - (int)(val.f * 120));
120 - (int)(val.f * 120));
break;
case RIG_LEVEL_SQL:
SNPRINTF(cmdbuf, sizeof(cmdbuf), "$%uQ%d" EOM, priv->receiver_id,
120 - (int)(val.f * 120));
120 - (int)(val.f * 120));
break;
case RIG_LEVEL_NOTCHF:
num_snprintf(cmdbuf, sizeof(cmdbuf), "$%uN%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
((float)val.i) / 1e3);
break;
case RIG_LEVEL_IF:
num_snprintf(cmdbuf, sizeof(cmdbuf), "$%uP%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
((float)val.i) / 1e3);
break;
case RIG_LEVEL_CWPITCH:
/* only in CW mode */
num_snprintf(cmdbuf, sizeof(cmdbuf), "$%uB%f" EOM, priv->receiver_id,
((float)val.i) / 1e3);
((float)val.i) / 1e3);
break;
default:

Wyświetl plik

@ -280,7 +280,8 @@ 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, strlen(REMOTE_CMD));
return write_block(&rs->rigport, (unsigned char *) REMOTE_CMD,
strlen(REMOTE_CMD));
}
int rx340_close(RIG *rig)
@ -288,7 +289,8 @@ 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, strlen(LOCAL_CMD));
return write_block(&rs->rigport, (unsigned char *) LOCAL_CMD,
strlen(LOCAL_CMD));
}
/*
@ -382,7 +384,7 @@ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
* Set DETECTION MODE and IF FILTER
*/
SNPRINTF(mdbuf, sizeof(mdbuf), "D%cI%.02f" EOM,
dmode, (float)width / 1e3);
dmode, (float)width / 1e3);
}
else
{
@ -481,8 +483,8 @@ int rx340_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AGC:
/* default to MEDIUM */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "M%c" EOM,
val.i == RIG_AGC_SLOW ? '3' : (
val.i == RIG_AGC_FAST ? '1' : '2'));
val.i == RIG_AGC_SLOW ? '3' : (
val.i == RIG_AGC_FAST ? '1' : '2'));
break;
case RIG_LEVEL_RF:

Wyświetl plik

@ -83,7 +83,8 @@ 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, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, *data_len, NULL, 0,
0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -245,9 +246,9 @@ int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
tentec_tuning_factor_calc(rig);
SNPRINTF(freqbuf, sizeof(freqbuf), "N%c%c%c%c%c%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff);
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));
@ -343,13 +344,13 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (width != RIG_PASSBAND_NOCHANGE)
{
SNPRINTF(mdbuf, sizeof(mdbuf), "W%c" EOM
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
@ -362,12 +363,12 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else
{
SNPRINTF(mdbuf, sizeof(mdbuf),
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, (unsigned char *) mdbuf, strlen(mdbuf));
if (retval != RIG_OK)
@ -415,8 +416,8 @@ int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AGC:
/* default to MEDIUM */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "G%c" EOM,
val.i == RIG_AGC_SLOW ? '1' : (
val.i == RIG_AGC_FAST ? '3' : '2'));
val.i == RIG_AGC_SLOW ? '1' : (
val.i == RIG_AGC_FAST ? '3' : '2'));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)

Wyświetl plik

@ -101,7 +101,8 @@ 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, 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, *data_len, NULL, 0,
0, 1);
if (retval == -RIG_ETIMEOUT)
{
@ -614,8 +615,8 @@ tt550_set_rx_freq(RIG *rig, vfo_t vfo, freq_t freq)
tt550_tuning_factor_calc(rig, RECEIVE);
SNPRINTF(freqbuf, sizeof(freqbuf), "N%c%c%c%c%c%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
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));
@ -648,8 +649,8 @@ tt550_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
tt550_tuning_factor_calc(rig, TRANSMIT);
SNPRINTF(freqbuf, sizeof(freqbuf), "T%c%c%c%c%c%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
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));
@ -773,10 +774,10 @@ tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (width != RIG_PASSBAND_NOCHANGE)
{
SNPRINTF(mdbuf, sizeof(mdbuf), "W%c" EOM
"N%c%c%c%c%c%c" EOM,
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
"N%c%c%c%c%c%c" EOM,
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));
if (retval != RIG_OK)
@ -906,10 +907,10 @@ tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (width != RIG_PASSBAND_NOCHANGE)
{
SNPRINTF(mdbuf, sizeof(mdbuf), "C%c" EOM
"T%c%c%c%c%c%c" EOM,
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
"T%c%c%c%c%c%c" EOM,
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));
if (retval != RIG_OK)
@ -1007,7 +1008,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'));
val.i >= 3 ? '3' : (val.i < 2 ? '1' : '2'));
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
@ -1095,9 +1096,9 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
dahfactor = ditfactor * 3;
SNPRINTF(cmdbuf, sizeof(cmdbuf), "E%c%c%c%c%c%c" EOM,
ditfactor >> 8, ditfactor & 0xff, dahfactor >> 8,
dahfactor & 0xff, spcfactor >> 8,
spcfactor & 0xff);
ditfactor >> 8, ditfactor & 0xff, dahfactor >> 8,
dahfactor & 0xff, spcfactor >> 8,
spcfactor & 0xff);
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
if (retval == RIG_OK)
@ -1457,19 +1458,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(&rs->rigport, 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->anf == 0 ? '0' : '1');
priv->en_nr = status;
return write_block(&rs->rigport, fctbuf, strlen((char*)fctbuf));
return write_block(&rs->rigport, 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');
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(&rs->rigport, fctbuf, strlen((char *)fctbuf));
case RIG_FUNC_TUNER:

Wyświetl plik

@ -154,7 +154,8 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{
@ -437,7 +438,7 @@ int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
SNPRINTF(levelbuf, sizeof(levelbuf), "AT%c"EOM,
val.i != 0 ? 'N' : 'F');
val.i != 0 ? 'N' : 'F');
break;
default:
@ -701,11 +702,11 @@ int uniden_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
/* PM089T08511625 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "PM%03d%c%08u" EOM, chan->channel_num,
#if 0
trunked ? 'T' : ' ',
trunked ? 'T' : ' ',
#else
' ',
' ',
#endif
(unsigned)(chan->freq / 100));
(unsigned)(chan->freq / 100));
ret = uniden_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, membuf, &mem_len);
@ -718,7 +719,7 @@ int uniden_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
/* only BC780 BC250 BC785 */
SNPRINTF(cmdbuf, sizeof(cmdbuf), "TA C %03d %s" EOM,
chan->channel_num, chan->channel_desc);
chan->channel_num, chan->channel_desc);
ret = uniden_transaction(rig, cmdbuf, strlen(cmdbuf), NULL, NULL, NULL);

Wyświetl plik

@ -136,7 +136,8 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM, strlen(EOM), 0, 1);
retval = read_string(&rs->rigport, (unsigned char *) data, *datasize, EOM,
strlen(EOM), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -548,7 +548,8 @@ static int ft100_read_status(RIG *rig)
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->status, sizeof(FT100_STATUS_INFO));
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->status,
sizeof(FT100_STATUS_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read status=%i \n", __func__, ret);
if (ret < 0)
@ -575,7 +576,8 @@ static int ft100_read_flags(RIG *rig)
return ret;
}
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->flags, sizeof(FT100_FLAG_INFO));
ret = read_block(&rig->state.rigport, (unsigned char *) &priv->flags,
sizeof(FT100_FLAG_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read flags=%i \n", __func__, ret);
if (ret < 0)
@ -635,10 +637,10 @@ int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* now convert it .... */
SNPRINTF(freq_str, sizeof(freq_str), "%02X%02X%02X%02X",
priv->status.freq[0],
priv->status.freq[1],
priv->status.freq[2],
priv->status.freq[3]);
priv->status.freq[0],
priv->status.freq[1],
priv->status.freq[2],
priv->status.freq[3]);
d1 = strtol(freq_str, NULL, 16);
d2 = (d1 * 1.25); /* fixed 10Hz bug by OH2MMY */
@ -989,7 +991,8 @@ 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, sizeof(FT100_METER_INFO));
ret = read_block(&rig->state.rigport, (unsigned char *) &ft100_meter,
sizeof(FT100_METER_INFO));
rig_debug(RIG_DEBUG_VERBOSE, "%s: read meters=%d\n", __func__, ret);
if (ret < 0)

Wyświetl plik

@ -2490,7 +2490,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(&rig->state.rigport, mdata, FT1000D_READ_METER_LENGTH);
if (err < 0)
{
@ -3494,7 +3494,8 @@ 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(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -3552,7 +3553,8 @@ 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(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -3617,7 +3619,8 @@ 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(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -259,7 +259,7 @@ const struct rig_caps ftdx3000_caps =
.serial_handshake = RIG_HANDSHAKE_HARDWARE,
// write_delay 5ms or less was causing VS1;VS; to answer with VS0 instead of VS1 even though change did occur
// see https://github.com/Hamlib/Hamlib/issues/906
.write_delay = 0,
.write_delay = 0,
.post_write_delay = FTDX5000_POST_WRITE_DELAY,
.timeout = 2000,
.retry = 3,

Wyświetl plik

@ -396,7 +396,8 @@ 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, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (unsigned char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
static int ft600_read_status(RIG *rig)
@ -419,7 +420,7 @@ static int ft600_read_status(RIG *rig)
ret = read_block(&rig->state.rigport,
(unsigned char *) &priv->status, FT600_STATUS_UPDATE_DATA_LENGTH);
(unsigned char *) &priv->status, FT600_STATUS_UPDATE_DATA_LENGTH);
rig_debug(RIG_DEBUG_VERBOSE, "%s: read status=%i \n", __func__, ret);

Wyświetl plik

@ -1848,7 +1848,8 @@ 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, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -1908,7 +1909,8 @@ 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, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -2000,7 +2000,8 @@ static int ft890_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, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2060,7 +2061,8 @@ static int ft890_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,
FT890_BCD_DIAL) * 10);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2140,7 +2142,8 @@ static int ft890_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, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -386,7 +386,8 @@ static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "ST%c;", ci);
if (RIG_OK != (err = write_block(&state->rigport, (unsigned char *) priv->cmd_str, strlen(priv->cmd_str))))
if (RIG_OK != (err = write_block(&state->rigport,
(unsigned char *) priv->cmd_str, strlen(priv->cmd_str))))
{
rig_debug(RIG_DEBUG_ERR, "%s: write_block err = %d\n", __func__, err);
return err;
@ -557,7 +558,8 @@ static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
// Copy A to B
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
if (RIG_OK != (err = write_block(&state->rigport, (unsigned char *) priv->cmd_str, strlen(priv->cmd_str))))
if (RIG_OK != (err = write_block(&state->rigport,
(unsigned char *) priv->cmd_str, strlen(priv->cmd_str))))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s:%d write_block err = %d\n", __func__, __LINE__,
err);

Wyświetl plik

@ -2740,7 +2740,8 @@ static int ft920_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, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2804,7 +2805,8 @@ static int ft920_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,
FT920_BCD_DIAL) * 10);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2887,7 +2889,8 @@ static int ft920_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, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -585,7 +585,8 @@ int ft980_transaction(RIG *rig, const unsigned char *cmd, unsigned char *data,
return retval;
}
if (retval != YAESU_CMD_LENGTH || (memcmp(echo_back, cmd, YAESU_CMD_LENGTH) != 0))
if (retval != YAESU_CMD_LENGTH
|| (memcmp(echo_back, cmd, YAESU_CMD_LENGTH) != 0))
{
return -RIG_EPROTO;
}

Wyświetl plik

@ -565,15 +565,15 @@ int ft990_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return err;
}
if (vfo != vfo_save)
{
err = ft990_set_vfo(rig, vfo_save);
if (vfo != vfo_save)
{
err = ft990_set_vfo(rig, vfo_save);
if (err != RIG_OK)
{
return err;
}
if (err != RIG_OK)
{
return err;
}
}
return RIG_OK;
}
@ -3396,7 +3396,8 @@ int ft990_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(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -3454,7 +3455,8 @@ int ft990_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,
FT990_BCD_DIAL) * 10);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -3518,7 +3520,8 @@ int ft990_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, FT990_BCD_RIT);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (unsigned char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -437,7 +437,7 @@ static int newcat_band_index(freq_t freq)
else if (freq >= MHz(0.5) && freq < MHz(1.705)) { band = 12; } // MW Medium Wave
rig_debug(RIG_DEBUG_TRACE, "%s: freq=%g, band=%d\n", __func__, freq, band);
return(band);
return (band);
}
/*
@ -514,7 +514,7 @@ int newcat_open(RIG *rig)
{
struct newcat_priv_data *priv = rig->state.priv;
struct rig_state *rig_s = &rig->state;
const char *handshake[3] = {"None","Xon/Xoff", "Hardware"};
const char *handshake[3] = {"None", "Xon/Xoff", "Hardware"};
ENTERFUNC;
@ -590,6 +590,7 @@ int newcat_open(RIG *rig)
rig->state.disable_yaesu_bandselect = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: disabling FTDX3000 band select\n", __func__);
}
RETURNFUNC(RIG_OK);
}
@ -773,7 +774,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// disabled to check 2019 firmware on FTDX5000 and FT450 behavior
//special_60m = newcat_is_rig(rig, RIG_MODEL_FTDX5000);
//special_60m |= newcat_is_rig(rig, RIG_MODEL_FT450);
rig_debug(RIG_DEBUG_TRACE, "%s: special_60m=%d, 60m freq=%d, is_ftdx3000=%d,is_ftdx3000dm=%d\n",
rig_debug(RIG_DEBUG_TRACE,
"%s: special_60m=%d, 60m freq=%d, is_ftdx3000=%d,is_ftdx3000dm=%d\n",
__func__, special_60m, freq >= 5300000
&& freq <= 5410000, is_ftdx3000, is_ftdx3000dm);
@ -2311,8 +2313,9 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
{
RETURNFUNC(err);
}
if (tmp_mode == tx_mode && (tmp_width == tx_width || tmp_width == RIG_PASSBAND_NOCHANGE))
if (tmp_mode == tx_mode && (tmp_width == tx_width
|| tmp_width == RIG_PASSBAND_NOCHANGE))
{
RETURNFUNC(RIG_OK);
}
@ -2342,7 +2345,7 @@ int newcat_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
{
RETURNFUNC(err);
}
RETURNFUNC(RIG_OK);
}
@ -3262,7 +3265,8 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "PS%c%c", ps, cat_term);
retval = write_block(&state->rigport, (unsigned char *) priv->cmd_str, strlen(priv->cmd_str));
retval = write_block(&state->rigport, (unsigned char *) priv->cmd_str,
strlen(priv->cmd_str));
retry_save = rig->state.rigport.retry;
rig->state.rigport.retry = 0;
@ -3282,7 +3286,8 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
}
rig_debug(RIG_DEBUG_TRACE, "%s: Wait #%d for power up\n", __func__, i + 1);
retval = write_block(&state->rigport, (unsigned char *) priv->cmd_str, strlen(priv->cmd_str));
retval = write_block(&state->rigport, (unsigned char *) priv->cmd_str,
strlen(priv->cmd_str));
if (retval != RIG_OK) { RETURNFUNC(retval); }
}
@ -3519,32 +3524,50 @@ int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
RETURNFUNC(RIG_OK);
}
static int band2rig (hamlib_band_t band)
static int band2rig(hamlib_band_t band)
{
int retval = 0;
switch(band)
switch (band)
{
case RIG_BAND_160M: retval = 0;break;
case RIG_BAND_80M: retval = 1;break;
case RIG_BAND_60M: retval = 2;break;
case RIG_BAND_40M: retval = 3;break;
case RIG_BAND_30M: retval = 4;break;
case RIG_BAND_20M: retval = 5;break;
case RIG_BAND_17M: retval = 6;break;
case RIG_BAND_15M: retval = 7;break;
case RIG_BAND_12M: retval = 8;break;
case RIG_BAND_10M: retval = 9;break;
case RIG_BAND_6M: retval = 10;break;
case RIG_BAND_GEN: retval = 11;break;
case RIG_BAND_MW: retval = 12;break;
case RIG_BAND_AIR: retval = 14;break;
case RIG_BAND_144MHZ: retval = 15;break;
case RIG_BAND_430MHZ: retval = 16;break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown band index=%d\n", __func__, band);
retval = -RIG_EINVAL;
break;
case RIG_BAND_160M: retval = 0; break;
case RIG_BAND_80M: retval = 1; break;
case RIG_BAND_60M: retval = 2; break;
case RIG_BAND_40M: retval = 3; break;
case RIG_BAND_30M: retval = 4; break;
case RIG_BAND_20M: retval = 5; break;
case RIG_BAND_17M: retval = 6; break;
case RIG_BAND_15M: retval = 7; break;
case RIG_BAND_12M: retval = 8; break;
case RIG_BAND_10M: retval = 9; break;
case RIG_BAND_6M: retval = 10; break;
case RIG_BAND_GEN: retval = 11; break;
case RIG_BAND_MW: retval = 12; break;
case RIG_BAND_AIR: retval = 14; break;
case RIG_BAND_144MHZ: retval = 15; break;
case RIG_BAND_430MHZ: retval = 16; break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown band index=%d\n", __func__, band);
retval = -RIG_EINVAL;
break;
}
return retval;
}
@ -3602,7 +3625,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
fpf = newcat_scale_float(scale, val.f);
if (is_ft950 || is_ft891 || is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx101d
if (is_ft950 || is_ft891 || is_ft991 || is_ftdx3000 || is_ftdx3000dm
|| is_ftdx101d
|| is_ftdx101mp || is_ftdx10)
{
// Minimum is 5 watts on these rigs
@ -3677,7 +3701,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
@ -3719,7 +3744,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
}
// Some Yaesu rigs reject this command in AM/FM modes
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|| mode & RIG_MODE_FMN)
@ -3787,14 +3813,16 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991 || is_ftdx101d
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
|| is_ftdx101d
|| is_ftdx101mp
|| is_ftdx10)
{
@ -3808,7 +3836,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "MG%03d%c", fpf, cat_term);
// Some Yaesu rigs reject this command in RTTY modes
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_RTTY || mode & RIG_MODE_RTTYR)
{
@ -4355,7 +4384,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991 || is_ftdx101d
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
|| is_ftdx101d
|| is_ftdx101mp
|| is_ftdx10)
{
@ -4381,12 +4411,15 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (newcat_valid_command(rig, "BS"))
{
int band = band2rig((hamlib_band_t)val.i);
if (band < 0)
{
RETURNFUNC(-RIG_EINVAL);
}
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", band, cat_term);
}
break;
case RIG_LEVEL_NB:
@ -4507,7 +4540,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
@ -4521,7 +4555,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
// Some Yaesu rigs reject this command in AM/FM modes
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|| mode & RIG_MODE_FMN)
@ -4561,7 +4596,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
@ -4569,7 +4605,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "MG%c", cat_term);
// Some Yaesu rigs reject this command in RTTY modes
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_RTTY || mode & RIG_MODE_RTTYR)
{
@ -4940,7 +4977,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
switch (level)
{
case RIG_LEVEL_RFPOWER:
if (is_ft950 || is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
if (is_ft950 || is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891
|| is_ft991
|| is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
scale = 100.;
@ -5111,7 +5149,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
case RIG_LEVEL_MICGAIN:
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991 || is_ftdx101d
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
|| is_ftdx101d
|| is_ftdx101mp
|| is_ftdx10)
{
@ -5208,7 +5247,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
}
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ft891 || is_ft991
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ft891
|| is_ft991
|| is_ftdx101d || is_ftdx101mp || is_ftdx10)
{
val->i = round(rig_raw2val(atoi(retlvl), &yaesu_default_str_cal));
@ -5434,7 +5474,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
case RIG_LEVEL_MONITOR_GAIN:
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991 || is_ftdx101d
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
|| is_ftdx101d
|| is_ftdx101mp)
{
scale = 100.;
@ -5492,7 +5533,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
err = newcat_get_mode(rig, vfo, &mode, &width);
}
@ -5506,7 +5548,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
// Some Yaesu rigs reject this command in FM mode
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_FM || mode & RIG_MODE_FMN)
{
@ -5527,7 +5570,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
@ -5541,7 +5585,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
// Some Yaesu rigs reject this command in FM mode
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_FM || mode & RIG_MODE_FMN)
{
@ -5600,7 +5645,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
// These rigs can lock Main/Sub VFO dials individually
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "LK%d%c", status ? 7 : 4,
@ -5650,7 +5696,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
@ -5664,7 +5711,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
// Some Yaesu rigs reject this command in FM mode
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_FM || mode & RIG_MODE_FMN)
{
@ -5685,12 +5733,14 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
newcat_get_mode(rig, vfo, &mode, &width);
}
if (is_ft891 || is_ft991 || is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx101d
if (is_ft891 || is_ft991 || is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm
|| is_ftdx101d
|| is_ftdx101mp)
{
// There seems to be an error in the manuals for some of these rigs stating that values should be 1 = OFF and 2 = ON, but they are 0 = OFF and 1 = ON instead
@ -5704,7 +5754,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
}
// Some Yaesu rigs reject this command in AM/FM/RTTY modes
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|| mode & RIG_MODE_FMN ||
@ -5833,7 +5884,8 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
err = newcat_get_mode(rig, vfo, &mode, &width);
}
@ -5846,7 +5898,8 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
}
// Some Yaesu rigs reject this command in FM mode
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ft991 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
if (mode & RIG_MODE_FM || mode & RIG_MODE_FMN)
{
@ -5965,7 +6018,8 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
RETURNFUNC(-RIG_ENAVAIL);
}
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991 || is_ftdx101d
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ft891 || is_ft991
|| is_ftdx101d
|| is_ftdx101mp)
{
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "PR0%c", cat_term);
@ -6085,7 +6139,8 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
break;
case RIG_FUNC_LOCK:
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d || is_ftdx101mp)
if (is_ftdx1200 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx101d
|| is_ftdx101mp)
{
// These rigs can lock Main/Sub VFO dials individually
*status = (retfunc[0] == '0' || retfunc[0] == '4') ? 0 : 1;
@ -7405,16 +7460,21 @@ int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo)
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: alias vfo = %s\n", __func__, rig_strvfo(*vfo));
if (*vfo == RIG_VFO_NONE)
if (*vfo == RIG_VFO_NONE)
{
int rc = rig_get_vfo(rig, vfo);
if (rc != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig_get_vfo failed: %s\n", __func__, rig_strvfo(*vfo));
rig_debug(RIG_DEBUG_ERR, "%s: rig_get_vfo failed: %s\n", __func__,
rig_strvfo(*vfo));
RETURNFUNC(rc);
}
rig_debug(RIG_DEBUG_TRACE, "%s: vfo==None so get vfo=%s\n", __func__, rig_strvfo(*vfo));
rig_debug(RIG_DEBUG_TRACE, "%s: vfo==None so get vfo=%s\n", __func__,
rig_strvfo(*vfo));
}
switch (*vfo)
{
case RIG_VFO_A:
@ -9840,8 +9900,9 @@ int newcat_get_rigid(RIG *rig)
s += 2; /* ID0310, jump past ID */
priv->rig_id = atoi(s);
}
rig_debug(RIG_DEBUG_TRACE, "rig_id = %d, idstr = %s\n", priv->rig_id,
s == NULL ? "NULL" : s);
s == NULL ? "NULL" : s);
}
else
{
@ -10065,7 +10126,8 @@ int newcat_get_cmd(RIG *rig)
/* send the command */
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str);
if (RIG_OK != (rc = write_block(&state->rigport, (unsigned char *) priv->cmd_str,
if (RIG_OK != (rc = write_block(&state->rigport,
(unsigned char *) priv->cmd_str,
strlen(priv->cmd_str))))
{
RETURNFUNC(rc);
@ -10073,7 +10135,8 @@ int newcat_get_cmd(RIG *rig)
}
/* read the reply */
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data, sizeof(priv->ret_data),
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0, 1)) <= 0)
{
continue; /* usually a timeout - retry */
@ -10215,18 +10278,20 @@ int newcat_set_cmd_validate(RIG *rig)
// a verifcation of frequency and retries if it doesn't match
if ((strncmp(priv->cmd_str, "FA", 2) == 0) && (strlen(priv->cmd_str) > 3))
{
strcpy(valcmd, "FA;");
strcpy(valcmd, "FA;");
if (priv->rig_id == NC_RIGID_FTDX3000)
{
strcpy(valcmd, "");
strcpy(valcmd, "");
}
}
else if ((strncmp(priv->cmd_str, "FB", 2) == 0) && (strlen(priv->cmd_str) > 3))
{
strcpy(valcmd, "FB;");
strcpy(valcmd, "FB;");
if (priv->rig_id == NC_RIGID_FTDX3000)
{
strcpy(valcmd, "");
strcpy(valcmd, "");
}
}
else if ((strncmp(priv->cmd_str, "MD", 2) == 0) && (strlen(priv->cmd_str) > 3))
@ -10250,10 +10315,11 @@ int newcat_set_cmd_validate(RIG *rig)
else if ((strncmp(priv->cmd_str, "VS", 2) == 0) && (strlen(priv->cmd_str) > 3))
{
strcpy(valcmd, "VS;");
// Some models treat the 2nd VS as a mute request
if (is_ftdx3000 || is_ftdx9000)
{
strcpy(valcmd, "");
strcpy(valcmd, "");
}
}
else if (strncmp(priv->cmd_str, "SV", 2) == 0)
@ -10294,7 +10360,8 @@ int newcat_set_cmd_validate(RIG *rig)
if (strlen(valcmd) == 0) { RETURNFUNC(RIG_OK); }
bytes = read_string(&state->rigport, (unsigned char *) priv->ret_data, sizeof(priv->ret_data),
bytes = read_string(&state->rigport, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0, 1);
// FA and FB success is now verified in rig.c with a followup query
@ -10384,7 +10451,8 @@ int newcat_set_cmd(RIG *rig)
rig_debug(RIG_DEBUG_TRACE,
"%s: newcat_set_cmd_validate not implemented...continuing\n", __func__);
if (RIG_OK != (rc = write_block(&state->rigport, (unsigned char *) priv->cmd_str,
if (RIG_OK != (rc = write_block(&state->rigport,
(unsigned char *) priv->cmd_str,
strlen(priv->cmd_str))))
{
RETURNFUNC(rc);
@ -10422,7 +10490,8 @@ int newcat_set_cmd(RIG *rig)
}
/* read the reply */
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data, sizeof(priv->ret_data),
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0, 1)) <= 0)
{
continue; /* usually a timeout - retry */
@ -10492,7 +10561,8 @@ int newcat_set_cmd(RIG *rig)
priv->cmd_str);
/* read/flush the verify command reply which should still be there */
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data, sizeof(priv->ret_data),
if ((rc = read_string(&state->rigport, (unsigned char *) priv->ret_data,
sizeof(priv->ret_data),
&cat_term, sizeof(cat_term), 0, 1)) > 0)
{
rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n",
@ -10557,11 +10627,11 @@ rmode_t newcat_rmode(char mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: %s for %c\n", __func__,
rig_strrmode(newcat_mode_conv[i].mode), mode);
return(newcat_mode_conv[i].mode);
return (newcat_mode_conv[i].mode);
}
}
return(RIG_MODE_NONE);
return (RIG_MODE_NONE);
}
char newcat_modechar(rmode_t rmode)
@ -10574,11 +10644,11 @@ char newcat_modechar(rmode_t rmode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: return %c for %s\n", __func__,
newcat_mode_conv[i].modechar, rig_strrmode(rmode));
return(newcat_mode_conv[i].modechar);
return (newcat_mode_conv[i].modechar);
}
}
return('0');
return ('0');
}
rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width)

Wyświetl plik

@ -91,7 +91,7 @@ transaction_write:
/* the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len,
ACK, strlen(ACK), 0, 1);
ACK, strlen(ACK), 0, 1);
if (retval < 0)
{
@ -135,8 +135,8 @@ celestron_set_position(ROT *rot, azimuth_t az, elevation_t el)
*/
SNPRINTF(cmdstr, sizeof(cmdstr), "B%04X,%04X",
(unsigned)((az / 360.) * 65535),
(unsigned)((el / 360.) * 65535));
(unsigned)((az / 360.) * 65535),
(unsigned)((el / 360.) * 65535));
retval = celestron_transaction(rot, cmdstr, NULL, 0);

Wyświetl plik

@ -48,7 +48,8 @@ cnctrk_set_position(ROT *rot, azimuth_t az, elevation_t el)
return retval;
}
SNPRINTF(axcmd, sizeof(axcmd), "/usr/bin/axis-remote --mdi 'G00 X %6.2f Y %6.2f' \n", az, el);
SNPRINTF(axcmd, sizeof(axcmd),
"/usr/bin/axis-remote --mdi 'G00 X %6.2f Y %6.2f' \n", az, el);
return system(axcmd);
}

Wyświetl plik

@ -78,7 +78,7 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
}
retval = read_string(&rs->rotport, (unsigned char *) data, data_len,
"\n", 1, 0, 1);
"\n", 1, 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -59,7 +59,7 @@ static int ether_transaction(ROT *rot, char *cmd, int len, char *buf)
}
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX,
"\n", sizeof("\n"), 0, 1);
"\n", sizeof("\n"), 0, 1);
rig_debug(RIG_DEBUG_VERBOSE, "function %s(2): ret=%d || receive=%s\n", __func__,
ret, buf);

Wyświetl plik

@ -92,7 +92,7 @@ transaction_write:
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len,
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
if (retval < 0)
{
@ -146,7 +146,8 @@ static int
gs232_wo_transaction(ROT *rot, const char *cmdstr,
char *data, size_t data_len)
{
return write_block(&rot->state.rotport, (unsigned char *) cmdstr, strlen(cmdstr));
return write_block(&rot->state.rotport, (unsigned char *) cmdstr,
strlen(cmdstr));
}

Wyświetl plik

@ -102,7 +102,7 @@ transaction_write:
{
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len,
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
if (strncmp(data, "\r\n", 2) == 0
|| strchr(data, '>'))

Wyświetl plik

@ -102,7 +102,7 @@ transaction_write:
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len,
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
REPLY_EOM, strlen(REPLY_EOM), 0, 1);
if (strncmp(data, "\r\n", 2) == 0 || strchr(data, '>'))
{

Wyświetl plik

@ -106,7 +106,8 @@ transaction_write:
/** the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, ACK, strlen(ACK), 0, 1);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, ACK,
strlen(ACK), 0, 1);
if (retval < 0)
{

Wyświetl plik

@ -202,13 +202,15 @@ transaction_write:
/* then comes the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, CR, strlen(CR), 0, 1);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, CR,
strlen(CR), 0, 1);
// some models seem to echo -- so we'll check and read again if echoed
if (cmdstr && strcmp(data, cmdstr) == 0)
{
memset(data, 0, data_len);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, CR, strlen(CR), 0, 1);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, CR,
strlen(CR), 0, 1);
}
if (retval < 0)

Wyświetl plik

@ -113,7 +113,8 @@ transaction:
if (cmdstr)
{
return_value = write_block(&rs->rotport, (unsigned char *) cmdstr, strlen(cmdstr));
return_value = write_block(&rs->rotport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (return_value != RIG_OK)
{
@ -126,7 +127,8 @@ transaction:
return value is expected, Strings end with '#' */
if (data != NULL)
{
return_value = read_string(&rs->rotport, (unsigned char *) data, expected_return_length + 1,
return_value = read_string(&rs->rotport, (unsigned char *) data,
expected_return_length + 1,
"\r\n", strlen("\r\n"), 0, 1);
if (return_value > 0)
@ -444,8 +446,9 @@ static const char *meade_get_info(ROT *rot)
struct meade_priv_data *priv = (struct meade_priv_data *)rot->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
SNPRINTF(buf, sizeof(buf), "Meade telescope rotator with LX200 protocol.\nModel: %s",
priv->product_name);
SNPRINTF(buf, sizeof(buf),
"Meade telescope rotator with LX200 protocol.\nModel: %s",
priv->product_name);
return buf;
}

Wyświetl plik

@ -96,7 +96,8 @@ transaction_write:
}
// Remember to check for STXA,G,R or STXA,?,XXX,R 10 bytes
retval = read_string(&rs->rotport, (unsigned char *) data, 20, CR, strlen(CR), 0, 1);
retval = read_string(&rs->rotport, (unsigned char *) data, 20, CR, strlen(CR),
0, 1);
if (retval < 0)
{

Wyświetl plik

@ -77,7 +77,8 @@ radant_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
return RIG_OK; /* don't want a reply */
}
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, "\n", 1, 0, 1);
retval = read_string(&rs->rotport, (unsigned char *) data, data_len, "\n", 1, 0,
1);
if (retval < 0)
{

Wyświetl plik

@ -434,7 +434,8 @@ static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth,
azimuth = 0;
}
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%03.0f;", azimuth); /* Target bearing */
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%03.0f;",
azimuth); /* Target bearing */
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
@ -479,7 +480,8 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
return -RIG_EINVAL;
}
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;", azimuth); /* Total field width of 5 chars */
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;",
azimuth); /* Total field width of 5 chars */
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
@ -490,7 +492,7 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
if (rot->state.rotport2.pathname[0] != 0)
{
SNPRINTF(cmdstr, sizeof(cmdstr), "AP1%05.1f\r;",
elevation); /* Total field width of 5 chars */
elevation); /* Total field width of 5 chars */
err = rotorez_send_priv_cmd2(rot, cmdstr);
@ -499,6 +501,7 @@ static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
return err;
}
}
return RIG_OK;
}
@ -760,7 +763,8 @@ static int rt21_rot_get_position(ROT *rot, azimuth_t *azimuth,
rs = &rot->state;
err = read_string(&rs->rotport, (unsigned char *) az, RT21_AZ_LEN + 1, ";", strlen(";"), 0, 1);
err = read_string(&rs->rotport, (unsigned char *) az, RT21_AZ_LEN + 1, ";",
strlen(";"), 0, 1);
if (err < 0) /* read_string returns negative on error. */
{

Wyświetl plik

@ -127,7 +127,8 @@ static int sartek_rot_set_position(ROT *rot, azimuth_t azimuth,
SNPRINTF(cmdstr, sizeof(cmdstr), "P%c", (int)((azimuth * 255) / 360));
err = write_block(&rot->state.rotport, (unsigned char *) cmdstr, strlen(cmdstr));
err = write_block(&rot->state.rotport, (unsigned char *) cmdstr,
strlen(cmdstr));
if (err != RIG_OK)
{

Wyświetl plik

@ -161,7 +161,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
// read motion state
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -171,7 +172,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->motion_enabled = strcmp(resbuf, "Motion ENABLED") == 0 ? true : false;
// XXX skip mode
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -179,7 +181,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// XXX skip time
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -187,7 +190,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// read azimuth line
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -199,7 +203,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->az = (int)strtof(p, NULL);
// read elevation line
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -211,7 +216,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->el = (int)strtof(p, NULL);
// skip blank line
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{
@ -219,7 +225,8 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// XXX skip stored position count
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0, 1);
ret = read_string(&rs->rotport, (unsigned char *) resbuf, BUF_SIZE, "\n", 1, 0,
1);
if (ret < 0)
{

Wyświetl plik

@ -213,7 +213,7 @@ static int spid_rot2prog_rot_set_position(ROT *rot, azimuth_t az,
do
{
retval = write_block(&rs->rotport,
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13);
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13);
if (retval != RIG_OK)
{
@ -288,7 +288,7 @@ static int spid_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
do
{
retval = write_block(&rs->rotport,
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13);
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13);
if (retval != RIG_OK)
{
@ -360,7 +360,7 @@ static int spid_rot_stop(ROT *rot)
do
{
retval = write_block(&rs->rotport,
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x20", 13);
(unsigned char *) "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x20", 13);
if (retval != RIG_OK)
{

Wyświetl plik

@ -185,33 +185,41 @@ void frameParse(int fd, unsigned char *frame, int len)
break;
case 0x14:
switch(frame[5])
switch (frame[5])
{
static int power_level = 0;
case 0x0a:
printf("Using power level %d\n", power_level);
power_level += 10;
if (power_level > 250) power_level = 0;
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
break;
case 0x0a:
printf("Using power level %d\n", power_level);
power_level += 10;
if (power_level > 250) { power_level = 0; }
to_bcd(&frame[6], (long long)power_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
break;
}
break;
case 0x15:
switch(frame[5])
switch (frame[5])
{
static int meter_level = 0;
case 0x11:
printf("Using meter level %d\n", meter_level);
meter_level += 10;
if (meter_level > 250) meter_level = 0;
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
break;
case 0x11:
printf("Using meter level %d\n", meter_level);
meter_level += 10;
if (meter_level > 250) { meter_level = 0; }
to_bcd(&frame[6], (long long)meter_level, 2);
frame[8] = 0xfd;
write(fd, frame, 9);
break;
}
break;
case 0x1a: // miscellaneous things

Wyświetl plik

@ -219,7 +219,8 @@ int main(int argc, char *argv[])
}
else if (strncmp(buf, "MD;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "MD%d;", modeA); // not worried about modeB yet for simulator
SNPRINTF(buf, sizeof(buf), "MD%d;",
modeA); // not worried about modeB yet for simulator
write(fd, buf, strlen(buf));
}
else if (strncmp(buf, "MD", 2) == 0)

Wyświetl plik

@ -197,9 +197,9 @@ int main(int argc, char *argv[])
}
#endif
else if (strcmp(buf, "VS") == 0 && strlen(buf)>3)
else if (strcmp(buf, "VS") == 0 && strlen(buf) > 3)
{
curr_vfo = buf[3] == '1'?RIG_VFO_B:RIG_VFO_A;
curr_vfo = buf[3] == '1' ? RIG_VFO_B : RIG_VFO_A;
usleep(50 * 1000);
}
else if (strcmp(buf, "VS;") == 0)
@ -207,7 +207,9 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
usleep(50 * 1000);
pbuf = "VS0;";
if (curr_vfo == RIG_VFO_B || curr_vfo == RIG_VFO_SUB) pbuf[2] = '1';
if (curr_vfo == RIG_VFO_B || curr_vfo == RIG_VFO_SUB) { pbuf[2] = '1'; }
n = write(fd, pbuf, strlen(pbuf));
printf("n=%d\n", n);

Wyświetl plik

@ -350,7 +350,7 @@ int frontamp_get_conf2(AMP *amp, token_t token, char *val, int val_len)
switch (token)
{
case TOK_PATHNAME:
strncpy(val, rs->ampport.pathname, val_len-1);
strncpy(val, rs->ampport.pathname, val_len - 1);
break;
case TOK_WRITE_DELAY:
@ -428,7 +428,7 @@ int frontamp_get_conf2(AMP *amp, token_t token, char *val, int val_len)
return -RIG_EINVAL;
}
strncpy(val, s, val_len-1);
strncpy(val, s, val_len - 1);
break;
case TOK_HANDSHAKE:

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