X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhantek-dso%2Fapi.c;h=1604a18c682a2559fc62bde3fe4a269adb621825;hb=4b1a9d5d8641080bf10e269aa12a3fc17460365f;hp=8a2f42c5f7335864bcdccf70080616670dc86de8;hpb=e91bb0a6c4a94957e4e998ca134dc806bec49a7f;p=libsigrok.git diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 8a2f42c5..1604a18c 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -160,8 +160,6 @@ static const char *coupling[] = { "GND", }; -SR_PRIV struct sr_dev_driver hantek_dso_driver_info; - static int dev_acquisition_stop(struct sr_dev_inst *sdi); static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof) @@ -169,7 +167,6 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof) struct sr_dev_inst *sdi; struct sr_channel *ch; struct sr_channel_group *cg; - struct drv_context *drvc; struct dev_context *devc; unsigned int i; @@ -177,7 +174,6 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof) sdi->status = SR_ST_INITIALIZING; sdi->vendor = g_strdup(prof->vendor); sdi->model = g_strdup(prof->model); - sdi->driver = &hantek_dso_driver_info; /* * Add only the real channels -- EXT isn't a source of data, only @@ -209,8 +205,6 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof) devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE); devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS; sdi->priv = devc; - drvc = hantek_dso_driver_info.context; - drvc->instances = g_slist_append(drvc->instances, sdi); return sdi; } @@ -254,11 +248,6 @@ static int dev_clear(const struct sr_dev_driver *di) return std_dev_clear(di, clear_dev_context); } -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 drv_context *drvc; @@ -355,7 +344,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) @@ -873,7 +862,7 @@ static int handle_event(int fd, int revents, void *cb_data) */ usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); devc->dev_state = IDLE; @@ -982,7 +971,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->dev_state = CAPTURE; usb_source_add(sdi->session, drvc->sr_ctx, TICK, handle_event, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); return SR_OK; } @@ -1000,11 +989,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { +static struct sr_dev_driver hantek_dso_driver_info = { .name = "hantek-dso", .longname = "Hantek DSO", .api_version = 1, - .init = init, + .init = std_init, .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, @@ -1018,3 +1007,4 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(hantek_dso_driver_info);