[i2c] Userspace Headers for recent kernels

Jean Delvare khali at linux-fr.org
Wed Sep 20 10:38:34 CEST 2006


Hi Don,

> > For a simple example of user-space tool using i2c-dev, please see
> > prog/dump/i2cset.c in the lm_sensors package.
> 
> Thanks for the reply.  Yes I already have been looking at that code.
> It doesn't work for me and I am trying to figure out why.
> 
> Can you point me at the code that implements the version of
> i2c_smbus_write_byte() that is used by this program?  The only one I can
> find is in the kernel?  I probably need to include some function or library
> with my small app.

It is an inline function in the i2c-dev.h file:

static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
{
        return i2c_smbus_access(file,I2C_SMBUS_WRITE,value,
                                I2C_SMBUS_BYTE,NULL);
}

As I explained yesterday, this is merely a wrapper around an ioctl.

You do not need any additional function or library, just #include the
right i2c-dev.h file and you are done.

-- 
Jean Delvare



More information about the i2c mailing list