X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=device.c;h=434d1066aac692d7a8a6f732f80938cc02f7ff02;hp=d437b72d822171da2adce03b0c8ac9c7ddccbbcc;hb=43cd4637285833706f8a404ca027bcf0ee75b9ae;hpb=f3ca73edd29a48f8cc19755df629ab2bc9478eea diff --git a/device.c b/device.c index d437b72d..434d1066 100644 --- a/device.c +++ b/device.c @@ -23,7 +23,9 @@ #include "libsigrok.h" #include "libsigrok-internal.h" +/** @cond PRIVATE */ #define LOG_PREFIX "device" +/** @endcond */ /** * @file @@ -81,7 +83,7 @@ SR_PRIV struct sr_channel *sr_channel_new(int index, int type, * * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. * - * @since 0.2.0 + * @since 0.3.0 */ SR_API int sr_dev_channel_name_set(const struct sr_dev_inst *sdi, int channelnum, const char *name) @@ -120,7 +122,7 @@ SR_API int sr_dev_channel_name_set(const struct sr_dev_inst *sdi, * arguments, SR_ERR_ARG is returned and the channel enabled state * remains unchanged. * - * @since 0.2.0 + * @since 0.3.0 */ SR_API int sr_dev_channel_enable(const struct sr_dev_inst *sdi, int channelnum, gboolean state) @@ -155,62 +157,6 @@ SR_API int sr_dev_channel_enable(const struct sr_dev_inst *sdi, int channelnum, return ret; } -/** - * Add a trigger to the specified device (and the specified channel). - * - * If the specified channel of this device already has a trigger, it will - * be silently replaced. - * - * @param[in,out] sdi Pointer to the device instance; must not be NULL. - * @param[in] channelnum Number of channel, starting at 0. - * @param[in] trigger Trigger string, in the format used by sigrok-cli - * - * @return SR_OK on success or SR_ERR on failure. In case of invalid - * arguments, SR_ERR_ARG is returned and the trigger settings - * remain unchanged. - * - * @since 0.2.0 - */ -SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int channelnum, - const char *trigger) -{ - GSList *l; - struct sr_channel *ch; - char *old_trigger; - int ret; - - if (!sdi) - return SR_ERR_ARG; - - ret = SR_ERR_ARG; - for (l = sdi->channels; l; l = l->next) { - ch = l->data; - if (ch->index == channelnum) { - old_trigger = ch->trigger; - ret = SR_OK; - if (g_strcmp0(trigger, old_trigger) == 0) - break; - /* Set new trigger if it has changed. */ - ch->trigger = g_strdup(trigger); - - if (sdi->driver && sdi->driver->config_channel_set) { - ret = sdi->driver->config_channel_set( - sdi, ch, SR_CHANNEL_SET_TRIGGER); - /* Roll back change if it wasn't applicable. */ - if (ret == SR_ERR_ARG) { - g_free(ch->trigger); - ch->trigger = old_trigger; - break; - } - } - g_free(old_trigger); - break; - } - } - - return ret; -} - /** * Determine whether the specified device instance has the specified * capability. @@ -286,6 +232,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status, sdi->version = version ? g_strdup(version) : NULL; sdi->channels = NULL; sdi->channel_groups = NULL; + sdi->session = NULL; sdi->conn = NULL; sdi->priv = NULL; @@ -304,7 +251,6 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) for (l = sdi->channels; l; l = l->next) { ch = l->data; g_free(ch->name); - g_free(ch->trigger); g_free(ch); } g_slist_free(sdi->channels);