X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzeroplus-logic-cube%2Fapi.c;h=547d8152c91d1a576f9d6cdcafe39f5b03655fa4;hb=15a5bfe4815f9991a9bb532c05d6244a1818a0e4;hp=23a2e69f986c75d88deffa0c4ec37bb7ea576d85;hpb=87629577fe803769bc8b4e7a2bc122785cf90c81;p=libsigrok.git diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 23a2e69f..547d8152 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -79,8 +79,6 @@ static const char *channel_names[] = { "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", }; -SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info; - /* * The hardware supports more samplerates than these, but these are the * options hardcoded into the vendor's Windows GUI. @@ -155,11 +153,6 @@ SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate) return SR_OK; } -static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) -{ - return std_init(sr_ctx, di, LOG_PREFIX); -} - static GSList *scan(struct sr_dev_driver *di, GSList *options) { struct sr_dev_inst *sdi; @@ -219,7 +212,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VENDOR_NAME); sdi->model = g_strdup(prof->model_name); - sdi->driver = di; sdi->serial_num = g_strdup(serial_num); sdi->connection_id = g_strdup(connection_id); @@ -245,7 +237,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) channel_names[j]); devices = g_slist_append(devices, sdi); - drvc->instances = g_slist_append(drvc->instances, sdi); sdi->inst_type = SR_INST_USB; sdi->conn = sr_usb_dev_inst_new( libusb_get_bus_number(devlist[i]), @@ -253,7 +244,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } libusb_free_device_list(devlist, 1); - return devices; + return std_scan_complete(di, devices); } static int dev_open(struct sr_dev_inst *sdi) @@ -385,10 +376,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!(devc = sdi->priv)) { - sr_err("%s: sdi->priv was NULL", __func__); - return SR_ERR_ARG; - } + devc = sdi->priv; switch (key) { case SR_CONF_SAMPLERATE: @@ -665,11 +653,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { +static struct sr_dev_driver zeroplus_logic_cube_driver_info = { .name = "zeroplus-logic-cube", .longname = "ZEROPLUS Logic Cube LAP-C series", .api_version = 1, - .init = init, + .init = std_init, .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, @@ -683,3 +671,4 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(zeroplus_logic_cube_driver_info);