SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
};
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
};
-/* The IDs in this list are only guessed and needs to be verified
- against some real hardware. If at least a few of them matches,
- it will probably be safe to enable the others. */
+/*
+ * The IDs in this list are only guessed and needs to be verified
+ * against some real hardware. If at least a few of them matches,
+ * it will probably be safe to enable the others.
+ */
static const struct maynuo_m97_model supported_models[] = {
// { 53, "M9711" , 30, 150, 150 },
// { 54, "M9712" , 30, 150, 300 },
static const struct maynuo_m97_model supported_models[] = {
// { 53, "M9711" , 30, 150, 150 },
// { 54, "M9712" , 30, 150, 300 },
// { 102, "M9812B" , 15, 500, 300 },
};
// { 102, "M9812B" , 15, 500, 300 },
};
-SR_PRIV struct sr_dev_driver maynuo_m97_driver_info;
-
-static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
-{
- return std_init(sr_ctx, di, LOG_PREFIX);
-}
+static struct sr_dev_driver maynuo_m97_driver_info;
sdi->vendor = g_strdup("Maynuo");
sdi->model = g_strdup(model->name);
sdi->version = g_strdup_printf("v%d.%d", version/10, version%10);
sdi->vendor = g_strdup("Maynuo");
sdi->model = g_strdup(model->name);
sdi->version = g_strdup_printf("v%d.%d", version/10, version%10);
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
struct sr_config default_serialcomm = {
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
struct sr_config default_serialcomm = {
- .key = SR_CONF_SERIALCOMM,
- .data = g_variant_new_string("9600/8n1"),
+ .key = SR_CONF_SERIALCOMM,
+ .data = g_variant_new_string("9600/8n1"),
- .key = SR_CONF_MODBUSADDR,
- .data = g_variant_new_uint64(1),
+ .key = SR_CONF_MODBUSADDR,
+ .data = g_variant_new_uint64(1),
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
-static int dev_clear(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, g_free);
-}
-
- if (modbus) {
- devc = sdi->priv;
- if (devc->expecting_registers) {
- /* Wait for the last data that was requested from the device. */
- uint16_t registers[devc->expecting_registers];
- sr_modbus_read_holding_registers(modbus, -1,
- devc->expecting_registers,
- registers);
- }
+ if (!modbus)
+ return SR_ERR_BUG;
- if (sr_modbus_close(modbus) < 0)
- return SR_ERR;
- sdi->status = SR_ST_INACTIVE;
+ if (devc->expecting_registers) {
+ /* Wait for the last data that was requested from the device. */
+ uint16_t registers[devc->expecting_registers];
+ sr_modbus_read_holding_registers(modbus, -1,
+ devc->expecting_registers, registers);
}
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
}
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
- std_session_send_df_header(sdi, LOG_PREFIX);
-
- devc->num_samples = 0;
- devc->starttime = g_get_monotonic_time();
+ sr_sw_limits_acquisition_start(&devc->limits);
+ std_session_send_df_header(sdi);
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
- std_session_send_df_end(sdi, LOG_PREFIX);
+ std_session_send_df_end(sdi);
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,