* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include "protocol.h"
static const uint32_t scanopts[] = {
int ret = maynuo_m97_get_model_version(modbus, &id, &version);
if (ret != SR_OK)
return NULL;
- for (i=0; i<ARRAY_SIZE(supported_models); i++)
+ for (i = 0; i < ARRAY_SIZE(supported_models); i++)
if (id == supported_models[i].id) {
model = &supported_models[i];
break;
}
if (model == NULL) {
- sr_err("Unkown model: %d.", id);
+ sr_err("Unknown model: %d.", id);
return NULL;
}
if (!g_slist_find_custom(options, &default_modbusaddr, config_compare))
opts = g_slist_prepend(opts, &default_modbusaddr);
- devices = sr_modbus_scan(di->priv, opts, probe_device);
+ devices = sr_modbus_scan(di->context, opts, probe_device);
while (opts != options)
opts = g_slist_delete_link(opts, opts);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_modbus_dev_inst *modbus;
- struct sr_datafeed_packet packet;
(void)cb_data;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- /* End of last frame. */
- packet.type = SR_DF_END;
- sr_session_send(sdi, &packet);
+ std_session_send_df_end(sdi, LOG_PREFIX);
modbus = sdi->conn;
sr_modbus_source_remove(sdi->session, modbus);
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};