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,
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;
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;
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);
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;