X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fapi.c;h=eb0d186a90f55a7f0fcc2e9fdd5a4cea1becbaae;hb=208c1d35435626a11afa1ab301b2071b2a4e187b;hp=12af5c1db6660891406128b93879f8409ced74fd;hpb=41812aca436805b0614f2a8f31cf2f8ce494aea0;p=libsigrok.git diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 12af5c1d..eb0d186a 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include "protocol.h" #include "beaglelogic.h" @@ -165,6 +166,7 @@ static int dev_open(struct sr_dev_inst *sdi) /* Set fd and local attributes */ devc->pollfd.fd = devc->fd; devc->pollfd.events = G_IO_IN; + devc->pollfd.revents = 0; /* Get the default attributes */ beaglelogic_get_samplerate(devc); @@ -282,10 +284,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return beaglelogic_set_triggerflags(devc); case SR_CONF_CAPTURE_RATIO: devc->capture_ratio = g_variant_get_uint64(data); - if (devc->capture_ratio > 100) { - devc->capture_ratio = 0; + if (devc->capture_ratio > 100) return SR_ERR; - } return SR_OK; default: return SR_ERR_NA; @@ -337,13 +337,13 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * #define BUFUNIT_TIMEOUT_MS(devc) (100 + ((devc->bufunitsize * 1000) / \ (uint32_t)(devc->cur_samplerate))) -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, void *cb_data) { - (void)cb_data; struct dev_context *devc = sdi->priv; struct sr_trigger *trigger; + (void)cb_data; + if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -384,7 +384,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { struct dev_context *devc = sdi->priv; - struct sr_datafeed_packet pkt; (void)cb_data; @@ -399,9 +398,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) /* Remove session source and send EOT packet */ sr_session_source_remove_pollfd(sdi->session, &devc->pollfd); - pkt.type = SR_DF_END; - pkt.payload = NULL; - sr_session_send(sdi, &pkt); + std_session_send_df_end(sdi, LOG_PREFIX); return SR_OK; }