- if (!devc->acquisition_running) {
- /* Hardware sends current in mA, integer (0..6000). */
- *current = g_ascii_strtod(buf + 4, NULL) / 1000;
+ if (devc->acquisition_running) {
+ end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
+ if (!g_cond_wait_until(&devc->current_limit_cond,
+ &devc->acquisition_mutex, end_time)) {
+ /* Timeout has passed. */
+ g_mutex_unlock(&devc->acquisition_mutex);
+ return SR_ERR;
+ }
+ } else {
+ /* Hardware sends current limit in mA, integer (0..6000). */
+ devc->current_limit = g_ascii_strtod(buf + 4, NULL) / 1000;