+ if (ebd_current_is0(devc)) {
+ /* Stop load. */
+ ret = ebd_loadtoggle(sdi->conn, devc);
+ } else {
+ /* Send new current. */
+ ret = send_cfg(sdi->conn, devc);
+ }
+ } else {
+ if (ebd_current_is0(devc)) {
+ /* Nothing to do. */
+ ret = SR_OK;
+ } else {
+ /* Start load. */
+ ret = ebd_loadstart(sdi->conn, devc);
+ }
+ }
+
+ g_mutex_unlock(&devc->rw_mutex);
+
+ return ret;
+}
+
+SR_PRIV int ebd_get_uvc_threshold(const struct sr_dev_inst *sdi, float *voltage)
+{
+ struct dev_context *devc;
+
+ if (!(devc = sdi->priv))
+ return SR_ERR;
+
+ g_mutex_lock(&devc->rw_mutex);
+ *voltage = devc->uvc_threshold;
+ g_mutex_unlock(&devc->rw_mutex);
+
+ return SR_OK;
+}
+
+SR_PRIV int ebd_set_uvc_threshold(const struct sr_dev_inst *sdi, float voltage)
+{
+ struct dev_context *devc;
+ int ret;
+
+ if (!(devc = sdi->priv))
+ return SR_ERR;
+
+ g_mutex_lock(&devc->rw_mutex);
+ devc->uvc_threshold = voltage;
+
+ if (!devc->running) {
+ sr_dbg("Setting uvc threshold later.");
+ g_mutex_unlock(&devc->rw_mutex);
+ return SR_OK;
+ }
+
+ sr_dbg("Setting uvc threshold to %fV.", voltage);
+
+ if (devc->load_activated) {
+ if (ebd_current_is0(devc)) {