Skip to content

Commit

Permalink
Merge pull request #385 from analogdevicesinc/rgetz-add-triggers-to-u…
Browse files Browse the repository at this point in the history
…sb-backend

usb: Add trigger support to the USB backend
  • Loading branch information
dNechita authored Feb 21, 2020
2 parents e8da44b + 7608823 commit 490c4aa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion usb.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* libiio - Library for interfacing industrial I/O (IIO) devices
*
* Copyright (C) 2015 Analog Devices, Inc.
* Copyright (C) 2015 - 2020 Analog Devices, Inc.
* Author: Paul Cercueil <[email protected]>
*
* This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -399,6 +399,25 @@ static int usb_set_timeout(struct iio_context *ctx, unsigned int timeout)
return ret;
}

static int usb_get_trigger(const struct iio_device *dev,
const struct iio_device **trigger)
{
struct iio_context_pdata *pdata = dev->ctx->pdata;

return iiod_client_get_trigger(pdata->iiod_client,
&pdata->io_ctx, dev, trigger);
}

static int usb_set_trigger(const struct iio_device *dev,
const struct iio_device *trigger)
{
struct iio_context_pdata *pdata = dev->ctx->pdata;

return iiod_client_set_trigger(pdata->iiod_client,
&pdata->io_ctx, dev, trigger);
}


static void usb_shutdown(struct iio_context *ctx)
{
unsigned int i;
Expand Down Expand Up @@ -514,6 +533,8 @@ static const struct iio_backend_ops usb_ops = {
.read_channel_attr = usb_read_chn_attr,
.write_device_attr = usb_write_dev_attr,
.write_channel_attr = usb_write_chn_attr,
.get_trigger = usb_get_trigger,
.set_trigger = usb_set_trigger,
.set_kernel_buffers_count = usb_set_kernel_buffers_count,
.set_timeout = usb_set_timeout,
.shutdown = usb_shutdown,
Expand Down

0 comments on commit 490c4aa

Please sign in to comment.