From: Bert Vermeulen Date: Fri, 25 Jan 2013 01:32:05 +0000 (+0100) Subject: drivers: implement config_list() X-Git-Tag: dsupstream~320 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a1c743fc51d7b49c769fb525fe4b89985a9468c9;p=libsigrok.git drivers: implement config_list() --- diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index afd26701..aa56b58d 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -302,6 +302,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -370,6 +383,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index 4349bc81..594b95e8 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -189,6 +189,30 @@ 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) +{ + struct dev_context *devc; + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + if (!sdi || !sdi->priv) + return SR_ERR_ARG; + devc = sdi->priv; + if (!devc->supp_rates.list) { + sr_err("Instance did not contain a samplerate list."); + return SR_ERR_ARG; + } + *data = &devc->supp_rates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -322,6 +346,7 @@ SR_PRIV struct sr_dev_driver alsa_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 3356fb23..28727b81 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -843,6 +843,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + /* Software trigger to determine exact trigger position. */ static int get_trigger_offset(uint16_t *samples, uint16_t last_sample, struct sigma_trigger *t) @@ -1438,6 +1454,7 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index cd6eca5f..c1d55c5b 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -365,6 +365,23 @@ 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_SAMPLERATE: + fill_supported_samplerates_if_needed(); + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int receive_data(int fd, int revents, void *cb_data) { int i, ret; @@ -514,6 +531,7 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index 5d350ec5..4047a319 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -246,6 +246,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -314,6 +327,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index d7d0719f..c346dd3e 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -298,6 +298,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void samples_generator(uint8_t *buf, uint64_t size, struct dev_context *devc) { @@ -490,6 +506,7 @@ SR_PRIV struct sr_dev_driver demo_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 1120bad1..bf00b735 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -336,6 +336,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -410,6 +423,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 46b65cb0..a76ffd57 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -650,6 +650,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int receive_data(int fd, int revents, void *cb_data) { struct timeval tv; @@ -1024,6 +1040,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index a23161cb..0df6a5b8 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -580,6 +580,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void send_chunk(struct sr_dev_inst *sdi, unsigned char *buf, int num_samples) { @@ -914,6 +927,7 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 5bc0380d..25932ac7 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -261,6 +261,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void mark_xfer(struct libusb_transfer *xfer) { @@ -480,6 +493,7 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index 4652509a..6c23bbbe 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -392,6 +392,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -493,6 +509,7 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = { .dev_clear = hw_cleanup, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/nexus-osciprime/api.c b/hardware/nexus-osciprime/api.c index 1b9cf24b..d0b61078 100644 --- a/hardware/nexus-osciprime/api.c +++ b/hardware/nexus-osciprime/api.c @@ -302,6 +302,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -337,6 +350,7 @@ SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index dc86960b..22afead9 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -329,6 +329,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -504,6 +520,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info = { .dev_clear = hw_cleanup, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index 4eeacece..25d68563 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -439,6 +439,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -509,6 +522,7 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index 6589d4f0..ce37c9dc 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -423,6 +423,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data, int dmm) { @@ -522,6 +535,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \ .dev_clear = clear_instances_##ID_UPPER, \ .config_get = config_get, \ .config_set = config_set, \ + .config_list = config_list, \ .dev_open = hw_dev_open, \ .dev_close = hw_dev_close, \ .dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \ diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index aded1ea8..aa3fe6ff 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -238,6 +238,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -307,6 +320,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index cb7c6966..a0c4e267 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -255,6 +255,19 @@ 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) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { @@ -317,6 +330,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, @@ -335,6 +349,7 @@ SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index 3f76a128..d930dbf0 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -298,6 +298,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) return ret; } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void receive_transfer(struct libusb_transfer *transfer) { struct dev_context *devc; @@ -466,6 +479,7 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = { .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start, diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index ba91fd5c..ac47f085 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -649,6 +649,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) } } +static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_SAMPLERATE: + *data = &samplerates; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + static void set_triggerbar(struct dev_context *devc) { unsigned int ramsize; @@ -787,6 +803,7 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { .dev_clear = hw_cleanup, .config_get = config_get, .config_set = config_set, + .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_acquisition_start = hw_dev_acquisition_start,