linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Aniroop Mathur <aniroop.mathur@gmail.com>, linux-iio@vger.kernel.org
Subject: Re: IIO: Why cannot open two iio device node file descriptors simultaneously ?
Date: Sat, 02 Aug 2014 12:28:10 +0100	[thread overview]
Message-ID: <53DCCB4A.3020304@kernel.org> (raw)
In-Reply-To: <CADYu309fV8qNv0v03xr1T0eeLEV97YFPoAVkKdT8jZcom8uqGQ@mail.gmail.com>

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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-08-02 11:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 17:07 IIO: Why cannot open two iio device node file descriptors simultaneously ? Aniroop Mathur
2014-08-02 11:28 ` Jonathan Cameron [this message]
2014-08-02 13:07   ` Aniroop Mathur
2014-08-02 16:57     ` Jonathan Cameron
2014-08-03  8:11       ` Lars-Peter Clausen
2014-08-03  9:32         ` Aniroop Mathur
2014-08-04  7:18           ` Lars-Peter Clausen
2014-08-04 15:11             ` Aniroop Mathur
2014-08-04 17:20               ` Lars-Peter Clausen
2014-08-04 19:18                 ` Aniroop Mathur
  -- strict thread matches above, loose matches on Subject: below --
2014-08-01 17:17 Aniroop Mathur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DCCB4A.3020304@kernel.org \
    --to=jic23@kernel.org \
    --cc=aniroop.mathur@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).