return sr_scpi_scan(di->context, options, probe_usbtmc_device);
}
-static void clear_helper(void *priv)
+static void clear_helper(struct dev_context *devc)
{
- struct dev_context *devc;
-
- devc = priv;
-
dlm_scope_state_destroy(devc->model_state);
-
g_free(devc->analog_groups);
g_free(devc->digital_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 dev_open(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE && sr_scpi_open(sdi->conn) != SR_OK)
+ if (sr_scpi_open(sdi->conn) != SR_OK)
return SR_ERR;
if (dlm_scope_state_query(sdi) != SR_OK)
return SR_ERR;
- sdi->status = SR_ST_ACTIVE;
-
return SR_OK;
}
static int dev_close(struct sr_dev_inst *sdi)
{
- if (sdi->status == SR_ST_INACTIVE)
- return SR_OK;
-
- sr_scpi_close(sdi->conn);
-
- sdi->status = SR_ST_INACTIVE;
-
- return SR_OK;
+ return sr_scpi_close(sdi->conn);
}
/**
struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
devc = sdi->priv;
digital_added = FALSE;
std_session_send_df_end(sdi);
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->num_frames = 0;