+ devc->num_frames++;
+
+ /* V5 has no way to read the number of recorded frames, so try to set the
+ * next frame and read it back instead.
+ */
+ if (devc->data_source == DATA_SOURCE_SEGMENTED &&
+ devc->model->series->protocol == PROTOCOL_V5) {
+ int frames = 0;
+ if (rigol_ds_config_set(sdi, "REC:CURR %d", devc->num_frames + 1) != SR_OK)
+ return SR_ERR;
+ if (sr_scpi_get_int(sdi->conn, "REC:CURR?", &frames) != SR_OK)
+ return SR_ERR;
+ devc->num_frames_segmented = frames;
+ }
+
+ if (devc->num_frames == devc->limit_frames ||