]> sigrok.org Git - libsigrok.git/blobdiff - device.c
ols: change driver dev_acquisition_start/_stop calls to use sdi
[libsigrok.git] / device.c
index e6372ff22cdcbbeb34f01a832c12b1556cd01cf3..be647fb248e7be173810a439fe543d41fb10d59a 100644 (file)
--- a/device.c
+++ b/device.c
@@ -273,6 +273,38 @@ SR_API int sr_dev_probe_name_set(struct sr_dev *dev, int probenum,
        return SR_OK;
 }
 
+/**
+ * Enable or disable a probe on the specified device.
+ *
+ * @param sdi The device instance the probe is connected to.
+ * @param probenum The probe number, starting from 0.
+ * @param state TRUE to enable the probe, FALSE to disable.
+ *
+ * @return SR_OK on success, or SR_ERR_ARG on invalid arguments.
+ */
+SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
+               gboolean state)
+{
+       GSList *l;
+       struct sr_probe *probe;
+       int ret;
+
+       if (!sdi)
+               return SR_ERR_ARG;
+
+       ret = SR_ERR_ARG;
+       for (l = sdi->probes; l; l = l->next) {
+               probe = l->data;
+               if (probe->index == probenum) {
+                       probe->enabled = state;
+                       ret = SR_OK;
+                       break;
+               }
+       }
+
+       return ret;
+}
+
 /**
  * Remove all triggers set up for the specified device.
  *