]> sigrok.org Git - libsigrok.git/blobdiff - hardware/link-mso19/api.c
Factor out common hw_init() driver code.
[libsigrok.git] / hardware / link-mso19 / api.c
index 77faf08b79fd4ed2d4918f27b28a9a905e0619bd..9fcb9cf81f49d3a9ce32c89562b29620a3f1f81c 100644 (file)
@@ -54,17 +54,7 @@ static struct sr_dev_driver *di = &link_mso19_driver_info;
 
 static int hw_init(struct sr_context *sr_ctx)
 {
-       struct drv_context *drvc;
-
-       if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
-               sr_err("Driver context malloc failed.");
-               return SR_ERR_MALLOC;
-       }
-
-       drvc->sr_ctx = sr_ctx;
-       di->priv = drvc;
-
-       return SR_OK;
+       return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
 }
 
 static GSList *hw_scan(GSList *options)
@@ -303,9 +293,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
        struct dev_context *devc;
 
        switch (id) {
-       case SR_DI_HWCAPS:
-               *data = hwcaps;
-               break;
        case SR_CONF_SAMPLERATE:
                if (sdi) {
                        devc = sdi->priv;
@@ -392,6 +379,9 @@ static int config_list(int key, const void **data, const struct sr_dev_inst *sdi
        (void)sdi;
 
        switch (key) {
+       case SR_CONF_DEVICE_OPTIONS:
+               *data = hwcaps;
+               break;
        case SR_CONF_SAMPLERATE:
                *data = &samplerates;
                break;