|
From: <sv...@va...> - 2007-03-07 10:07:15
|
Author: tom
Date: 2007-03-07 10:07:13 +0000 (Wed, 07 Mar 2007)
New Revision: 6631
Log:
Add support for some I2C ioctls.
Based on patch from Jean Delvare <kh...@li...>.
Fixes bug #142186.
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/include/vki/vki-linux.h
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2007-03-07 09:48:32 UTC (rev 6630)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2007-03-07 10:07:13 UTC (rev 6631)
@@ -4113,6 +4113,16 @@
}
break;
+ /* I2C (/dev/i2c-*) ioctls */
+ case VKI_I2C_SLAVE:
+ case VKI_I2C_SLAVE_FORCE:
+ case VKI_I2C_TENBIT:
+ case VKI_I2C_PEC:
+ break;
+ case VKI_I2C_FUNCS:
+ PRE_MEM_WRITE( "ioctl(I2C_FUNCS)", ARG3, sizeof(unsigned long) );
+ break;
+
/* We don't have any specific information on it, so
try to do something reasonable based on direction and
size bits. The encoding scheme is described in
@@ -4821,6 +4831,16 @@
}
break;
+ /* I2C (/dev/i2c-*) ioctls */
+ case VKI_I2C_SLAVE:
+ case VKI_I2C_SLAVE_FORCE:
+ case VKI_I2C_TENBIT:
+ case VKI_I2C_PEC:
+ break;
+ case VKI_I2C_FUNCS:
+ POST_MEM_WRITE( ARG3, sizeof(unsigned long) );
+ break;
+
/* We don't have any specific information on it, so
try to do something reasonable based on direction and
size bits. The encoding scheme is described in
Modified: trunk/include/vki/vki-linux.h
===================================================================
--- trunk/include/vki/vki-linux.h 2007-03-07 09:48:32 UTC (rev 6630)
+++ trunk/include/vki/vki-linux.h 2007-03-07 10:07:13 UTC (rev 6631)
@@ -2314,6 +2314,20 @@
#define VKI_USBDEVFS_CONNECTINFO _VKI_IOW('U', 17, struct vki_usbdevfs_connectinfo)
#define VKI_USBDEVFS_IOCTL _VKI_IOWR('U', 18, struct vki_usbdevfs_ioctl)
+//----------------------------------------------------------------------
+// From linux-2.6.20.1/include/linux/i2c.h
+//----------------------------------------------------------------------
+
+#define VKI_I2C_SLAVE 0x0703 /* Change slave address */
+ /* Attn.: Slave address is 7 or 10 bits */
+#define VKI_I2C_SLAVE_FORCE 0x0706 /* Change slave address */
+ /* Attn.: Slave address is 7 or 10 bits */
+ /* This changes the address, even if it */
+ /* is already taken! */
+#define VKI_I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
+#define VKI_I2C_FUNCS 0x0705 /* Get the adapter functionality */
+#define VKI_I2C_PEC 0x0708 /* != 0 for SMBus PEC */
+
#endif // __VKI_LINUX_H
/*--------------------------------------------------------------------*/
|