static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- struct drv_context *drvc;
- GSList *devices, *l;
+ GSList *l;
struct sr_config *src;
struct sr_dev_inst *sdi;
struct dev_context *devc;
int i, maxch;
- devices = NULL;
- drvc = di->context;
- drvc->instances = NULL;
-
/* Probe for /dev/beaglelogic */
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
return NULL;
sdi->status = SR_ST_INACTIVE;
sdi->model = g_strdup("BeagleLogic");
sdi->version = g_strdup("1.0");
- sdi->driver = di;
/* Unless explicitly specified, keep max channels to 8 only */
maxch = 8;
channel_names[i]);
sdi->priv = devc;
- drvc->instances = g_slist_append(drvc->instances, sdi);
- devices = g_slist_append(devices, sdi);
- return devices;
+ return std_scan_complete(di, g_slist_append(NULL, sdi));
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
- if (sdi->status == SR_ST_ACTIVE) {
- /* Close the memory mapping and the file */
- beaglelogic_munmap(devc);
- beaglelogic_close(devc);
- }
+ /* Close the memory mapping and the file */
+ beaglelogic_munmap(devc);
+ beaglelogic_close(devc);
+
sdi->status = SR_ST_INACTIVE;
+
return SR_OK;
}
(void)cg;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
switch (key) {
case SR_CONF_SAMPLERATE:
devc->cur_samplerate = g_variant_get_uint64(data);
struct dev_context *devc = sdi->priv;
struct sr_trigger *trigger;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Clear capture state */
devc->bytes_read = 0;
devc->offset = 0;
devc->trigger_fired = FALSE;
} else
devc->trigger_fired = TRUE;
- std_session_send_df_header(sdi, LOG_PREFIX);
+ std_session_send_df_header(sdi);
/* Trigger and add poll on file */
beaglelogic_start(devc);
{
struct dev_context *devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Execute a stop on BeagleLogic */
beaglelogic_stop(devc);
/* Remove session source and send EOT packet */
sr_session_source_remove_pollfd(sdi->session, &devc->pollfd);
- std_session_send_df_end(sdi, LOG_PREFIX);
+ std_session_send_df_end(sdi);
return SR_OK;
}