public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* Simultaneously access to one i2c/dev-interface from different process to different i2c devices
@ 2014-11-05  8:58 Matthias Klein
       [not found] ` <5459E6C4.3060107-mnoMUKZXHfEb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Klein @ 2014-11-05  8:58 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hello,

is it possible from different processes to access different i2c devices 
on the same i2c bus/adapter using the i2c/dev-interface from userland?

Or can the i2c/dev-interface only ne used from a single process?


How does the simultaneously access to one adapter works for i2c device 
drivers inside the kernel?
Do they fail on a simultaneously access, or do they wait until the i2c 
adapter is ready/free for use?


Best regards,
Matthias

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Simultaneously access to one i2c/dev-interface from different process to different i2c devices
       [not found] ` <5459E6C4.3060107-mnoMUKZXHfEb1SvskN2V4Q@public.gmane.org>
@ 2014-11-05 10:19   ` Danielle Costantino
  0 siblings, 0 replies; 2+ messages in thread
From: Danielle Costantino @ 2014-11-05 10:19 UTC (permalink / raw)
  To: Matthias Klein; +Cc: linux-i2c

The kernel can handle the i2c-dev interface very well from multiple process.

When you open a file descriptor (/dev/i2c-x) a new client is created
on the i2c adapter corresponding to the id of the i2c dev just opened.
The client data is allocated into the file descriptor's private data.
each possess should open its own i2c dev fd for each adapter that
needs to be accessed. (the fd should also be closed within the i2c
process call wrapper you write). The kernel takes care of all locking
and the i2c-bus driver schedules the message ques. Just be shure to
open the i2c-dev with the non-blocking flag, to prevent locking out
your other threads/process from opening the device.

- Danielle

On Wed, Nov 5, 2014 at 12:58 AM, Matthias Klein
<matthias.klein-mnoMUKZXHfEb1SvskN2V4Q@public.gmane.org> wrote:
> Hello,
>
> is it possible from different processes to access different i2c devices on
> the same i2c bus/adapter using the i2c/dev-interface from userland?
>
> Or can the i2c/dev-interface only ne used from a single process?
>
>
> How does the simultaneously access to one adapter works for i2c device
> drivers inside the kernel?
> Do they fail on a simultaneously access, or do they wait until the i2c
> adapter is ready/free for use?
>
>
> Best regards,
> Matthias
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
- Danielle Costantino

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-05 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05  8:58 Simultaneously access to one i2c/dev-interface from different process to different i2c devices Matthias Klein
     [not found] ` <5459E6C4.3060107-mnoMUKZXHfEb1SvskN2V4Q@public.gmane.org>
2014-11-05 10:19   ` Danielle Costantino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox