diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 1b7b8698..a0e99dee 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -44,7 +44,7 @@ static const uint32_t devopts[] = { static const uint32_t devopts_cg[] = { SR_CONF_ENABLED | SR_CONF_SET, - SR_CONF_REGULATION | SR_CONF_GET, + SR_CONF_REGULATION | SR_CONF_GET | SR_CONF_LIST, SR_CONF_VOLTAGE | SR_CONF_GET, SR_CONF_CURRENT | SR_CONF_GET, SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, @@ -57,6 +57,11 @@ static const uint32_t devopts_cg[] = { SR_CONF_UNDER_VOLTAGE_CONDITION_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; +static const char *regulation[] = { + /* CC mode only. */ + "CC", +}; + static GSList *scan(struct sr_dev_driver *di, GSList *options) { struct sr_dev_inst *sdi; @@ -172,6 +177,9 @@ static int config_list(uint32_t key, GVariant **data, case SR_CONF_DEVICE_OPTIONS: *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg)); break; + case SR_CONF_REGULATION: + *data = std_gvar_array_str(ARRAY_AND_SIZE(regulation)); + break; case SR_CONF_CURRENT_LIMIT: *data = std_gvar_min_max_step(0.0, 6.0, 0.001); break; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index fa4237f1..0a8032b3 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -972,6 +972,7 @@ SR_PRIV GVariant *std_gvar_tuple_double(double low, double high); SR_PRIV GVariant *std_gvar_array_i32(const int32_t *a, unsigned int n); SR_PRIV GVariant *std_gvar_array_u32(const uint32_t *a, unsigned int n); SR_PRIV GVariant *std_gvar_array_u64(const uint64_t *a, unsigned int n); +SR_PRIV GVariant *std_gvar_array_str(const char *a[], unsigned int n); SR_PRIV GVariant *std_gvar_thresholds(const double a[][2], unsigned int n); diff --git a/src/std.c b/src/std.c index b778679b..6403d01a 100644 --- a/src/std.c +++ b/src/std.c @@ -767,6 +767,23 @@ SR_PRIV GVariant *std_gvar_array_u64(const uint64_t *a, unsigned int n) a, n, sizeof(uint64_t)); } +SR_PRIV GVariant *std_gvar_array_str(const char *a[], unsigned int n) +{ + GVariant *gvar; + GVariantBuilder *builder; + unsigned int i; + + builder = g_variant_builder_new(G_VARIANT_TYPE ("as")); + + for (i = 0; i < n; i++) + g_variant_builder_add(builder, "s", a[i]); + + gvar = g_variant_new("as", builder); + g_variant_builder_unref(builder); + + return gvar; +} + SR_PRIV GVariant *std_gvar_thresholds(const double a[][2], unsigned int n) { unsigned int i;