File DirectFB-0.9.24-matroxi2c.diff of Package DirectFB

--- DirectFB-1.0.1/gfxdrivers/matrox/i2c-userspace.h
+++ DirectFB-1.0.1/gfxdrivers/matrox/i2c-userspace.h
@@ -0,0 +1,66 @@
+#ifndef I2C_USERSPACE_H
+#define I2C_USERSPACE_H
+/* copied from i2c-dev.h,i2c.h */
+
+#define I2C_SLAVE       0x0703  /* Change slave address                 */
+                                /* Attn.: Slave address is 7 or 10 bits */
+#define I2C_SMBUS       0x0720  /* SMBus-level access */
+/* smbus_access read or write markers */
+#define I2C_SMBUS_READ  1
+#define I2C_SMBUS_WRITE 0
+/* SMBus transaction types (size parameter in the above functions)
+   Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
+#define I2C_SMBUS_QUICK             0
+#define I2C_SMBUS_BYTE              1
+#define I2C_SMBUS_BYTE_DATA         2
+#define I2C_SMBUS_WORD_DATA         3
+#define I2C_SMBUS_PROC_CALL         4
+#define I2C_SMBUS_BLOCK_DATA        5
+#define I2C_SMBUS_I2C_BLOCK_DATA    6
+#define I2C_SMBUS_BLOCK_PROC_CALL   7           /* SMBus 2.0 */
+#define I2C_SMBUS_BLOCK_DATA_PEC    8           /* SMBus 2.0 */
+#define I2C_SMBUS_PROC_CALL_PEC     9           /* SMBus 2.0 */
+#define I2C_SMBUS_BLOCK_PROC_CALL_PEC  10       /* SMBus 2.0 */
+#define I2C_SMBUS_WORD_DATA_PEC    11           /* SMBus 2.0 */
+
+#define I2C_SMBUS_BLOCK_MAX     32      /* As specified in SMBus standard */
+#define I2C_SMBUS_I2C_BLOCK_MAX 32      /* Not specified but we use same structure */
+
+
+union i2c_smbus_data {
+        __u8 byte;
+        __u16 word;
+        __u8 block[I2C_SMBUS_BLOCK_MAX + 3]; /* block[0] is used for length */
+                          /* one more for read length in block process call */
+                                                    /* and one more for PEC */
+};
+
+static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
+                                     int size, union i2c_smbus_data *data)
+{
+        struct i2c_smbus_ioctl_data args;
+
+        args.read_write = read_write;
+        args.command = command;
+        args.size = size;
+        args.data = data;
+        return ioctl(file,I2C_SMBUS,&args);
+}
+static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command,
+                                              __u8 value)
+{
+        union i2c_smbus_data data;
+        data.byte = value;
+        return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+                                I2C_SMBUS_BYTE_DATA, &data);
+}
+static inline __s32 i2c_smbus_write_word_data(int file, __u8 command,
+                                              __u16 value)
+{
+        union i2c_smbus_data data;
+        data.word = value;
+        return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+                                I2C_SMBUS_WORD_DATA, &data);
+}
+
+#endif
--- DirectFB-1.0.1/gfxdrivers/matrox/matrox_maven.c
+++ DirectFB-1.0.1/gfxdrivers/matrox/matrox_maven.c
@@ -34,7 +34,7 @@
 #include <errno.h>
 #include <dirent.h>
 
-#include <linux/i2c.h>
+//#include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 
 #include <directfb.h>
@@ -51,6 +51,10 @@
 #include "matrox_maven.h"
 
 #define SYS_CLASS_I2C_DEV "/sys/class/i2c-dev"
+#ifndef I2C_SLAVE
+#include "i2c-userspace.h"
+#endif
+
 
 static void
 maven_write_byte( MatroxMavenData  *mav,