Re: IIO: Why cannot open two iio device node file descriptors simultaneously ?

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

 



On 07/31/14 18:07, Aniroop Mathur wrote:
> Dear IIO Community,
> Greetings !!
> 
> I am Aniroop Mathur working in Sensors kernel and HAL field.
> I have one question about IIO, for which i need your support.
> 
> I would like to open two file descriptors for IIO device node - /dev/iio:device0
> int fd1 = open("/dev/iio:device0",O_RDONLY);
> int fd2 = open("/dev/iio:device0",O_RDONLY);
> 
> But, only first open call succeeds.
> The second open calls fails with error "Device or Resource busy".
> 
> In normal input device, we can open as many event node file
> descriptors as we like.
> int fd1 = open("/dev/input/event1");
> int fd2 = open("/dev/input/event1");
> 
> Both calls succeeds for input subsystem case.
> 
> So, why restriction is present in IIO subsystem ?
Basically a different design descision for the userspace interfaces.  Input moves
a lot of handling and processing into the kernel.  For IIO, which at least sometimes
is dealing with much faster devices, this adds overhead.  Note that we remove
all overhead of description of data from the main data stream to reduce overhead
so that must be described elsewhere (sysfs).

If you really want to do that then we do have a prototype input client driver for IIO
(though it's not seen much work recently).

In theory it is possible to have more userspace exposed buffer associated with
a given IIO device, though right now this isn't actually done.  The intent of that
infrastructure is to provide splitting of data to multiple users within the kernel
(one might be IIO, another input and a third battery monitoring).

Ultimately if you want multiple userspace devices to share a datastream, then it
makes sense to avoid multiple switches in and out of the kernel and do it in userspace
instead.

Jonathan

> Why two iio device nodes cannot be open together ?
Not quite what I think you mean.  You mean, why can you not open the same device node
twice?
> 
> Thanks in advance !
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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