Skip to content

Commit

Permalink
serial: 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 serial
backend.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Nov 8, 2023
1 parent 0390387 commit 6c19715
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ serial_create_block(struct iio_buffer_pdata *buf, size_t size, void **data)
return iiod_client_create_block(buf->pdata, size, data);
}

static struct iio_event_stream_pdata *
serial_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->iiod_client, dev);
}

static const struct iio_backend_ops serial_ops = {
.create = serial_create_context_from_args,
.read_attr = serial_read_attr,
Expand All @@ -252,6 +261,10 @@ static const struct iio_backend_ops serial_ops = {
.free_block = iiod_client_free_block,
.enqueue_block = iiod_client_enqueue_block,
.dequeue_block = iiod_client_dequeue_block,

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

__api_export_if(WITH_SERIAL_BACKEND_DYNAMIC)
Expand Down

0 comments on commit 6c19715

Please sign in to comment.