- ret = sr_filter_probes(sample_size, unitsize, logic_probelist,
- logic->data, logic->length,
- &filter_out, &filter_out_len);
- if (ret != SR_OK)
- break;
-
- /*
- * What comes out of the filter is guaranteed to be packed into the
- * minimum size needed to support the number of samples at this sample
- * size. however, the driver may have submitted too much. Cut off
- * the buffer of the last packet according to the sample limit.
- */
- if (limit_samples && (received_samples + logic->length / sample_size >
- limit_samples * sample_size))
- filter_out_len = limit_samples * sample_size - received_samples;
+ end_sample = received_samples + logic->length / logic->unitsize;
+ /* Cut off last packet according to the sample limit. */
+ if (limit_samples && end_sample > limit_samples)
+ end_sample = limit_samples;
+ input_len = (end_sample - received_samples) * logic->unitsize;