patch: make i2c(8) usable for scripting

Ian Lepore ian at freebsd.org
Tue May 18 15:27:33 UTC 2021


On Sun, 2021-05-16 at 06:51 +0000, Poul-Henning Kamp wrote:
> --------
> Ian Lepore writes:
> 
> > On Sat, 2021-05-15 at 20:14 +0000, Poul-Henning Kamp wrote:
> > > The /dev/iic%d filedescriptor is opened and closed for every
> > > single
> > > command, in the hope that it will aid multiple separate programs
> > > sharing I2C busses.  I have not actually tried that yet, so it
> > > may
> > > need more work (exclusive opens etc.).
> > 
> > There should be no need to do that.  The i2c bus is arbitrated in
> > iicbus/iiconf.c and most all the in-tree drivers now use either
> > explicit iicbus_request_bus() calls, or use
> > iicbus_transfer_excl(). 
> > Certainly users of iic(4) don't need to be protected from each
> > other;
> > everything in the driver that uses the bus does so inside of
> > request_bus / release_bus calls.
> 
> How does that work when i2c(8) (by default) issues discrete
> start/stop commands ?
> 
> Related to that:  Should i2c(8)'s -m default be changed to 'tr' ?
> 

I just realized I didn't reply to the second question...

Yes, I think -m tr should be the default.  It should work on all
hardware.  The only real reason I can think of to support discrete
start and stop commands in i2c(8) is for testing drivers.

-- Ian




More information about the freebsd-hackers mailing list