sdi->conn = scpi;
sdi->driver = di;
sdi->inst_type = SR_INST_SCPI;
+ sdi->serial_num = g_strdup(hw_info->serial_number);
+
+ sr_scpi_hw_info_free(hw_info);
+ hw_info = NULL;
+
devc = g_malloc0(sizeof(struct dev_context));
devc->device = device;
sdi->priv = devc;
static int dev_open(struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
+ GVariant *beeper;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
sdi->status = SR_ST_ACTIVE;
scpi_cmd(sdi, SCPI_CMD_REMOTE);
+ devc = sdi->priv;
+ devc->beeper_was_set = FALSE;
+ if (scpi_cmd_resp(sdi, &beeper, G_VARIANT_TYPE_BOOLEAN, SCPI_CMD_BEEPER) == SR_OK) {
+ if (g_variant_get_boolean(beeper)) {
+ devc->beeper_was_set = TRUE;
+ scpi_cmd(sdi, SCPI_CMD_BEEPER_DISABLE);
+ }
+ g_variant_unref(beeper);
+ }
return SR_OK;
}
static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_scpi_dev_inst *scpi;
+ struct dev_context *devc;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
+ devc = sdi->priv;
scpi = sdi->conn;
if (scpi) {
+ if (devc->beeper_was_set)
+ scpi_cmd(sdi, SCPI_CMD_BEEPER_ENABLE);
scpi_cmd(sdi, SCPI_CMD_LOCAL);
sr_scpi_close(scpi);
sdi->status = SR_ST_INACTIVE;
static int cleanup(void)
{
- return SR_OK;
+ return std_dev_clear(di, NULL);
}
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
std_session_send_df_header(sdi, LOG_PREFIX);
/* Prime the pipe with the first channel's fetch. */
- ch = sdi->channels->data;
+ ch = next_enabled_channel(sdi, NULL);
pch = ch->priv;
- select_channel(sdi, ch);
+ if ((ret = select_channel(sdi, ch)) != SR_OK)
+ return ret;
if (pch->mq == SR_MQ_VOLTAGE)
cmd = SCPI_CMD_GET_MEAS_VOLTAGE;
else if (pch->mq == SR_MQ_CURRENT)
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
+ struct sr_datafeed_packet packet;
struct sr_scpi_dev_inst *scpi;
float f;
sr_scpi_get_float(scpi, NULL, &f);
sr_scpi_source_remove(sdi->session, scpi);
+ packet.type = SR_DF_END;
+ sr_session_send(sdi, &packet);
+
return SR_OK;
}