]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
Publish config key capabilities.
[libsigrok.git] / src / hardware / fx2lafw / api.c
index d4643ff760f491e2269602000345f0739c5e6511..18a34df659ab5daed4fe71b1529a1a81b27ceab4 100644 (file)
@@ -73,18 +73,17 @@ static const struct fx2lafw_profile supported_fx2[] = {
        { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 };
 
-static const int32_t hwopts[] = {
+static const uint32_t scanopts[] = {
        SR_CONF_CONN,
 };
 
-static const int32_t hwcaps[] = {
+static const uint32_t devopts[] = {
        SR_CONF_LOGIC_ANALYZER,
-       SR_CONF_TRIGGER_MATCH,
-       SR_CONF_SAMPLERATE,
-
-       /* These are really implemented in the driver, not the hardware. */
-       SR_CONF_LIMIT_SAMPLES,
        SR_CONF_CONTINUOUS,
+       SR_CONF_CONN | SR_CONF_GET,
+       SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
+       SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
 };
 
 static const char *channel_names[] = {
@@ -385,7 +384,7 @@ static int cleanup(void)
        return ret;
 }
 
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
@@ -399,7 +398,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
 
        devc = sdi->priv;
 
-       switch (id) {
+       switch (key) {
        case SR_CONF_CONN:
                if (!sdi->conn)
                        return SR_ERR_ARG;
@@ -424,7 +423,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
@@ -444,8 +443,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
 
        ret = SR_OK;
 
-       switch (id)
-       {
+       switch (key) {
                case SR_CONF_SAMPLERATE:
                        arg = g_variant_get_uint64(data);
                        for (i = 0; i < ARRAY_SIZE(samplerates); i++) {
@@ -467,7 +465,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
        return ret;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        GVariant *gvar;
@@ -478,12 +476,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                               scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
                break;
        case SR_CONF_DEVICE_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                               devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
                break;
        case SR_CONF_SAMPLERATE:
                g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}"));