X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fapi.c;h=b974010468f38dfb440198c150fe6bcb7e486286;hb=1079324f9e76c4775395e5baaf916f37d4785278;hp=12af5c1db6660891406128b93879f8409ced74fd;hpb=41812aca436805b0614f2a8f31cf2f8ce494aea0;p=libsigrok.git diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 12af5c1d..b9740104 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;