/*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
*
* Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
* Copyright (C) 2011 Olivier Fauchon <olivier@aixmarseille.com>
{
(void)sdi;
- /* Nothing needed so far. */
+ sdi->status = SR_ST_ACTIVE;
return SR_OK;
}
{
(void)sdi;
- /* Nothing needed so far. */
+ sdi->status = SR_ST_INACTIVE;
return SR_OK;
}
struct dev_context *const devc = sdi->priv;
+ if (sdi->status != SR_ST_ACTIVE)
+ return SR_ERR_DEV_CLOSED;
+
if (id == SR_CONF_SAMPLERATE) {
devc->cur_samplerate = g_variant_get_uint64(data);
sr_dbg("%s: setting samplerate to %" PRIu64, __func__,
{
struct dev_context *const devc = sdi->priv;
+ if (sdi->status != SR_ST_ACTIVE)
+ return SR_ERR_DEV_CLOSED;
+
devc->cb_data = cb_data;
devc->samples_counter = 0;