#include <math.h>
#include <string.h>
#include "protocol.h"
+
SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *buflen);
SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_list args);
SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char *fmt, ...);
#define VENDOR_MOTECH "Motech"
-/** Driver capabilities generic. */
-static const uint32_t drvopts[] = {
- /* Device class */
- SR_CONF_POWER_SUPPLY,
-};
-
/** Driver scanning options. */
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_SERIALCOMM,
};
+/** Driver capabilities generic. */
+static const uint32_t drvopts[] = {
+ /* Device class */
+ SR_CONF_POWER_SUPPLY,
+};
+
/** Hardware capabilities generic. */
static const uint32_t devopts[] = {
/* Device class */
- SR_CONF_POWER_SUPPLY,
/* Acquisition modes. */
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
GVariant *gvar;
GVariantBuilder gvb;
- /* Driver options, no device instance necessary. */
- switch (key) {
- case SR_CONF_SCAN_OPTIONS:
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
- return SR_OK;
- case SR_CONF_DEVICE_OPTIONS:
- if (sdi)
- break;
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t));
- return SR_OK;
- default:
- if (!sdi)
- return SR_ERR_ARG;
- devc = sdi->priv;
- break;
- }
+ devc = (sdi) ? sdi->priv : NULL;
/* Device options, independent from channel groups. */
if (!cg) {
switch (key) {
+ case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
- *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
- devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
- return SR_OK;
+ return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_CHANNEL_CONFIG:
if (devc->model->modelid <= LPS_303) {
/* The 1-channel models. */