Skip to content

Commit

Permalink
usb: Add support for IIO events
Browse files Browse the repository at this point in the history
Provide the necesary callbacks to support IIO events with the USB
backend.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Nov 6, 2023
1 parent 82c9ae1 commit ba6f763
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ usb_create_block(struct iio_buffer_pdata *pdata, size_t size, void **data)
return iiod_client_create_block(pdata->pdata, size, data);
}

static struct iio_event_stream_pdata *
usb_open_events_fd(const struct iio_device *dev)
{
const struct iio_context *ctx = iio_device_get_context(dev);
struct iio_context_pdata *pdata = iio_context_get_pdata(ctx);

return iiod_client_open_event_stream(pdata->io_ctx.iiod_client, dev);
}

static const struct iio_backend_ops usb_ops = {
.scan = usb_context_scan,
.create = usb_create_context_from_args,
Expand All @@ -523,6 +532,10 @@ static const struct iio_backend_ops usb_ops = {
.free_block = iiod_client_free_block,
.enqueue_block = iiod_client_enqueue_block,
.dequeue_block = iiod_client_dequeue_block,

.open_ev = usb_open_events_fd,
.close_ev = iiod_client_close_event_stream,
.read_ev = iiod_client_read_event,
};

__api_export_if(WITH_USB_BACKEND_DYNAMIC)
Expand Down

0 comments on commit ba6f763

Please sign in to comment.