From: Bert Vermeulen Date: Sun, 5 Aug 2012 13:53:04 +0000 (+0200) Subject: sr: new API call sr_dev_config_set() X-Git-Tag: dsupstream~726 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a56f1480949e84e94dad2afcdf9f758988a4aff9;p=libsigrok.git sr: new API call sr_dev_config_set() This is a wrapper around the driver dev_config_set() call, to avoid frontends needing visibility into drivers. --- diff --git a/device.c b/device.c index cbb38534..21ddebca 100644 --- 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 ba158c23..ce61d009 100644 --- 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 --------------------------------------------------------------*/