arachnid-labs-re-load-pro: Make SR_CONF_REGULATION listable
This commit is contained in:
parent
3d70d77709
commit
706350360a
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
17
src/std.c
17
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;
|
||||
|
|
Loading…
Reference in New Issue