+ start_us = g_get_monotonic_time();
+
+ check_idx = fill_idx = 0;
+ while (fill_idx < max_fill_idx) {
+ /*
+ * Read bytes individually. Lets callers continue to
+ * successfully process next RX data after first match.
+ * Run full loop bodies for empty or failed reception
+ * in an iteration, to have timeouts checked.
+ */
+ recv_len = serial_read_nonblocking(serial, &buf[fill_idx], 1);
+ if (recv_len > 0)
+ fill_idx += recv_len;
+
+ /* Dump receive data when (a minimum) size is reached. */
+ check_ptr = &buf[check_idx];
+ check_len = fill_idx - check_idx;
+ do_dump = check_len >= packet_size;
+ do_dump &= sr_log_loglevel_get() >= SR_LOG_SPEW;
+ if (do_dump) {
+ GString *text;