SR_PRIV struct sr_dev_driver ols_driver_info;
static struct sr_dev_driver *di = &ols_driver_info;
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_config *src;
struct sr_dev_inst *sdi;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int dev_clear(void)
{
- GSList *l;
- struct sr_dev_inst *sdi;
- struct drv_context *drvc;
- struct dev_context *devc;
- struct sr_serial_dev_inst *serial;
- int ret = SR_OK;
-
- if (!(drvc = di->priv))
- return SR_OK;
-
- /* Properly close and free all devices. */
- for (l = drvc->instances; l; l = l->next) {
- if (!(sdi = l->data)) {
- /* Log error, but continue cleaning up the rest. */
- sr_err("%s: sdi was NULL, continuing", __func__);
- ret = SR_ERR_BUG;
- continue;
- }
- if (!(devc = sdi->priv)) {
- /* Log error, but continue cleaning up the rest. */
- sr_err("%s: sdi->priv was NULL, continuing", __func__);
- ret = SR_ERR_BUG;
- continue;
- }
- hw_dev_close(sdi);
- serial = sdi->conn;
- sr_serial_dev_inst_free(serial);
- sr_dev_inst_free(sdi);
- }
- g_slist_free(drvc->instances);
- drvc->instances = NULL;
-
- return ret;
+ return std_dev_clear(di, NULL);
}
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
/* Avoid compiler warnings. */
(void)cb_data;
.name = "ols",
.longname = "Openbench Logic Sniffer",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
- .dev_clear = hw_cleanup,
+ .init = init,
+ .cleanup = dev_clear,
+ .scan = scan,
+ .dev_list = dev_list,
+ .dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};