]> sigrok.org Git - libsigrok.git/commitdiff
drivers: rename and reorganize config get/set
authorBert Vermeulen <redacted>
Thu, 24 Jan 2013 18:19:09 +0000 (19:19 +0100)
committerBert Vermeulen <redacted>
Thu, 24 Jan 2013 18:19:09 +0000 (19:19 +0100)
The driver API calls info_get() and dev_config_set() have been renamed
to config_get() and config_set(), respectively.

32 files changed:
backend.c
device.c
hardware/agilent-dmm/api.c
hardware/alsa/api.c
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/api.c
hardware/colead-slm/api.c
hardware/demo/demo.c
hardware/fluke-dmm/api.c
hardware/fx2lafw/fx2lafw.c
hardware/hantek-dso/api.c
hardware/lascar-el-usb/api.c
hardware/link-mso19/api.c
hardware/nexus-osciprime/api.c
hardware/openbench-logic-sniffer/api.c
hardware/rigol-ds1xx2/api.c
hardware/serial-dmm/api.c
hardware/tondaj-sl-814/api.c
hardware/uni-t-dmm/api.c
hardware/victor-dmm/api.c
hardware/zeroplus-logic-cube/zeroplus.c
hwdriver.c
libsigrok.h
output/chronovu_la8.c
output/csv.c
output/gnuplot.c
output/ols.c
output/text/text.c
output/vcd.c
session_driver.c
session_file.c
strutil.c

index 9c2796942b29cb2bf9b72b560f2d91d3d7f068ee..4d39502d399eb5386aa34f6b498d7c99de2722a9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -173,12 +173,12 @@ static int sanity_check_all_drivers(void)
                        sr_err("No dev_close in driver %d ('%s').", i, d);
                        errors++;
                }
-               if (!drivers[i]->info_get) {
-                       sr_err("No info_get in driver %d ('%s').", i, d);
+               if (!drivers[i]->config_get) {
+                       sr_err("No config_get in driver %d ('%s').", i, d);
                        errors++;
                }
-               if (!drivers[i]->dev_config_set) {
-                       sr_err("No dev_config_set in driver %d ('%s').", i, d);
+               if (!drivers[i]->config_set) {
+                       sr_err("No config_set in driver %d ('%s').", i, d);
                        errors++;
                }
                if (!drivers[i]->dev_acquisition_start) {
index fc8477a1cec894a89a392c59403846c38e5ff2bd..a5c8c509bae914b5909ba37c323cfc17202449e6 100644 (file)
--- a/device.c
+++ b/device.c
@@ -198,7 +198,7 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev_inst *sdi, int hwcap)
        if (!sdi || !sdi->driver)
                return FALSE;
 
-       if (sdi->driver->info_get(SR_DI_HWCAPS,
+       if (sdi->driver->config_get(SR_DI_HWCAPS,
                        (const void **)&hwcaps, NULL) != SR_OK)
                return FALSE;
 
@@ -334,12 +334,12 @@ SR_API int sr_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 {
        int ret;
 
-       if (!sdi || !sdi->driver || !sdi->driver->dev_config_set) {
+       if (!sdi || !sdi->driver || !sdi->driver->config_set) {
                sr_err("Unable to set config option.");
                return SR_ERR;
        }
 
-       ret = sdi->driver->dev_config_set(sdi, hwcap, value);
+       ret = sdi->driver->config_set(hwcap, value, sdi);
 
        return ret;
 }
index 9d401c7e51734f9a8c10bf659dffe7fb32f08704..afd267017b8981ef597db3fcabf56666b153fb28 100644 (file)
@@ -247,12 +247,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -266,8 +265,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -279,7 +277,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_BUG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_MSEC:
                /* TODO: not yet implemented */
                if (*(const uint64_t *)value == 0) {
@@ -296,7 +294,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
                break;
        }
@@ -370,10 +368,10 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 227132474ae79ea8c473858131b327f2abf43ea1..4349bc813196660fc64d4118b4004125806ab798 100644 (file)
@@ -140,15 +140,14 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       if (info_id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */
+       if (id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */
                devc = sdi->priv;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -169,14 +168,13 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
        devc = sdi->priv;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                alsa_set_samplerate(sdi, *(const uint64_t *)value);
                break;
@@ -184,7 +182,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                devc->limit_samples = *(const uint64_t *)value;
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
        }
 
@@ -322,10 +320,10 @@ SR_PRIV struct sr_dev_driver alsa_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 828121ae121bb6614aaa813904e79ce15e462f06..3356fb23f3bdd2dddf961761c446003235b391ba 100644 (file)
@@ -787,12 +787,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -816,23 +815,22 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        int ret;
 
        devc = sdi->priv;
 
-       if (hwcap == SR_CONF_SAMPLERATE) {
+       if (id == SR_CONF_SAMPLERATE) {
                ret = set_samplerate(sdi, *(const uint64_t *)value);
-       } else if (hwcap == SR_CONF_LIMIT_MSEC) {
+       } else if (id == SR_CONF_LIMIT_MSEC) {
                devc->limit_msec = *(const uint64_t *)value;
                if (devc->limit_msec > 0)
                        ret = SR_OK;
                else
                        ret = SR_ERR;
-       } else if (hwcap == SR_CONF_CAPTURE_RATIO) {
+       } else if (id == SR_CONF_CAPTURE_RATIO) {
                devc->capture_ratio = *(const uint64_t *)value;
                if (devc->capture_ratio < 0 || devc->capture_ratio > 100)
                        ret = SR_ERR;
@@ -1438,10 +1436,10 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 08dec08e388dda7bc96c4d52bf07170e20df8e36..cd6eca5fc30eb61de9ab3f6ea81db9f0f548c4c0 100644 (file)
@@ -288,12 +288,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -323,8 +322,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -333,7 +331,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_BUG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
                        sr_err("%s: setting samplerate failed.", __func__);
@@ -359,7 +357,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                break;
        default:
                /* Unknown capability, return SR_ERR. */
-               sr_err("%s: Unknown capability: %d.", __func__, hwcap);
+               sr_err("%s: Unknown capability: %d.", __func__, id);
                return SR_ERR;
                break;
        }
@@ -514,10 +512,10 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index d04ff9eb41cdfc85e7320049f7c2d8f99dbb3c7d..5d350ec5fcf98d9067da2a03903372c5001cc456 100644 (file)
@@ -191,12 +191,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -210,8 +209,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -223,7 +221,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_BUG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_MSEC:
                /* TODO: not yet implemented */
                if (*(const uint64_t *)value == 0) {
@@ -240,7 +238,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
                break;
        }
@@ -314,10 +312,10 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 850cf8a8ef533b53a686951d9fe09ef773b32c6f..d7d0719f22af544b72ebb69bc3a250e4495ec114 100644 (file)
@@ -226,12 +226,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -251,32 +250,31 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        int ret;
        const char *stropt;
 
        (void)sdi;
 
-       if (hwcap == SR_CONF_SAMPLERATE) {
+       if (id == SR_CONF_SAMPLERATE) {
                cur_samplerate = *(const uint64_t *)value;
                sr_dbg("%s: setting samplerate to %" PRIu64, __func__,
                       cur_samplerate);
                ret = SR_OK;
-       } else if (hwcap == SR_CONF_LIMIT_SAMPLES) {
+       } else if (id == SR_CONF_LIMIT_SAMPLES) {
                limit_msec = 0;
                limit_samples = *(const uint64_t *)value;
                sr_dbg("%s: setting limit_samples to %" PRIu64, __func__,
                       limit_samples);
                ret = SR_OK;
-       } else if (hwcap == SR_CONF_LIMIT_MSEC) {
+       } else if (id == SR_CONF_LIMIT_MSEC) {
                limit_msec = *(const uint64_t *)value;
                limit_samples = 0;
                sr_dbg("%s: setting limit_msec to %" PRIu64, __func__,
                       limit_msec);
                ret = SR_OK;
-       } else if (hwcap == SR_CONF_PATTERN_MODE) {
+       } else if (id == SR_CONF_PATTERN_MODE) {
                stropt = value;
                ret = SR_OK;
                if (!strcmp(stropt, "sigrok")) {
@@ -490,10 +488,10 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index adc1853c33573fed9e0b824e8919a906457c847f..1120bad1792ab225481d0b519690dbc1f390c633 100644 (file)
@@ -281,12 +281,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -300,8 +299,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -313,7 +311,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_BUG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_MSEC:
                /* TODO: not yet implemented */
                if (*(const uint64_t *)value == 0) {
@@ -330,7 +328,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
                break;
        }
@@ -410,10 +408,10 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 43f6f5254dad6fe48e61a17a5de96f6c85be99d5..46b65cb0947afa57c144715b8c37a447622dc18c 100644 (file)
@@ -127,8 +127,7 @@ static const struct sr_samplerates samplerates = {
 SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
 static struct sr_dev_driver *di = &fx2lafw_driver_info;
 static int hw_dev_close(struct sr_dev_inst *sdi);
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value);
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi);
 static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
 
 /**
@@ -561,8 +560,8 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
 
        if (devc->cur_samplerate == 0) {
                /* Samplerate hasn't been set; default to the slowest one. */
-               if (hw_dev_config_set(sdi, SR_CONF_SAMPLERATE,
-                   &supported_samplerates[0]) == SR_ERR)
+               if (config_set(SR_CONF_SAMPLERATE, &supported_samplerates[0],
+                               sdi) == SR_ERR)
                        return SR_ERR;
        }
 
@@ -603,12 +602,11 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static int hw_info_get(int info_id, const void **data,
-               const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -632,18 +630,17 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        int ret;
 
        devc = sdi->priv;
 
-       if (hwcap == SR_CONF_SAMPLERATE) {
+       if (id == SR_CONF_SAMPLERATE) {
                devc->cur_samplerate = *(const uint64_t *)value;
                ret = SR_OK;
-       } else if (hwcap == SR_CONF_LIMIT_SAMPLES) {
+       } else if (id == SR_CONF_LIMIT_SAMPLES) {
                devc->limit_samples = *(const uint64_t *)value;
                ret = SR_OK;
        } else {
@@ -1025,10 +1022,10 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index f25aa69fc450093c3e37ce19a653a03c41aabfe1..a23161cbf14cd27a6ef233394accfa197c5b4a7e 100644 (file)
@@ -422,14 +422,13 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        uint64_t tmp;
 
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -462,8 +461,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        struct sr_rational tmp_rat;
@@ -477,7 +475,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 
        ret = SR_OK;
        devc = sdi->priv;
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_FRAMES:
                devc->limit_frames = *(const uint64_t *)value;
                break;
@@ -914,10 +912,10 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index f0b69aee438f499408126a1281163c85fd5baaf0..5bc0380d19852835c14372f0d372886cacadbb92 100644 (file)
@@ -213,12 +213,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-               const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -232,8 +231,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        int ret;
@@ -249,14 +247,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 
        devc = sdi->priv;
        ret = SR_OK;
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = *(const uint64_t *)value;
                sr_dbg("Setting sample limit to %" PRIu64 ".",
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", hwcap);
+               sr_err("Unknown hardware capability: %d.", id);
                ret = SR_ERR_ARG;
        }
 
@@ -480,10 +478,10 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index fbd961c06cb2d17fba152143902ffaa7e09db4e7..4652509af706af8633f1852ff23961aa3364f62b 100644 (file)
@@ -298,12 +298,11 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -327,8 +326,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        int ret;
        struct dev_context *devc;
@@ -341,7 +339,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                // FIXME
                return mso_configure_rate(sdi, *(const uint64_t *)value);
@@ -493,10 +491,10 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = hw_cleanup,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index dc97b9a720f864a326adc4fb465f202d5d316feb..1b9cf24b079b6973fa50f61311261f4d0bed6ab2 100644 (file)
@@ -265,14 +265,13 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        /* TODO */
        (void)data;
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        default:
                return SR_ERR_ARG;
        }
@@ -280,8 +279,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        int ret;
 
@@ -294,10 +292,10 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
        }
 
        ret = SR_OK;
-       switch (hwcap) {
+       switch (id) {
 
        default:
-               sr_err("Unknown hardware capability: %d.", hwcap);
+               sr_err("Unknown hardware capability: %d.", id);
                ret = SR_ERR_ARG;
        }
 
@@ -337,10 +335,10 @@ SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index b31ec5b1b57118e947b48e5c22d41313cb71e125..dc86960b2f49eb18b16cfa03116b15ae38d21a52 100644 (file)
@@ -250,12 +250,11 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -282,8 +281,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        int ret;
@@ -294,7 +292,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                ret = ols_set_samplerate(sdi, *(const uint64_t *)value,
                                         &samplerates);
@@ -504,10 +502,10 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = hw_cleanup,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 2e2ca76a8c5cf2309831389d40af799f0b1db314..4eeacececfcf1675294929b4d2bc7b4ae8ee0bf3 100644 (file)
@@ -324,12 +324,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -352,8 +351,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        uint64_t tmp_u64;
@@ -370,7 +368,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
        }
 
        ret = SR_OK;
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_FRAMES:
                devc->limit_frames = *(const uint64_t *)value;
                break;
@@ -433,7 +431,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                        ret = SR_ERR_ARG;
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", hwcap);
+               sr_err("Unknown hardware capability: %d.", id);
                ret = SR_ERR_ARG;
                break;
        }
@@ -509,10 +507,10 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index b143a358e71499bb86d839ca10dc4e29ba88de37..6589d4f030dc772a7c14a7b98f0669eb7d673504 100644 (file)
@@ -373,12 +373,11 @@ static int hw_cleanup(int dmm)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -392,8 +391,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -405,7 +403,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_BUG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = *(const uint64_t *)value;
                sr_dbg("Setting sample limit to %" PRIu64 ".",
@@ -417,7 +415,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_msec);
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
                break;
        }
@@ -522,10 +520,10 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .scan = hw_scan_##ID_UPPER, \
        .dev_list = hw_dev_list_##ID_UPPER, \
        .dev_clear = clear_instances_##ID_UPPER, \
+       .config_get = config_get, \
+       .config_set = config_set, \
        .dev_open = hw_dev_open, \
        .dev_close = hw_dev_close, \
-       .info_get = hw_info_get, \
-       .dev_config_set = hw_dev_config_set, \
        .dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
        .dev_acquisition_stop = hw_dev_acquisition_stop, \
        .priv = NULL, \
index 16099940e21dcf7a607c3596e8f011038dcbaf0c..aded1ea8bcd92b034d8fe2a832d7ba6535059ec3 100644 (file)
@@ -195,12 +195,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -214,8 +213,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -226,14 +224,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 
        devc = sdi->priv;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = *(const uint64_t *)value;
                sr_dbg("Setting sample limit to %" PRIu64 ".",
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", hwcap);
+               sr_err("Unknown hardware capability: %d.", id);
                return SR_ERR_ARG;
        }
 
@@ -307,10 +305,10 @@ 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,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 210703d9a86cd678d8be2a2de7c306520fc81777..cb7c696611a2050d3d24385870485e5a0dda0314 100644 (file)
@@ -186,14 +186,13 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       sr_spew("Backend requested info_id %d.", info_id);
+       sr_spew("Backend requested info_id %d.", id);
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWOPTS:
                *data = hwopts;
                break;
@@ -221,14 +220,13 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
        devc = sdi->priv;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_MSEC:
                /* TODO: Not yet implemented. */
                if (*(const uint64_t *)value == 0) {
@@ -249,7 +247,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
                break;
        }
@@ -317,10 +315,10 @@ SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
@@ -335,10 +333,10 @@ SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index b847fbf9e8352dbb62087b55194a718e596cfafc..3f76a128e231b21fd4862824177a386cdaf94c97 100644 (file)
@@ -244,12 +244,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-                      const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        (void)sdi;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -260,8 +259,7 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        gint64 now;
@@ -279,7 +277,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 
        devc = sdi->priv;
        ret = SR_OK;
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_LIMIT_MSEC:
                devc->limit_msec = *(const int64_t *)value;
                now = g_get_monotonic_time() / 1000;
@@ -293,7 +291,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", hwcap);
+               sr_err("Unknown hardware capability: %d.", id);
                ret = SR_ERR_ARG;
        }
 
@@ -466,10 +464,10 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = clear_instances,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index fcd8c064af213070ecc4140efd6e7ee87e9ca93b..ba91fd5cd0c4d2601a10711780c7b2acd9024c8a 100644 (file)
@@ -529,12 +529,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -624,8 +623,7 @@ static int set_capture_ratio(struct dev_context *devc, uint64_t ratio)
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-                            const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
@@ -639,7 +637,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                return SR_ERR_ARG;
        }
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                return set_samplerate(devc, *(const uint64_t *)value);
        case SR_CONF_LIMIT_SAMPLES:
@@ -787,10 +785,10 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
        .scan = hw_scan,
        .dev_list = hw_dev_list,
        .dev_clear = hw_cleanup,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
index 6fd91216f12e626599fd52fad02787a19254f957..9bb097e80ca260e742008e68ef1e0a5423d4cd64 100644 (file)
@@ -324,7 +324,7 @@ SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
        if (driver == NULL || data == NULL)
                return SR_ERR;
 
-       ret = driver->info_get(id, data, sdi);
+       ret = driver->config_get(id, data, sdi);
 
        return ret;
 }
@@ -349,7 +349,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
                return FALSE;
        }
 
-       if (driver->info_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK)
+       if (driver->config_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK)
                return FALSE;
 
        for (i = 0; hwcaps[i]; i++) {
index 63b2a6087cc26c511f93ea681ad5e08c9d53a955..90e5e537aaba8dfc80153733fe9b9ae142878be7 100644 (file)
@@ -595,14 +595,14 @@ struct sr_dev_driver {
        GSList *(*scan) (GSList *options);
        GSList *(*dev_list) (void);
        int (*dev_clear) (void);
+       int (*config_get) (int id, const void **value,
+                       const struct sr_dev_inst *sdi);
+       int (*config_set) (int id, const void *value,
+                       const struct sr_dev_inst *sdi);
 
        /* Device-specific */
        int (*dev_open) (struct sr_dev_inst *sdi);
        int (*dev_close) (struct sr_dev_inst *sdi);
-       int (*info_get) (int info_id, const void **data,
-                       const struct sr_dev_inst *sdi);
-       int (*dev_config_set) (const struct sr_dev_inst *sdi, int hwcap,
-                       const void *value);
        int (*dev_acquisition_start) (const struct sr_dev_inst *sdi,
                        void *cb_data);
        int (*dev_acquisition_stop) (struct sr_dev_inst *sdi,
index e3a49145e1c488f6956a00032bd90e58a6a79bb8..5e5984d7c8297a97a7995aab267f6d142d1c3b2f 100644 (file)
@@ -129,7 +129,7 @@ static int init(struct sr_output *o)
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
 
        if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
-               o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
                ctx->samplerate = *samplerate;
        } else
index da09c3e70b51030a93fe8e5d9ae8c6c24b653803..a671c292990d11ad35724651488e98392b637092 100644 (file)
@@ -100,7 +100,7 @@ static int init(struct sr_output *o)
        num_probes = g_slist_length(o->sdi->probes);
 
        if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
-               o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
                ctx->samplerate = *samplerate;
        } else
index 5e6042302793b4bd3c5f400f503e8a20f67270d3..13c7adb7cf50e29285c3a49f509fcf02d619c73e 100644 (file)
@@ -110,7 +110,7 @@ static int init(struct sr_output *o)
        num_probes = g_slist_length(o->sdi->probes);
        comment[0] = '\0';
        if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
-               o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
                if (!(frequency_s = sr_samplerate_string(*samplerate))) {
                        sr_err("%s: sr_samplerate_string failed", __func__);
index dc5704bbee2499a45843467b8e7cbc1a2aa0cae4..f5eaad45099cd3ab4a6c203c12371b89a0c723f5 100644 (file)
@@ -70,7 +70,7 @@ static int init(struct sr_output *o)
        ctx->unitsize = (num_enabled_probes + 7) / 8;
 
        if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE))
-               o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
        else {
                tmp = 0;
index e7b5d2c8eb263e3768efad62042ba97fe875ad90..7c442ad8ab886a11b7683fe389e6c2a3eeb596ac 100644 (file)
@@ -124,7 +124,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
        num_probes = g_slist_length(o->sdi->probes);
        if (o->sdi->driver || sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
-               ret = o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               ret = o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
                if (ret != SR_OK)
                        goto err;
index f937ef7fd1223d8480754d69c8f2be872caf0857..39030c78cc5bf9aabb1f689631933c32edb6086e 100644 (file)
@@ -95,7 +95,7 @@ static int init(struct sr_output *o)
                        PACKAGE, PACKAGE_VERSION);
 
        if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
-               o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
+               o->sdi->driver->config_get(SR_DI_CUR_SAMPLERATE,
                                (const void **)&samplerate, o->sdi);
                ctx->samplerate = *samplerate;
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
index dfde8d799264f734e8d8c1b0450c294350981b63..52949722c87d8dcd1ad04c241fcd4db0ce648341 100644 (file)
@@ -148,12 +148,11 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int hw_info_get(int info_id, const void **data,
-       const struct sr_dev_inst *sdi)
+static int config_get(int id, const void **data, const struct sr_dev_inst *sdi)
 {
        struct session_vdev *vdev;
 
-       switch (info_id) {
+       switch (id) {
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
@@ -171,15 +170,14 @@ static int hw_info_get(int info_id, const void **data,
        return SR_OK;
 }
 
-static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
-               const void *value)
+static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
 {
        struct session_vdev *vdev;
        const uint64_t *tmp_u64;
 
        vdev = sdi->priv;
 
-       switch (hwcap) {
+       switch (id) {
        case SR_CONF_SAMPLERATE:
                tmp_u64 = value;
                vdev->samplerate = *tmp_u64;
@@ -202,7 +200,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                vdev->num_probes = *tmp_u64;
                break;
        default:
-               sr_err("Unknown capability: %d.", hwcap);
+               sr_err("Unknown capability: %d.", id);
                return SR_ERR;
        }
 
@@ -274,10 +272,10 @@ SR_PRIV struct sr_dev_driver session_driver = {
        .api_version = 1,
        .init = hw_init,
        .cleanup = hw_cleanup,
+       .config_get = config_get,
+       .config_set = config_set,
        .dev_open = hw_dev_open,
        .dev_close = NULL,
-       .info_get = hw_info_get,
-       .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = NULL,
 };
index c4f0db63d4072340307ee3c490bab0c5e98cf909..3168acbac9293fb07f9beaa2b8d7af1d0ee0cdbe 100644 (file)
@@ -146,18 +146,18 @@ SR_API int sr_session_load(const char *filename)
                                                /* first device, init the driver */
                                                sdi->driver->init(NULL);
                                        sr_session_dev_add(sdi);
-                                       sdi->driver->dev_config_set(sdi, SR_CONF_SESSIONFILE, filename);
-                                       sdi->driver->dev_config_set(sdi, SR_CONF_CAPTUREFILE, val);
+                                       sdi->driver->config_set(SR_CONF_SESSIONFILE, filename, sdi);
+                                       sdi->driver->config_set(SR_CONF_CAPTUREFILE, val, sdi);
                                        g_ptr_array_add(capturefiles, val);
                                } else if (!strcmp(keys[j], "samplerate")) {
                                        sr_parse_sizestring(val, &tmp_u64);
-                                       sdi->driver->dev_config_set(sdi, SR_CONF_SAMPLERATE, &tmp_u64);
+                                       sdi->driver->config_set(SR_CONF_SAMPLERATE, &tmp_u64, sdi);
                                } else if (!strcmp(keys[j], "unitsize")) {
                                        tmp_u64 = strtoull(val, NULL, 10);
-                                       sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_UNITSIZE, &tmp_u64);
+                                       sdi->driver->config_set(SR_CONF_CAPTURE_UNITSIZE, &tmp_u64, sdi);
                                } else if (!strcmp(keys[j], "total probes")) {
                                        total_probes = strtoull(val, NULL, 10);
-                                       sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_NUM_PROBES, &total_probes);
+                                       sdi->driver->config_set(SR_CONF_CAPTURE_NUM_PROBES, &total_probes, sdi);
                                        for (p = 0; p < total_probes; p++) {
                                                snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
                                                if (!(probe = sr_probe_new(p, SR_PROBE_LOGIC, TRUE,
index 5ac9b71912a7ef1fa4a03f6fef784f5e6727313d..a073a75800b2b26e7ad8e537fe8589bf827bff39 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -230,7 +230,7 @@ SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
                return NULL;
        }
 
-       if (sdi->driver->info_get(SR_DI_TRIGGER_TYPES,
+       if (sdi->driver->config_get(SR_DI_TRIGGER_TYPES,
                        (const void **)&trigger_types, sdi) != SR_OK) {
                sr_err("%s: Device doesn't support any triggers.", __func__);
                return NULL;