Skip to content

iio_push_to_buffers()

Purpose

Pushes one scan frame into the active IIO buffer.

#include <linux/iio/buffer.h>

Prototype

int iio_push_to_buffers(struct iio_dev *indio_dev, const void *data);

Parameters

  • indio_dev: IIO device that owns the buffer.
  • data: pointer to one scan frame.

Return Value

  • 0 on success.
  • Negative errno on failure.

Minimal Example

struct myadc_scan scan = { 0 };

scan.ch0 = value0;
scan.ch1 = value1;

return iio_push_to_buffers(indio_dev, &scan);

Common Pitfalls

  • The data layout must match enabled scan elements.
  • Alignment matters when timestamps or 64-bit fields are used.
  • Use iio_push_to_buffers_with_timestamp() when the frame needs an explicit timestamp.