free(device_names[i]);
}
-hw_init_free_serial_params:
g_free(serial_params);
hw_init_free_device_names:
g_free(device_names);
return SR_OK;
}
-static void hw_closedev(int device_index)
+static int hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
- return;
+ if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ sr_err("ols: %s: sdi was NULL", __func__);
+ return SR_ERR; /* TODO: SR_ERR_ARG? */
+ }
+ /* TODO */
if (sdi->serial->fd != -1) {
serial_close(sdi->serial->fd);
sdi->serial->fd = -1;
sdi->status = SR_ST_INACTIVE;
}
+
+ return SR_OK;
}
static void hw_cleanup(void)
}
struct sr_device_plugin ols_plugin_info = {
- "ols",
- "Openbench Logic Sniffer",
- 1,
- hw_init,
- hw_cleanup,
- hw_opendev,
- hw_closedev,
- hw_get_device_info,
- hw_get_status,
- hw_get_capabilities,
- hw_set_configuration,
- hw_start_acquisition,
- hw_stop_acquisition,
+ .name = "ols",
+ .longname = "Openbench Logic Sniffer",
+ .api_version = 1,
+ .init = hw_init,
+ .cleanup = hw_cleanup,
+ .opendev = hw_opendev,
+ .closedev = hw_closedev,
+ .get_device_info = hw_get_device_info,
+ .get_status = hw_get_status,
+ .get_capabilities = hw_get_capabilities,
+ .set_configuration = hw_set_configuration,
+ .start_acquisition = hw_start_acquisition,
+ .stop_acquisition = hw_stop_acquisition,
};