kopia lustrzana https://github.com/Hamlib/Hamlib
Allow generic_read_string to terminate on expected_len
https://github.com/Hamlib/Hamlib/issues/1303pull/1330/head
rodzic
77d9d11f92
commit
00b6e0ecd7
|
@ -1336,12 +1336,11 @@ static int read_string_generic(hamlib_port_t *p,
|
||||||
memset(rxbuffer, 0, rxmax);
|
memset(rxbuffer, 0, rxmax);
|
||||||
|
|
||||||
short timeout_retries = p->timeout_retry;
|
short timeout_retries = p->timeout_retry;
|
||||||
while (total_count < rxmax - 1) // allow 1 byte for end-of-string
|
while ( total_count < expected_len && total_count < rxmax - 1) // allow 1 byte for end-of-string
|
||||||
{
|
{
|
||||||
ssize_t rd_count = 0;
|
ssize_t rd_count = 0;
|
||||||
int result;
|
int result;
|
||||||
result = port_wait_for_data(p, direct);
|
result = port_wait_for_data(p, direct);
|
||||||
|
|
||||||
if (result == -RIG_ETIMEOUT)
|
if (result == -RIG_ETIMEOUT)
|
||||||
{
|
{
|
||||||
if (timeout_retries > 0)
|
if (timeout_retries > 0)
|
||||||
|
|
Ładowanie…
Reference in New Issue