X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkecheng-kc-330b%2Fapi.c;h=30bb1b2a578bb05996817dae2655cedcaf61253b;hb=d9251a2c9f1ca4380c27240ccca90c9f9ed46d3f;hp=b3fc1321fb70d6479245830a95edc47b1f06c4d3;hpb=c2fdcc25a47c4c8f25e3ea96ea36a674a151e839;p=libsigrok.git diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index b3fc1321..30bb1b2a 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -61,8 +61,6 @@ static const char *data_sources[] = { "Memory", }; -SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info; - static int scan_kecheng(struct sr_dev_driver *di, struct sr_usb_dev_inst *usb, char **model) { @@ -114,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))) { @@ -127,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"); @@ -145,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) @@ -189,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 @@ -394,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. */ @@ -417,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; } @@ -503,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, @@ -521,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);