X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbaylibre-acme%2Fapi.c;h=6153513bd5b3017f173a80870e09704741ac6ca7;hb=e91bb0a6c4a94957e4e998ca134dc806bec49a7f;hp=6b3b43e483126cd8097b222c3480b9b2c1200342;hpb=6433156c3275df933e4bf6dcfb020c91fca0ae86;p=libsigrok.git diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c index 6b3b43e4..6153513b 100644 --- a/src/hardware/baylibre-acme/api.c +++ b/src/hardware/baylibre-acme/api.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include "protocol.h" #include #include @@ -24,7 +25,7 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info; static const uint32_t devopts[] = { - SR_CONF_CONTINUOUS | SR_CONF_SET, + SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET, SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, @@ -141,21 +142,10 @@ err_out: return NULL; } -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, NULL); -} - static int dev_open(struct sr_dev_inst *sdi) { (void)sdi; - /* Nothing to do here. */ sdi->status = SR_ST_ACTIVE; return SR_OK; @@ -165,19 +155,11 @@ static int dev_close(struct sr_dev_inst *sdi) { (void)sdi; - /* Nothing to do here. */ sdi->status = SR_ST_INACTIVE; return SR_OK; } -static int cleanup(const struct sr_dev_driver *di) -{ - dev_clear(di); - - return SR_OK; -} - static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) @@ -348,7 +330,7 @@ static int dev_acquisition_open(const struct sr_dev_inst *sdi) return 0; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct itimerspec tspec = { @@ -356,8 +338,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) .it_value = { 0, 0 } }; - (void)cb_data; - if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -391,20 +371,16 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) sr_session_source_add_channel(sdi->session, devc->channel, G_IO_IN | G_IO_ERR, 1000, bl_acme_receive_data, (void *)sdi); - /* Send header packet to the session bus. */ std_session_send_df_header(sdi, LOG_PREFIX); devc->start_time = g_get_monotonic_time(); return SR_OK; } -static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_stop(struct sr_dev_inst *sdi) { - struct sr_datafeed_packet packet; struct dev_context *devc; - (void)cb_data; - devc = sdi->priv; if (sdi->status != SR_ST_ACTIVE) @@ -416,9 +392,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) g_io_channel_unref(devc->channel); devc->channel = NULL; - /* Send last packet. */ - packet.type = SR_DF_END; - sr_session_send(sdi, &packet); + std_session_send_df_end(sdi, LOG_PREFIX); if (devc->samples_missed > 0) sr_warn("%" PRIu64 " samples missed", devc->samples_missed); @@ -431,10 +405,9 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = { .longname = "BayLibre ACME (Another Cute Measurement Equipment)", .api_version = 1, .init = init, - .cleanup = cleanup, + .cleanup = std_cleanup, .scan = scan, - .dev_list = dev_list, - .dev_clear = dev_clear, + .dev_list = std_dev_list, .config_get = config_get, .config_set = config_set, .config_list = config_list,