The 'buflen' variable name could be misleading, as it's not the receive
buffer's size. Instead it is the amount of previously received response
data. Rename it to 'rdlen'.
* Don't send the request while receive data is being accumulated.
*/
devc = sdi->priv;
* Don't send the request while receive data is being accumulated.
*/
devc = sdi->priv;
- if (!force && devc->buflen)
+ if (!force && devc->rdlen)
float v;
devc = sdi->priv;
float v;
devc = sdi->priv;
- sr_spew("Received poll packet (len: %zu).", devc->buflen);
- if (devc->buflen < TC_POLL_LEN) {
- sr_err("Insufficient poll packet length: %zu", devc->buflen);
+ sr_spew("Received poll packet (len: %zu).", devc->rdlen);
+ if (devc->rdlen < TC_POLL_LEN) {
+ sr_err("Insufficient poll packet length: %zu", devc->rdlen);
/* Receive data became available. Drain the transport layer. */
devc = sdi->priv;
/* Receive data became available. Drain the transport layer. */
devc = sdi->priv;
- while (devc->buflen < TC_POLL_LEN) {
- space = sizeof(devc->buf) - devc->buflen;
+ while (devc->rdlen < TC_POLL_LEN) {
+ space = sizeof(devc->buf) - devc->rdlen;
len = serial_read_nonblocking(serial,
len = serial_read_nonblocking(serial,
- &devc->buf[devc->buflen], space);
+ &devc->buf[devc->rdlen], space);
if (len < 0)
return SR_ERR_IO;
if (len == 0)
return SR_OK;
if (len < 0)
return SR_ERR_IO;
if (len == 0)
return SR_OK;
*/
/* Process packets when their reception has completed. */
*/
/* Process packets when their reception has completed. */
- while (devc->buflen >= TC_POLL_LEN) {
+ while (devc->rdlen >= TC_POLL_LEN) {
ret = handle_poll_data(sdi);
if (ret != SR_OK)
return ret;
ret = handle_poll_data(sdi);
if (ret != SR_OK)
return ret;
- devc->buflen -= TC_POLL_LEN;
- if (devc->buflen)
- memmove(&devc->buf[0], &devc->buf[TC_POLL_LEN], devc->buflen);
+ devc->rdlen -= TC_POLL_LEN;
+ if (devc->rdlen)
+ memmove(devc->buf, &devc->buf[TC_POLL_LEN], devc->rdlen);
struct feed_queue_analog **feeds;
struct sr_sw_limits limits;
uint8_t buf[RDTECH_TC_BUFSIZE];
struct feed_queue_analog **feeds;
struct sr_sw_limits limits;
uint8_t buf[RDTECH_TC_BUFSIZE];