diff options
Diffstat (limited to 'Documentation/i2c/dev-interface')
-rw-r--r-- | Documentation/i2c/dev-interface | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index 09d6cda2a1fb..b849ad636583 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
@@ -14,9 +14,12 @@ C example | |||
14 | ========= | 14 | ========= |
15 | 15 | ||
16 | So let's say you want to access an i2c adapter from a C program. The | 16 | So let's say you want to access an i2c adapter from a C program. The |
17 | first thing to do is `#include <linux/i2c.h>" and "#include <linux/i2c-dev.h>. | 17 | first thing to do is "#include <linux/i2c-dev.h>". Please note that |
18 | Yes, I know, you should never include kernel header files, but until glibc | 18 | there are two files named "i2c-dev.h" out there, one is distributed |
19 | knows about i2c, there is not much choice. | 19 | with the Linux kernel and is meant to be included from kernel |
20 | driver code, the other one is distributed with lm_sensors and is | ||
21 | meant to be included from user-space programs. You obviously want | ||
22 | the second one here. | ||
20 | 23 | ||
21 | Now, you have to decide which adapter you want to access. You should | 24 | Now, you have to decide which adapter you want to access. You should |
22 | inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned | 25 | inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned |
@@ -78,7 +81,7 @@ Full interface description | |||
78 | ========================== | 81 | ========================== |
79 | 82 | ||
80 | The following IOCTLs are defined and fully supported | 83 | The following IOCTLs are defined and fully supported |
81 | (see also i2c-dev.h and i2c.h): | 84 | (see also i2c-dev.h): |
82 | 85 | ||
83 | ioctl(file,I2C_SLAVE,long addr) | 86 | ioctl(file,I2C_SLAVE,long addr) |
84 | Change slave address. The address is passed in the 7 lower bits of the | 87 | Change slave address. The address is passed in the 7 lower bits of the |
@@ -97,10 +100,10 @@ ioctl(file,I2C_PEC,long select) | |||
97 | ioctl(file,I2C_FUNCS,unsigned long *funcs) | 100 | ioctl(file,I2C_FUNCS,unsigned long *funcs) |
98 | Gets the adapter functionality and puts it in *funcs. | 101 | Gets the adapter functionality and puts it in *funcs. |
99 | 102 | ||
100 | ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset) | 103 | ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) |
101 | 104 | ||
102 | Do combined read/write transaction without stop in between. | 105 | Do combined read/write transaction without stop in between. |
103 | The argument is a pointer to a struct i2c_ioctl_rdwr_data { | 106 | The argument is a pointer to a struct i2c_rdwr_ioctl_data { |
104 | 107 | ||
105 | struct i2c_msg *msgs; /* ptr to array of simple messages */ | 108 | struct i2c_msg *msgs; /* ptr to array of simple messages */ |
106 | int nmsgs; /* number of messages to exchange */ | 109 | int nmsgs; /* number of messages to exchange */ |