]> sigrok.org Git - libsigrok.git/blobdiff - hardware/atten-pps3xxx/api.c
Remove std_dev_clear() wrappers from drivers.
[libsigrok.git] / hardware / atten-pps3xxx / api.c
index 3579d5c8f560276a102983b918369ef14e1f2ce3..c7e976011a0c1f878e8da708407bd40cfc481ae7 100644 (file)
@@ -31,7 +31,7 @@
  */
 #define SERIALCOMM "9600/8n2"
 
-static const int32_t hwopts[] = {
+static const int32_t scanopts[] = {
        SR_CONF_CONN,
        SR_CONF_SERIALCOMM,
 };
@@ -39,18 +39,11 @@ static const int32_t hwopts[] = {
 static const int32_t devopts[] = {
        SR_CONF_POWER_SUPPLY,
        SR_CONF_CONTINUOUS,
-};
-
-static const int32_t devopts_sdi[] = {
-       SR_CONF_POWER_SUPPLY,
-       SR_CONF_CONTINUOUS,
        SR_CONF_OUTPUT_CHANNEL,
        SR_CONF_OVER_CURRENT_PROTECTION,
 };
 
 static const int32_t devopts_pg[] = {
-       SR_CONF_POWER_SUPPLY,
-       SR_CONF_CONTINUOUS,
        SR_CONF_OUTPUT_VOLTAGE,
        SR_CONF_OUTPUT_VOLTAGE_MAX,
        SR_CONF_OUTPUT_CURRENT,
@@ -207,14 +200,9 @@ static GSList *dev_list(void)
        return ((struct drv_context *)(di->priv))->instances;
 }
 
-static int dev_clear(void)
-{
-       return std_dev_clear(di, NULL);
-}
-
 static int cleanup(void)
 {
-       return dev_clear();
+       return std_dev_clear(di, NULL);
 }
 
 static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
@@ -234,7 +222,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
                /* No probe group: global options. */
                switch (key) {
                case SR_CONF_OUTPUT_CHANNEL:
-                       *data = g_variant_new_string(channel_modes[devc->channel_mode - 1]);
+                       *data = g_variant_new_string(channel_modes[devc->channel_mode]);
                        break;
                case SR_CONF_OVER_CURRENT_PROTECTION:
                        *data = g_variant_new_boolean(devc->over_current_protection);
@@ -382,21 +370,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
        /* Always available, even without sdi. */
        if (key == SR_CONF_SCAN_OPTIONS) {
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
+                               scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t));
                return SR_OK;
        }
 
-       if (!sdi) {
-               if (key == SR_CONF_DEVICE_OPTIONS) {
-                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                                       devopts, ARRAY_SIZE(devopts), sizeof(int32_t));
-                       return SR_OK;
-
-               } else {
-                       /* Everything else needs an sdi. */
-                       return SR_ERR_ARG;
-               }
-       }
+       if (!sdi)
+               return SR_ERR_ARG;
        devc = sdi->priv;
 
        ret = SR_OK;
@@ -405,7 +384,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
                        *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                                       devopts_sdi, ARRAY_SIZE(devopts_sdi), sizeof(int32_t));
+                                       devopts, ARRAY_SIZE(devopts), sizeof(int32_t));
                        break;
                case SR_CONF_OUTPUT_CHANNEL:
                        if (devc->model->channel_modes == CHANMODE_INDEPENDENT) {
@@ -526,7 +505,7 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
        .cleanup = cleanup,
        .scan = scan_3203,
        .dev_list = dev_list,
-       .dev_clear = dev_clear,
+       .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,