X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fsysclk-lwla%2Fapi.c;h=da2019fba31eb51fbc44b82d1a37cae4309168c5;hb=093e1cba6b7bf14cfb77fa36f59b0c16e6fca7cc;hp=0a614f9dbc4023f2a0f44780efd0f8cd10565731;hpb=efa9840222f2925c187715377e3646679fd8496c;p=libsigrok.git diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 0a614f9d..da2019fb 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -61,13 +61,6 @@ static const char *const signal_edge_names[] = { [EDGE_NEGATIVE] = "f", }; -/* Initialize the SysClk LWLA driver. - */ -static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) -{ - return std_init(sr_ctx, di, LOG_PREFIX); -} - /* Create a new sigrok device instance for the indicated LWLA model. */ static struct sr_dev_inst *dev_inst_new(const struct model_info *model) @@ -201,15 +194,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; /* no match */ /* Register device instance with driver. */ - sdi->driver = di; - drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); } libusb_free_device_list(devlist, 1); g_slist_free_full(conn_devices, (GDestroyNotify)&sr_usb_dev_inst_free); - return devices; + return std_scan_complete(di, devices); } /* Destroy the private device context. @@ -352,10 +343,6 @@ static int dev_close(struct sr_dev_inst *sdi) devc = sdi->priv; usb = sdi->conn; - if (sdi->status == SR_ST_INACTIVE) { - sr_dbg("Device already closed."); - return SR_OK; - } if (devc->acquisition) { sr_err("Cannot close device during acquisition!"); /* Request stop, leak handle, and prepare for the worst. */ @@ -654,9 +641,6 @@ static int config_commit(const struct sr_dev_inst *sdi) devc = sdi->priv; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - if (devc->acquisition) { sr_err("Acquisition still in progress?"); return SR_ERR; @@ -752,11 +736,6 @@ static int config_list(uint32_t key, GVariant **data, */ static int dev_acquisition_start(const struct sr_dev_inst *sdi) { - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - - sr_info("Starting acquisition."); - return lwla_start_acquisition(sdi); } @@ -768,12 +747,9 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) devc = sdi->priv; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - if (devc->state != STATE_IDLE && !devc->cancel_requested) { devc->cancel_requested = TRUE; - sr_dbg("Stopping acquisition."); + sr_dbg("Requesting cancel."); } return SR_OK; @@ -781,11 +757,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) /* SysClk LWLA driver descriptor. */ -SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = { +static struct sr_dev_driver sysclk_lwla_driver_info = { .name = "sysclk-lwla", .longname = "SysClk LWLA series", .api_version = 1, - .init = init, + .init = std_init, .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, @@ -801,3 +777,4 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(sysclk_lwla_driver_info);