X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fikalogic-scanaplus%2Fapi.c;h=fc54ae431a3dc4d4febf7b3d364aa45ad79c1e25;hb=cd0de200b17820975637ddafba8a68902648344e;hp=3111f53eb713ffc04008effa0a73cd01d5dabaab;hpb=c2fdcc25a47c4c8f25e3ea96ea36a674a151e839;p=libsigrok.git diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index 3111f53e..fc54ae43 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -44,8 +44,6 @@ static const char *channel_names[] = { /* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */ static const uint64_t samplerates[1] = { SR_MHZ(100) }; -SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info; - static int dev_acquisition_stop(struct sr_dev_inst *sdi); static void clear_helper(void *priv) @@ -68,18 +66,12 @@ static int dev_clear(const struct sr_dev_driver *di) static GSList *scan(struct sr_dev_driver *di, GSList *options) { struct sr_dev_inst *sdi; - struct drv_context *drvc; struct dev_context *devc; - GSList *devices; unsigned int i; int ret; (void)options; - drvc = di->context; - - devices = NULL; - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); @@ -114,22 +106,18 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); - sdi->status = SR_ST_INITIALIZING; + sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(USB_VENDOR_NAME); sdi->model = g_strdup(USB_MODEL_NAME); - sdi->driver = di; sdi->priv = devc; for (i = 0; i < ARRAY_SIZE(channel_names); i++) sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); - devices = g_slist_append(devices, sdi); - drvc->instances = g_slist_append(drvc->instances, sdi); - /* Close device. We'll reopen it again when we need it. */ scanaplus_close(devc); - return devices; + return std_scan_complete(di, g_slist_append(NULL, sdi)); scanaplus_close(devc); err_free_ftdic: @@ -378,7 +366,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = { +static struct sr_dev_driver ikalogic_scanaplus_driver_info = { .name = "ikalogic-scanaplus", .longname = "IKALOGIC ScanaPLUS", .api_version = 1, @@ -396,3 +384,4 @@ SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(ikalogic_scanaplus_driver_info);