X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkecheng-kc-330b%2Fapi.c;h=30bb1b2a578bb05996817dae2655cedcaf61253b;hb=81eb36d640b364bf955fd26b2a3987c56e0a720f;hp=1cc84240fd8e9f4b768579dd36041f63885eb4a6;hpb=e32862ebccac5ae063abc68d9ce13a66ad46bb97;p=libsigrok.git diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 1cc84240..30bb1b2a 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -112,7 +112,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) (void)options; drvc = di->context; - drvc->instances = NULL; devices = NULL; if ((usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, USB_CONN))) { @@ -125,7 +124,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VENDOR); sdi->model = model; /* Already g_strndup()'d. */ - sdi->driver = di; sdi->inst_type = SR_INST_USB; sdi->conn = l->data; sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL"); @@ -143,14 +141,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* TODO: Set date/time? */ - drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); } g_slist_free(usb_devices); } else g_slist_free_full(usb_devices, g_free); - return devices; + return std_scan_complete(di, devices); } static int dev_open(struct sr_dev_inst *sdi) @@ -187,7 +184,7 @@ static int dev_close(struct sr_dev_inst *sdi) usb = sdi->conn; if (!usb->devhdl) - /* Nothing to do. */ + /* Nothing to do. */ return SR_OK; /* This allows a frontend to configure the device without ever @@ -392,7 +389,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->num_samples = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); if (devc->data_source == DATA_SOURCE_LIVE) { /* Force configuration. */ @@ -415,7 +412,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->stored_samples = (buf[7] << 8) | buf[8]; if (devc->stored_samples == 0) { /* Notify frontend of empty log by sending start/end packets. */ - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } @@ -501,7 +498,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = { +static struct sr_dev_driver kecheng_kc_330b_driver_info = { .name = "kecheng-kc-330b", .longname = "Kecheng KC-330B", .api_version = 1, @@ -519,3 +516,4 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(kecheng_kc_330b_driver_info);