]> sigrok.org Git - libsigrok.git/commitdiff
drivers: implement config_list()
authorBert Vermeulen <redacted>
Fri, 25 Jan 2013 01:32:05 +0000 (02:32 +0100)
committerBert Vermeulen <redacted>
Fri, 25 Jan 2013 01:37:26 +0000 (02:37 +0100)
19 files changed:
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

index afd267017b8981ef597db3fcabf56666b153fb28..aa56b58d42c10d87c12e7e9017afc07d2a2fb22c 100644 (file)
@@ -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,
index 4349bc813196660fc64d4118b4004125806ab798..594b95e85bf4c749462f9f2a7b30eacbea5398a3 100644 (file)
@@ -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,
index 3356fb23f3bdd2dddf961761c446003235b391ba..28727b81adec36dbdf90feddf7c2e1174a7718db 100644 (file)
@@ -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,
index cd6eca5fc30eb61de9ab3f6ea81db9f0f548c4c0..c1d55c5b0122887e2e22ff00d481d5350ebdc85f 100644 (file)
@@ -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,
index 5d350ec5fcf98d9067da2a03903372c5001cc456..4047a319995128450bdc0999ffd00ed6f68755ce 100644 (file)
@@ -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,
index d7d0719f22af544b72ebb69bc3a250e4495ec114..c346dd3e83ddb2df421c25213e73354fec85a2dc 100644 (file)
@@ -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,
index 1120bad1792ab225481d0b519690dbc1f390c633..bf00b7352326c6ae281f9cfb9ea5d0f834069b76 100644 (file)
@@ -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,
index 46b65cb0947afa57c144715b8c37a447622dc18c..a76ffd577653cc6bd3bb193607d17f6ecf01c5d1 100644 (file)
@@ -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,
index a23161cbf14cd27a6ef233394accfa197c5b4a7e..0df6a5b85078cf0bf68b64fd42131525d7dc4478 100644 (file)
@@ -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,
index 5bc0380d19852835c14372f0d372886cacadbb92..25932ac74106df886bc9aa7ad791aa62dbd72fd8 100644 (file)
@@ -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,
index 4652509af706af8633f1852ff23961aa3364f62b..6c23bbbe5a982bc86cb2ca55d8fc0660f28a7135 100644 (file)
@@ -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,
index 1b9cf24b079b6973fa50f61311261f4d0bed6ab2..d0b610782f6b4cb2b42ddf49753b0dd02b9b3797 100644 (file)
@@ -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,
index dc86960b2f49eb18b16cfa03116b15ae38d21a52..22afead9d38a7a446419294fcdc42879cab7d219 100644 (file)
@@ -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,
index 4eeacececfcf1675294929b4d2bc7b4ae8ee0bf3..25d68563b429e197a2a76e1f5a535c8c9888654b 100644 (file)
@@ -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,
index 6589d4f030dc772a7c14a7b98f0669eb7d673504..ce37c9dc6f04039de47309269580a0c9e3bd0eda 100644 (file)
@@ -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, \
index aded1ea8bcd92b034d8fe2a832d7ba6535059ec3..aa3fe6ff32eb534499f2eef1c2e47d1ee5f75279 100644 (file)
@@ -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,
index cb7c696611a2050d3d24385870485e5a0dda0314..a0c4e267ed20ba7252b8b85986ea3d861c51cb00 100644 (file)
@@ -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,
index 3f76a128e231b21fd4862824177a386cdaf94c97..d930dbf09fe6ec3ec10237527393454d2b6bd1f3 100644 (file)
@@ -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,
index ba91fd5cd0c4d2601a10711780c7b2acd9024c8a..ac47f085c153259a2e7ff7220b70ec31ac756732 100644 (file)
@@ -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,