yokogawa-dlm: Publish driver options.
This commit is contained in:
parent
413f1944d1
commit
cf0280fa1b
|
@ -27,6 +27,11 @@ static struct sr_dev_driver *di = &yokogawa_dlm_driver_info;
|
||||||
static char *MANUFACTURER_ID = "YOKOGAWA";
|
static char *MANUFACTURER_ID = "YOKOGAWA";
|
||||||
static char *MANUFACTURER_NAME = "Yokogawa";
|
static char *MANUFACTURER_NAME = "Yokogawa";
|
||||||
|
|
||||||
|
static const uint32_t drvopts[] = {
|
||||||
|
SR_CONF_LOGIC_ANALYZER,
|
||||||
|
SR_CONF_OSCILLOSCOPE,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CG_INVALID = -1,
|
CG_INVALID = -1,
|
||||||
CG_NONE,
|
CG_NONE,
|
||||||
|
@ -468,23 +473,26 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
static int config_list(uint32_t 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)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
int cg_type;
|
int cg_type = CG_NONE;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc = NULL;
|
||||||
struct scope_config *model;
|
struct scope_config *model = NULL;
|
||||||
|
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (sdi && (devc = sdi->priv)) {
|
||||||
return SR_ERR_ARG;
|
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
|
||||||
|
return SR_ERR;
|
||||||
|
|
||||||
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
|
model = devc->model_config;
|
||||||
return SR_ERR;
|
}
|
||||||
|
|
||||||
model = devc->model_config;
|
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
if (cg_type == CG_NONE) {
|
if (cg_type == CG_NONE) {
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
if (model)
|
||||||
model->devopts, model->num_devopts, sizeof(uint32_t));
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
|
model->devopts, model->num_devopts, sizeof(uint32_t));
|
||||||
|
else
|
||||||
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
|
drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t));
|
||||||
} else if (cg_type == CG_ANALOG) {
|
} else if (cg_type == CG_ANALOG) {
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
model->analog_devopts, model->num_analog_devopts, sizeof(uint32_t));
|
model->analog_devopts, model->num_analog_devopts, sizeof(uint32_t));
|
||||||
|
@ -500,14 +508,20 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
||||||
g_strv_length((char **)*model->coupling_options));
|
g_strv_length((char **)*model->coupling_options));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TRIGGER_SOURCE:
|
case SR_CONF_TRIGGER_SOURCE:
|
||||||
|
if (!model)
|
||||||
|
return SR_ERR_ARG;
|
||||||
*data = g_variant_new_strv(*model->trigger_sources,
|
*data = g_variant_new_strv(*model->trigger_sources,
|
||||||
g_strv_length((char **)*model->trigger_sources));
|
g_strv_length((char **)*model->trigger_sources));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TRIGGER_SLOPE:
|
case SR_CONF_TRIGGER_SLOPE:
|
||||||
|
if (!model)
|
||||||
|
return SR_ERR_ARG;
|
||||||
*data = g_variant_new_strv(*model->trigger_slopes,
|
*data = g_variant_new_strv(*model->trigger_slopes,
|
||||||
g_strv_length((char **)*model->trigger_slopes));
|
g_strv_length((char **)*model->trigger_slopes));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TIMEBASE:
|
case SR_CONF_TIMEBASE:
|
||||||
|
if (!model)
|
||||||
|
return SR_ERR_ARG;
|
||||||
*data = build_tuples(model->timebases, model->num_timebases);
|
*data = build_tuples(model->timebases, model->num_timebases);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_VDIV:
|
case SR_CONF_VDIV:
|
||||||
|
|
Loading…
Reference in New Issue