Re: buffer read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/23/19 8:43 PM, Grim, Dennis wrote:
> On Linux 2.6.0, the read() in the following code does not block when the buffer is empty.
> 
> char data[1026];
> int fd = open("/dev/iio:device0", O_RDONLY);
> size_t count = read(fd, data, 1026);
> 
> count is 0.
> 
> Data pushed to the buffer with iio_push_to_buffers() does read correctly (after a trigger).
> 
> What might I be missing?


Hi,

Are you sure about the version number?

Anyway, in earlier versions of Linux IIO was always non-blocking. You
can use the poll() or select() API to wait for data to arrive before
issuing the read() command.

Also make sure that the buffer is enabled in userspace if it is disabled
data sent by iio_push_to_buffers() will be discarded.

Support for blocking IO was added for v3.14 in 2013.

- Lars



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux