X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fapi.c;h=b974010468f38dfb440198c150fe6bcb7e486286;hb=9cfc695ffe5f04622f61acb98ea4ac91c3f4ffc3;hp=5f1d35fc1716f88172024d0795d1d464461c232b;hpb=98fec29ecbb5093856b69311be8e937c162edded;p=libsigrok.git
diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c
index 5f1d35fc..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"
@@ -87,7 +88,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
int i, maxch;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
/* Probe for /dev/beaglelogic */
@@ -146,7 +147,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@@ -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);
@@ -205,7 +207,7 @@ static int cleanup(const struct sr_dev_driver *di)
GSList *l;
/* unused driver */
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
return SR_OK;
/* Clean up the instances */
@@ -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;
@@ -422,5 +422,5 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};