/* Function prototypes. */
static int la8_close_usb_reset_sequencer(struct la8 *la8);
-static void hw_stop_acquisition(int device_index, gpointer session_data);
+static int hw_stop_acquisition(int device_index, gpointer session_data);
static int la8_reset(struct la8 *la8);
static void fill_supported_samplerates_if_needed(void)
sr_dbg("la8: found device");
/* Register the device with libsigrok. */
- sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
+ sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
sr_err("la8: %s: sr_device_instance_new failed", __func__);
struct sr_device_instance *sdi;
struct la8 *la8;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
struct sr_device_instance *sdi;
struct la8 *la8;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
return SR_OK;
}
-static void hw_cleanup(void)
+static int hw_cleanup(void)
{
GSList *l;
struct sr_device_instance *sdi;
+ int ret = SR_OK;
sr_spew("la8: entering %s", __func__);
/* Properly close all devices. */
for (l = device_instances; l; l = l->next) {
- if ((sdi = l->data) == NULL) {
+ if (!(sdi = l->data)) {
+ /* Log error, but continue cleaning up the rest. */
sr_err("la8: %s: sdi was NULL, continuing", __func__);
+ ret = SR_ERR_BUG;
continue;
}
#if 0
sr_err("la8: %s: sdi->priv was NULL, nothing "
"to do", __func__);
#endif
- sr_device_instance_free(sdi); /* Returns void. */
+ sr_dev_inst_free(sdi); /* Returns void. */
}
g_slist_free(device_instances); /* Returns void. */
device_instances = NULL;
+
+ return ret;
}
static void *hw_get_device_info(int device_index, int device_info_id)
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return NULL;
}
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL, device not found", __func__);
return SR_ST_NOT_FOUND;
}
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
sr_spew("la8: entering %s", __func__);
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
return SR_OK;
}
-static void hw_stop_acquisition(int device_index, gpointer session_data)
+static int hw_stop_acquisition(int device_index, gpointer session_data)
{
struct sr_device_instance *sdi;
struct la8 *la8;
sr_dbg("la8: stopping acquisition");
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
- return;
+ return SR_ERR_BUG;
}
if (!(la8 = sdi->priv)) {
sr_err("la8: %s: sdi->priv was NULL", __func__);
- return;
+ return SR_ERR_BUG;
}
/* Send end packet to the session bus. */
sr_dbg("la8: %s: sending SR_DF_END", __func__);
packet.type = SR_DF_END;
sr_session_bus(session_data, &packet);
+
+ return SR_OK;
}
SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {