uni-t-dmm: Adjust to GVariant-based sr_config_* functions
This commit is contained in:
parent
ede25f4e6f
commit
7d93a62ea3
|
@ -26,17 +26,15 @@
|
||||||
|
|
||||||
#define UNI_T_UT_D04_NEW "1a86.e008"
|
#define UNI_T_UT_D04_NEW "1a86.e008"
|
||||||
|
|
||||||
static const int hwopts[] = {
|
static const int32_t hwopts[] = {
|
||||||
SR_CONF_CONN,
|
SR_CONF_CONN,
|
||||||
0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int hwcaps[] = {
|
static const int32_t hwcaps[] = {
|
||||||
SR_CONF_MULTIMETER,
|
SR_CONF_MULTIMETER,
|
||||||
SR_CONF_LIMIT_SAMPLES,
|
SR_CONF_LIMIT_SAMPLES,
|
||||||
SR_CONF_LIMIT_MSEC,
|
SR_CONF_LIMIT_MSEC,
|
||||||
SR_CONF_CONTINUOUS,
|
SR_CONF_CONTINUOUS,
|
||||||
0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
|
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
|
||||||
|
@ -99,7 +97,7 @@ static GSList *hw_scan(GSList *options)
|
||||||
src = l->data;
|
src = l->data;
|
||||||
switch (src->key) {
|
switch (src->key) {
|
||||||
case SR_CONF_CONN:
|
case SR_CONF_CONN:
|
||||||
conn = src->value;
|
conn = g_variant_get_string(src->data, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +170,7 @@ static int hw_cleanup(void)
|
||||||
return SR_OK;
|
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;
|
struct dev_context *devc;
|
||||||
|
|
||||||
|
@ -181,20 +179,20 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_LIMIT_MSEC:
|
case SR_CONF_LIMIT_MSEC:
|
||||||
/* TODO: Not yet implemented. */
|
/* TODO: Not yet implemented. */
|
||||||
if (*(const uint64_t *)value == 0) {
|
if (g_variant_get_uint64(data) == 0) {
|
||||||
sr_err("Time limit cannot be 0.");
|
sr_err("Time limit cannot be 0.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
devc->limit_msec = *(const uint64_t *)value;
|
devc->limit_msec = g_variant_get_uint64(data);
|
||||||
sr_dbg("Setting time limit to %" PRIu64 "ms.",
|
sr_dbg("Setting time limit to %" PRIu64 "ms.",
|
||||||
devc->limit_msec);
|
devc->limit_msec);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
if (*(const uint64_t *)value == 0) {
|
if (g_variant_get_uint64(data) == 0) {
|
||||||
sr_err("Sample limit cannot be 0.");
|
sr_err("Sample limit cannot be 0.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
devc->limit_samples = *(const uint64_t *)value;
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
sr_dbg("Setting sample limit to %" PRIu64 ".",
|
sr_dbg("Setting sample limit to %" PRIu64 ".",
|
||||||
devc->limit_samples);
|
devc->limit_samples);
|
||||||
break;
|
break;
|
||||||
|
@ -207,17 +205,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
*data = hwopts;
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = hwcaps;
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
Loading…
Reference in New Issue