]> sigrok.org Git - libsigrok.git/commitdiff
drivers: return SR_ERR_NA on unsupported config key
authorBert Vermeulen <redacted>
Tue, 16 Apr 2013 00:33:03 +0000 (02:33 +0200)
committerBert Vermeulen <redacted>
Tue, 16 Apr 2013 09:00:55 +0000 (11:00 +0200)
Fixes bug 89.

22 files changed:
hardware/agilent-dmm/api.c
hardware/alsa/api.c
hardware/asix-sigma/asix-sigma.c
hardware/brymen-dmm/api.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/mic-985xx/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/api.c
libsigrok.h

index 87b2dd810577328d549aa442f0d434a0ce0f4e74..89e59bbe96d1a9a3bc1bf8a400e00d1d50ee3c1c 100644 (file)
@@ -257,9 +257,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -280,7 +278,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 39ab74d139480f3e852f7fa44f3e0a4a556c8c94..2e674fff6e3fe151aa2233108212aeab11ccfe3b 100644 (file)
@@ -133,7 +133,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_uint64(devc->cur_samplerate);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -153,8 +153,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                devc->limit_samples = g_variant_get_uint64(data);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -191,7 +190,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_builder_end(&gvb);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index e6cb602b580d448f1f27d41a211093e1ce1d3bdc..8155f7da79808c4fccc41f5ded2ca446220fef62 100644 (file)
@@ -778,7 +778,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                        return SR_ERR;
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -806,7 +806,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                else
                        ret = SR_OK;
        } else {
-               ret = SR_ERR;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -835,7 +835,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 23a59dc9836710734d8790149866fcb1edf16cfb..59f5040e40995d96ffefe085131317b6523d8547 100644 (file)
@@ -235,8 +235,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                devc->limit_msec = g_variant_get_uint64(data);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -256,8 +255,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               sr_err("Unknown config key: %d.", key);
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index b0dccfeac918a7c46ea2104e824484fb4090766a..53acf0b809386654184717fc35116240ae6edf7f 100644 (file)
@@ -297,7 +297,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                        return SR_ERR;
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -337,10 +337,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                sr_dbg("LIMIT_SAMPLES = %" PRIu64, devc->limit_samples);
                break;
        default:
-               /* Unknown capability, return SR_ERR. */
-               sr_err("%s: Unknown capability: %d.", __func__, id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -372,7 +369,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index b976ef93414f51ce8c6668bc666d8ff0cf0414eb..7ae2892b072d4f9e2cf68216c227ec50723a7949 100644 (file)
@@ -202,9 +202,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -225,7 +223,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 0245e185bfcab39e905c340967b5dafc17bd8a30..73fe092727f604423c21afdbd520023cd7eab799 100644 (file)
@@ -286,7 +286,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                }
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -335,7 +335,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                sr_dbg("%s: setting pattern to %d",
                        __func__, devc->sample_generator);
        } else {
-               ret = SR_ERR;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -364,7 +364,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_strv(pattern_strings, ARRAY_SIZE(pattern_strings));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index cdb527d1f1916091aa3299be51f834170fb645d9..92092fab4f7ec77fb7aedb5b97fe14bbae443bcc 100644 (file)
@@ -291,9 +291,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -314,7 +312,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index f76fa57f73020c9ec1c95249a1401be4e30e46c2..25d47d8552561bc67771f91feabaaf3a8517086a 100644 (file)
@@ -620,7 +620,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                        return SR_ERR;
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -640,7 +640,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                devc->limit_samples = g_variant_get_uint64(data);
                ret = SR_OK;
        } else {
-               ret = SR_ERR;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -669,7 +669,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index c5540b7458c709be3fefb522a8de1f3417e50e9e..6a11998d043c5f2cd31815c3b0352c4cbd786fab 100644 (file)
@@ -429,7 +429,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_int32(NUM_VDIV);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -555,7 +555,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                        ret = SR_ERR_ARG;
                break;
        default:
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
                break;
        }
 
@@ -616,7 +616,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                ARRAY_SIZE(trigger_sources));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 84daf93e3e792d20089b0efe35f75868858a6b6e..aedd147d7be1a6cdf7b1a3b3c57ad66522595889 100644 (file)
@@ -209,7 +209,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_uint64(devc->limit_samples);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -247,8 +247,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -269,7 +268,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 58ff415a83d448512ad74050401355e0aa5bfb8d..f3f4dcf77ef349c6f5fb1ba6a0a8cccd2855c72c 100644 (file)
@@ -298,7 +298,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                        return SR_ERR;
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -363,7 +363,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                ret = SR_OK;
                break;
        default:
-               ret = SR_ERR;
+               ret = SR_ERR_NA;
                break;
        }
 
@@ -393,7 +393,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index f96d128f9c7c3e697d2bfc3bff0cb0d7ef7ab075..8a18313ffa5aa2ada66a11a6d36837d25423d0f2 100644 (file)
@@ -235,8 +235,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_msec);
                break;
        default:
-               sr_err("Unknown config: %d.", id);
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -256,7 +255,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 3413b8eaf12576710f5431641cf0184666a4e0bf..48b361a003ae677db979aafbdfa687bcdb29aeb7 100644 (file)
@@ -262,8 +262,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        switch (id) {
 
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -276,7 +275,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
 
        switch (key) {
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index dc0467007e904cd9e9e3b4104308d5a0ae86e025..cab998966142c856dc7c7e39adba00de4dab68ab 100644 (file)
@@ -267,7 +267,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_boolean(devc->flag_reg & FLAG_RLE ? TRUE : FALSE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -314,7 +314,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                ret = SR_OK;
                break;
        default:
-               ret = SR_ERR;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -347,7 +347,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 595d73e63778ad3b791e6545fe5d24944dbf934c..3abe0046621ead400878ee129867eceeb6246623 100644 (file)
@@ -379,7 +379,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_int32(NUM_VDIV);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -488,8 +488,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                        ret = SR_ERR_ARG;
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
                break;
        }
 
@@ -540,7 +539,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                devc->has_digital ? ARRAY_SIZE(trigger_sources) : 4);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index cb741f936f10bc63a238a6de49127ca0815c526c..e74cbccd058afd94f92cd8113bf05f269fd0b0cf 100644 (file)
@@ -386,9 +386,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_msec);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -409,7 +407,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index ca57aaa5b9980ebf3ea69d0d24d375bbd6a9c196..3b4dc1fa18533ad3cc3a30682068104bfb9b5bb7 100644 (file)
@@ -198,8 +198,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -220,7 +219,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index f34da02be1c358ff30d28c69ae6429746ff08941..e97355ef25d367c99ce5655531d5be7b6a966e8d 100644 (file)
@@ -197,9 +197,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown capability: %d.", id);
-               return SR_ERR;
-               break;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -220,7 +218,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 13777ceb6968fae98f03153165bf1f579bf00054..037b0b56c62e9892cbf28f6ceb560adc56c1168e 100644 (file)
@@ -256,8 +256,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                       devc->limit_samples);
                break;
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -274,7 +273,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                                hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 5d0ba63b06566dce550080b7aa0de80b33387b3b..78036892a00ea3f8cbf51256b7b52872a9a73a60 100644 (file)
@@ -511,7 +511,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
                        return SR_ERR;
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -539,7 +539,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        case SR_CONF_CAPTURE_RATIO:
                return set_capture_ratio(devc, g_variant_get_uint64(data));
        default:
-               return SR_ERR;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -579,7 +579,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
index 4212c59c4f046d77522b81a12b9a949568664123..294bb15d7d3ba0a5fd7827ddf89b9640dfaead1a 100644 (file)
@@ -70,6 +70,7 @@ enum {
        SR_ERR_ARG        = -3, /**< Function argument error. */
        SR_ERR_BUG        = -4, /**< Errors hinting at internal bugs. */
        SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */
+       SR_ERR_NA         = -6, /**< Not applicable. */
 };
 
 #define SR_MAX_NUM_PROBES    64 /* Limited by uint64_t. */