]> git.pld-linux.org Git - packages/DirectFB.git/commitdiff
- bleh, it was even worse - use fragments of old i2c.h and i2c-dev.h instead of
authorJakub Bogusz <qboosh@pld-linux.org>
Wed, 12 Nov 2003 15:20:52 +0000 (15:20 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  internal kernel interface which WON'T work in userspace

Changed files:
    DirectFB-broken-i2c-workaround.patch -> 1.2

DirectFB-broken-i2c-workaround.patch

index 7b68261e03c12aad933da36a682e9be35309da8e..3897dac7625d7fb01242b4f013a384b70992a8d6 100644 (file)
@@ -1,6 +1,6 @@
 --- DirectFB-0.9.20/gfxdrivers/matrox/matrox_maven.c.orig      2003-07-08 14:44:19.000000000 +0000
-+++ DirectFB-0.9.20/gfxdrivers/matrox/matrox_maven.c   2003-11-11 18:29:42.000000000 +0000
-@@ -29,6 +29,13 @@
++++ DirectFB-0.9.20/gfxdrivers/matrox/matrox_maven.c   2003-11-12 15:16:53.000000000 +0000
+@@ -29,7 +29,61 @@
  #include <sys/stat.h>
  #include <fcntl.h>
  #include <sys/ioctl.h>
@@ -8,9 +8,57 @@
 + * but <linux/version.h> is included in <linux/i2c.h>, which is needed too
 + * ...and i2c.h is broken even (MUCH!) more, because it uses internal kernel types
 + * inside not #ifdef __KERNEL__-ed part!!! argh!!! */
-+#define __KERNEL__
-+#include <linux/i2c.h>
-+#undef __KERNEL__
++#include <linux/version.h>
  #include <linux/i2c-dev.h>
++#ifndef I2C_SLAVE
++/* #include <linux/i2c.h> cannot be used with i2c 2.8.x - it's for internal
++ * kernel use; stuff below is copied from i2c.h and old i2c-dev.h */
++#define I2C_SLAVE     0x0703  /* Change slave address                 */
++                              /* Attn.: Slave address is 7 or 10 bits */
++/*
++ * Data for SMBus Messages
++ */
++#define I2C_SMBUS_BLOCK_MAX     32      /* As specified in SMBus standard */
++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 */
++};
++#define I2C_SMBUS       0x0720  /* SMBus-level access */
++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);
++}
++/* smbus_access read or write markers */
++#define I2C_SMBUS_WRITE 0
++#define I2C_SMBUS_BYTE_DATA         2
++#define I2C_SMBUS_WORD_DATA         3
++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
  
  #include <misc/memcpy.h>
+ #include <misc/util.h>
This page took 0.038067 seconds and 4 git commands to generate.