Exemple #1
0
/* TODO: Use sr_dev_inst to store connection handle & use std_dev_clear(). */
static int dev_clear(const struct sr_dev_driver *di)
{
	GSList *l;
	struct sr_dev_inst *sdi;
	struct drv_context *drvc;
	struct dev_context *devc;
	int ret = SR_OK;

	if (!(drvc = di->context))
		return SR_OK;

	/* Properly close and free all devices. */
	for (l = drvc->instances; l; l = l->next) {
		if (!(sdi = l->data)) {
			/* Log error, but continue cleaning up the rest. */
			sr_err("%s: sdi was NULL, continuing", __func__);
			ret = SR_ERR_BUG;
			continue;
		}
		if (!(devc = sdi->priv)) {
			/* Log error, but continue cleaning up the rest. */
			sr_err("%s: sdi->priv was NULL, continuing", __func__);
			ret = SR_ERR_BUG;
			continue;
		}
		std_serial_dev_close(sdi);
		sr_serial_dev_inst_free(devc->serial);
		sr_dev_inst_free(sdi);
	}
	g_slist_free(drvc->instances);
	drvc->instances = NULL;

	return ret;
}
Exemple #2
0
static int dev_close(struct sr_dev_inst *sdi)
{
	/*
	 * Ensure device gets properly disconnected even when there was
	 * no acquisition.
	 */
	pce_322a_disconnect(sdi);

	return std_serial_dev_close(sdi);
}
Exemple #3
0
static int dev_close(struct sr_dev_inst *sdi)
{
	struct dev_context *devc;

	std_serial_dev_close(sdi);

	sdi->status = SR_ST_INACTIVE;
	if ((devc = sdi->priv))
		devc->model = METRAHIT_NONE;

	return SR_OK;
}
Exemple #4
0
static int dev_close(struct sr_dev_inst *sdi)
{
	struct dev_context *devc;

	devc = sdi->priv;
	if (devc->config_dirty)
		/* Some configuration changes were queued up but didn't
		 * get sent to the device, likely because we were never
		 * in acquisition mode. Send them out now. */
		send_config(sdi);

	return std_serial_dev_close(sdi);
}
Exemple #5
0
static int dev_close(struct sr_dev_inst *sdi)
{
	struct dev_context *devc;

	std_serial_dev_close(sdi);

	/* Free dynamically allocated resources. */
	if ((devc = sdi->priv) && devc->version) {
		g_free(devc->version);
		devc->version = NULL;
		g_timer_destroy(devc->elapsed_msec);
	}

	return SR_OK;
}
Exemple #6
0
static int dev_close(struct sr_dev_inst *sdi)
{
	struct dev_context *devc;

	std_serial_dev_close(sdi);

	sdi->status = SR_ST_INACTIVE;

	/* Free dynamically allocated resources. */
	if ((devc = sdi->priv) && devc->elapsed_msec) {
		g_timer_destroy(devc->elapsed_msec);
		devc->elapsed_msec = NULL;
		devc->model = METRAHIT_NONE;
	}

	return SR_OK;
}