+ if (devc->acquisition_running) {
+ end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
+ if (!g_cond_wait_until(&devc->voltage_cond,
+ &devc->acquisition_mutex, end_time)) {
+ /* Timeout has passed. */
+ g_mutex_unlock(&devc->acquisition_mutex);
+ return SR_ERR;
+ }
+ } else {
+ /* Reply: "read <current> <voltage>". */
+ tokens = g_strsplit((const char *)&buf, " ", 3);
+ devc->voltage = g_ascii_strtod(tokens[2], NULL) / 1000;
+ devc->current = g_ascii_strtod(tokens[1], NULL) / 1000;
+ g_strfreev(tokens);
+ }
+ g_mutex_unlock(&devc->acquisition_mutex);