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;
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)