]> sigrok.org Git - libsigrok.git/blobdiff - hardware/tondaj-sl-814/api.c
sr_driver_scan(): Improve checks.
[libsigrok.git] / hardware / tondaj-sl-814 / api.c
index 7f6066310147d04eea938ff69533422202dac9f0..c621eeb8cf3042033c3fe21ac628447b89fd0014 100644 (file)
@@ -93,10 +93,11 @@ static GSList *hw_scan(GSList *options)
        GSList *devices, *l;
        const char *conn, *serialcomm;
 
-       devices = NULL;
        drvc = di->priv;
        drvc->instances = NULL;
 
+       devices = NULL;
+
        conn = serialcomm = NULL;
        for (l = options; l; l = l->next) {
                if (!(src = l->data)) {
@@ -195,21 +196,6 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
-{
-       (void)sdi;
-
-       switch (id) {
-       case SR_DI_HWOPTS:
-               *data = hwopts;
-               break;
-       default:
-               return SR_ERR_ARG;
-       }
-
-       return SR_OK;
-}
-
 static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -241,6 +227,9 @@ static int config_list(int key, const void **data, const struct sr_dev_inst *sdi
        (void)sdi;
 
        switch (key) {
+       case SR_CONF_SCAN_OPTIONS:
+               *data = hwopts;
+               break;
        case SR_CONF_DEVICE_OPTIONS:
                *data = hwcaps;
                break;
@@ -318,7 +307,6 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
-       .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
        .dev_open = hw_dev_open,