brymen-dmm: Adjust to GVariant-based sr_config_* functions
This commit is contained in:
parent
2c9c0df86e
commit
510b3e692a
|
@ -19,18 +19,16 @@
|
|||
|
||||
#include "protocol.h"
|
||||
|
||||
static const int hwopts[] = {
|
||||
static const int32_t hwopts[] = {
|
||||
SR_CONF_CONN,
|
||||
SR_CONF_SERIALCOMM,
|
||||
0,
|
||||
};
|
||||
|
||||
static const int hwcaps[] = {
|
||||
static const int32_t hwcaps[] = {
|
||||
SR_CONF_MULTIMETER,
|
||||
SR_CONF_LIMIT_SAMPLES,
|
||||
SR_CONF_CONTINUOUS,
|
||||
SR_CONF_LIMIT_MSEC,
|
||||
0,
|
||||
};
|
||||
|
||||
SR_PRIV struct sr_dev_driver brymen_bm857_driver_info;
|
||||
|
@ -148,10 +146,10 @@ static GSList *hw_scan(GSList *options)
|
|||
src = l->data;
|
||||
switch (src->key) {
|
||||
case SR_CONF_CONN:
|
||||
conn = src->value;
|
||||
conn = g_variant_get_string(src->data, NULL);
|
||||
break;
|
||||
case SR_CONF_SERIALCOMM:
|
||||
serialcomm = src->value;
|
||||
serialcomm = g_variant_get_string(src->data, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -213,27 +211,7 @@ static int hw_cleanup(void)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data,
|
||||
const struct sr_dev_inst *sdi)
|
||||
{
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
*data = hwopts;
|
||||
break;
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
*data = hwcaps;
|
||||
break;
|
||||
default:
|
||||
sr_err("Unknown config key: %d.", key);
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
int ret;
|
||||
|
@ -251,10 +229,10 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
ret = SR_OK;
|
||||
switch (id) {
|
||||
case SR_CONF_LIMIT_SAMPLES:
|
||||
devc->limit_samples = *(const uint64_t *)value;
|
||||
devc->limit_samples = g_variant_get_uint64(data);
|
||||
break;
|
||||
case SR_CONF_LIMIT_MSEC:
|
||||
devc->limit_msec = *(const uint64_t *)value;
|
||||
devc->limit_msec = g_variant_get_uint64(data);
|
||||
break;
|
||||
default:
|
||||
sr_err("Unknown hardware capability: %d.", id);
|
||||
|
@ -264,6 +242,27 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SCAN_OPTIONS:
|
||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
|
||||
break;
|
||||
case SR_CONF_DEVICE_OPTIONS:
|
||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
|
||||
break;
|
||||
default:
|
||||
sr_err("Unknown config key: %d.", key);
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue