linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* exclusive access to I2C device
@ 2010-03-04 18:06 Pete Flugstad
       [not found] ` <84d4a6d51003041006i1b619d2l942d21ce1a9a069e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Flugstad @ 2010-03-04 18:06 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi!  We're running Linux 2.6.27 with i2c tools 3.0.2.

We have a number of userspace program using the raw i2c_smbus interface
to talk to a variety of devices. Right now, it seems like every program can open
up the device and issue commands, which interferes with an already running
command.

I see the code in open_i2c_bus using:

    	sprintf(filename, "/dev/i2c/%d", i2cbus);
	file = open(filename, O_RDWR);

Would adding O_EXCL to this open help to make things exclusive?  Or is there a
better way to do what I want.

Right now we're going to set up a daemon to arbitrate access to the I2C bus,
but it would be nice if we had something simpler, since now all apps have to
talk to the daemon.  I was thinking something along the lines of just telling
userspace to loop opening the device exclusively until that succeeds, run the
command,  then close the device.

Thanks,
Pete

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

end of thread, other threads:[~2010-08-10 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 18:06 exclusive access to I2C device Pete Flugstad
     [not found] ` <84d4a6d51003041006i1b619d2l942d21ce1a9a069e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 11:03   ` Jean Delvare

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).