static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
void *cb_data);
-static void clear_instances(void)
+static int clear_instances(void)
{
GSList *l;
struct sr_dev_inst *sdi;
if (sdi->priv) {
devc = sdi->priv;
ftdi_free(devc->ftdic);
- g_free(devc);
}
sr_dev_inst_free(sdi);
}
g_slist_free(drvc->instances);
drvc->instances = NULL;
+ return SR_OK;
}
static int hw_init(void)
return NULL;
}
+static GSList *hw_dev_list(void)
+{
+ struct drv_context *drvc;
+
+ drvc = cdi->priv;
+
+ return drvc->instances;
+}
+
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
if (sdi->status == SR_ST_ACTIVE) {
sr_dbg("la8: Status ACTIVE, closing device.");
- /* TODO: Really ignore errors here, or return SR_ERR? */
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
} else {
sr_spew("la8: Status not ACTIVE, nothing to do.");
}
sr_dbg("la8: SAMPLERATE = %" PRIu64, devc->cur_samplerate);
break;
- case SR_HWCAP_PROBECONFIG:
- if (configure_probes(devc, (const GSList *)value) != SR_OK) {
- sr_err("la8: %s: probe config failed.", __func__);
- return SR_ERR;
- }
- break;
case SR_HWCAP_LIMIT_MSEC:
if (*(const uint64_t *)value == 0) {
sr_err("la8: %s: LIMIT_MSEC can't be 0.", __func__);
hw_dev_acquisition_stop(sdi, sdi);
- // return FALSE; /* FIXME? */
return TRUE;
}
return SR_ERR;
}
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("chronovu-la8: failed to configured probes");
+ return SR_ERR;
+ }
+
sr_dbg("la8: Starting acquisition.");
/* Fill acquisition parameters into buf[]. */
return SR_ERR;
} else if (bytes_written != 4) {
sr_err("la8: Acquisition failed to start.");
- return SR_ERR; /* TODO: Other error and return code? */
+ return SR_ERR;
}
sr_dbg("la8: Acquisition started successfully.");
static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
void *cb_data)
{
- struct dev_context *devc;
struct sr_datafeed_packet packet;
- sr_dbg("la8: Stopping acquisition.");
+ (void)sdi;
- if (!(devc = sdi->priv)) {
- sr_err("la8: %s: sdi->priv was NULL", __func__);
- return SR_ERR_BUG;
- }
+ sr_dbg("la8: Stopping acquisition.");
+ sr_source_remove(-1);
/* Send end packet to the session bus. */
sr_dbg("la8: Sending SR_DF_END.");
.init = hw_init,
.cleanup = hw_cleanup,
.scan = hw_scan,
+ .dev_list = hw_dev_list,
+ .dev_clear = clear_instances,
.dev_open = hw_dev_open,
.dev_close = hw_dev_close,
.info_get = hw_info_get,