]> sigrok.org Git - libsigrok.git/commitdiff
sr: new API call sr_dev_config_set()
authorBert Vermeulen <redacted>
Sun, 5 Aug 2012 13:53:04 +0000 (15:53 +0200)
committerBert Vermeulen <redacted>
Sun, 5 Aug 2012 13:53:04 +0000 (15:53 +0200)
This is a wrapper around the driver dev_config_set() call, to avoid
frontends needing visibility into drivers.

device.c
proto.h

index cbb3853443041c6a4b1316e9907763d944faa8f9..21ddebca47128f9855e76859498864626f921332 100644 (file)
--- a/device.c
+++ b/device.c
@@ -276,3 +276,17 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
        g_free(serial->port);
 }
 
+SR_API int sr_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+               const void *value)
+{
+       int ret;
+
+       if (!sdi || !sdi->driver || !sdi->driver->dev_config_set) {
+               sr_err("hwdriver: unable to set config option");
+               return SR_ERR;
+       }
+
+       ret = sdi->driver->dev_config_set(sdi, hwcap, value);
+
+       return ret;
+}
diff --git a/proto.h b/proto.h
index ba158c2329a427f9c153a2202f09017e61ccc032..ce61d009483fcbcc3d3073c377433ec8c67c0106 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -54,6 +54,8 @@ SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
 SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum,
                const char *trigger);
 SR_API gboolean sr_dev_has_hwcap(const struct sr_dev_inst *sdi, int hwcap);
+SR_API int sr_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+               const void *value);
 
 /*--- filter.c --------------------------------------------------------------*/