From: Bert Vermeulen Date: Fri, 25 Jan 2013 14:01:49 +0000 (+0100) Subject: Deprecate SR_DI_HWCAPS. X-Git-Tag: dsupstream~309 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=9a6517d14b1248855cde0d88ec9519f99184cc77 Deprecate SR_DI_HWCAPS. This is replaced by SR_CONF_DEVICE_OPTIONS. --- diff --git a/device.c b/device.c index a5c8c509..0c38c119 100644 --- 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->config_get(SR_DI_HWCAPS, + if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, (const void **)&hwcaps, NULL) != SR_OK) return FALSE; diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index aa56b58d..5f961018 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -255,9 +255,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -308,6 +305,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; default: return SR_ERR_ARG; } diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index 86ab6a7c..67773f60 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -144,14 +144,9 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) { struct dev_context *devc; - if (id != SR_DI_HWCAPS) /* For SR_DI_HWCAPS sdi will be NULL. */ - devc = sdi->priv; - switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; case SR_CONF_SAMPLERATE: + devc = sdi->priv; *data = &devc->cur_samplerate; break; default: @@ -189,6 +184,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: if (!sdi || !sdi->priv) return SR_ERR_ARG; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 13cb3342..667df3a3 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -792,9 +792,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; @@ -843,6 +840,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; diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index bfeddaa1..478f0a1c 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -293,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; @@ -361,6 +358,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: fill_supported_samplerates_if_needed(); *data = &samplerates; diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index 4047a319..8fed762a 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -199,9 +199,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -252,6 +249,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; default: return SR_ERR_ARG; } diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 345468c4..df6a2543 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -231,9 +231,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) (void)sdi; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; case SR_CONF_SAMPLERATE: *data = &cur_samplerate; break; @@ -298,6 +295,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; diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index bf00b735..dd9e7178 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -289,9 +289,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -342,6 +339,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; default: return SR_ERR_ARG; } diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 3b949940..b0f94c59 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -607,9 +607,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; @@ -650,6 +647,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; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 1e0a4a17..65e7000c 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -429,9 +429,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) (void)sdi; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; /* TODO remove this */ case SR_CONF_SAMPLERATE: *data = &tmp; @@ -568,6 +565,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_BUFFERSIZE: *data = buffersizes; break; diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 25932ac7..c9ccbfda 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -221,9 +221,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -267,6 +264,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; default: return SR_ERR_ARG; } diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index 77faf08b..11ae8888 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -303,9 +303,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 +389,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; diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 02945b8c..634a2a57 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -258,9 +258,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; case SR_CONF_SAMPLERATE: if (sdi) { devc = sdi->priv; @@ -329,6 +326,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; diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index 83323114..3e3aa542 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -329,9 +329,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) (void)sdi; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -433,6 +430,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_COUPLING: *data = coupling; break; diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index ce37c9dc..7ca807c4 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -381,9 +381,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -429,6 +426,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; default: return SR_ERR_ARG; } diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index aa3fe6ff..7f606631 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -203,9 +203,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -244,6 +241,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; default: return SR_ERR_ARG; } diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index 7c4c6b89..75112838 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -196,10 +196,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) case SR_DI_HWOPTS: *data = hwopts; break; - case SR_DI_HWCAPS: - *data = hwcaps; - sr_spew("%s: Returning hwcaps.", __func__); - break; case SR_CONF_SAMPLERATE: /* TODO: Get rid of this. */ *data = NULL; @@ -255,6 +251,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; default: return SR_ERR_ARG; } diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index d930dbf0..1e8cd4ae 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -249,9 +249,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) (void)sdi; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; default: return SR_ERR_ARG; } @@ -304,6 +301,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; default: return SR_ERR_ARG; } diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 91e7c4a8..7a72e7c4 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -534,9 +534,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; @@ -647,6 +644,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; diff --git a/hwdriver.c b/hwdriver.c index 439d4c78..b4136103 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -365,7 +365,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap) return FALSE; } - if (driver->config_get(SR_DI_HWCAPS, (const void **)&hwcaps, NULL) != SR_OK) + if (driver->config_list(SR_CONF_DEVICE_OPTIONS, (const void **)&hwcaps, NULL) != SR_OK) return FALSE; for (i = 0; hwcaps[i]; i++) { diff --git a/libsigrok.h b/libsigrok.h index 7ee2fa38..2b17a5f6 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -388,7 +388,7 @@ enum { /** The device can measure humidity. */ SR_CONF_HYGROMETER, - /*--- Driver options ------------------------------------------------*/ + /*--- Driver scan options -------------------------------------------*/ /** * Specification on how to connect to a device. @@ -466,6 +466,12 @@ enum { /*--- Special stuff -------------------------------------------------*/ + /** Scan options supported by the driver. */ + SR_CONF_SCAN_OPTIONS, + + /** Device options for a particular device. */ + SR_CONF_DEVICE_OPTIONS, + /** Session filename. */ SR_CONF_SESSIONFILE = 40000, @@ -552,8 +558,6 @@ enum { enum { /** A list of options supported by the driver. */ SR_DI_HWOPTS = 10000, - /** A list of capabilities supported by the device. */ - SR_DI_HWCAPS, }; /* diff --git a/session_driver.c b/session_driver.c index e4f6a9f4..f3cd4b6c 100644 --- a/session_driver.c +++ b/session_driver.c @@ -153,9 +153,6 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) struct session_vdev *vdev; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; case SR_CONF_SAMPLERATE: if (sdi) { vdev = sdi->priv; @@ -207,6 +204,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return SR_OK; } +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; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -274,6 +287,7 @@ SR_PRIV struct sr_dev_driver session_driver = { .cleanup = hw_cleanup, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = NULL, .dev_acquisition_start = hw_dev_acquisition_start,