kopia lustrzana https://github.com/Hamlib/Hamlib
Revert read_string() to partial results are a success status
The read_string() function was changed to return a -RIG_ETIMEOUT error when timing out after having read some characters. This caused a back end to fail because it was using a read_string() with an invalid stop character and relying on the timed out read_string() to fetch the data. This patch reverts to the prior behavior of returning a null terminated buffer and read bytes count if at least one byte has been read.Hamlib-3.0
rodzic
6b2069af28
commit
82b8649030
|
@ -505,6 +505,7 @@ int HAMLIB_API read_string(hamlib_port_t *p, char *rxbuffer, size_t rxmax, const
|
||||||
|
|
||||||
retval = port_select(p, p->fd+1, &rfds, NULL, &efds, &tv);
|
retval = port_select(p, p->fd+1, &rfds, NULL, &efds, &tv);
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
|
if (0 == total_count) {
|
||||||
/* Record timeout time and caculate elapsed time */
|
/* Record timeout time and caculate elapsed time */
|
||||||
gettimeofday(&end_time, NULL);
|
gettimeofday(&end_time, NULL);
|
||||||
timersub(&end_time, &start_time, &elapsed_time);
|
timersub(&end_time, &start_time, &elapsed_time);
|
||||||
|
@ -515,6 +516,8 @@ int HAMLIB_API read_string(hamlib_port_t *p, char *rxbuffer, size_t rxmax, const
|
||||||
|
|
||||||
return -RIG_ETIMEOUT;
|
return -RIG_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
break; /* return what we have read */
|
||||||
|
}
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
dump_hex((unsigned char *) rxbuffer, total_count);
|
dump_hex((unsigned char *) rxbuffer, total_count);
|
||||||
|
|
Ładowanie…
Reference in New Issue