struct sr_scpi_dev_inst *scpi;
GVariant *beeper;
- if (sdi->status != SR_ST_INACTIVE)
- return SR_ERR;
-
scpi = sdi->conn;
if (sr_scpi_open(scpi) < 0)
return SR_ERR;
- sdi->status = SR_ST_ACTIVE;
-
devc = sdi->priv;
scpi_cmd(sdi, devc->device->commands, SCPI_CMD_REMOTE);
devc->beeper_was_set = FALSE;
devc = sdi->priv;
scpi = sdi->conn;
- if (scpi) {
- if (devc->beeper_was_set)
- scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE);
- scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL);
- sr_scpi_close(scpi);
- sdi->status = SR_ST_INACTIVE;
- }
- return SR_OK;
+ if (!scpi)
+ return SR_ERR_BUG;
+
+ if (devc->beeper_was_set)
+ scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE);
+ scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL);
+
+ return sr_scpi_close(scpi);
}
-static void clear_helper(void *priv)
+static void clear_helper(struct dev_context *devc)
{
- struct dev_context *devc;
-
- devc = priv;
g_free(devc->channels);
g_free(devc->channel_groups);
- g_free(devc);
}
static int dev_clear(const struct sr_dev_driver *di)
{
- return std_dev_clear(di, clear_helper);
+ return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
}
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,