[PATCH xf86-input-synaptics v2 05/13] Introduce SynapticsCopyHwState function

Chase Douglas chase.douglas at canonical.com
Thu Feb 9 18:24:49 PST 2012


Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/alpscomm.c      |    2 +-
 src/eventcomm.c     |    2 +-
 src/ps2comm.c       |    2 +-
 src/synaptics.c     |   11 +++++++++--
 src/synproto.h      |    2 ++
 test/fake-symbols.c |    6 ++++++
 6 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/alpscomm.c b/src/alpscomm.c
index dbc3554..8988e6b 100644
--- a/src/alpscomm.c
+++ b/src/alpscomm.c
@@ -218,7 +218,7 @@ ALPSReadHwState(InputInfoPtr pInfo,
 
     ALPS_process_packet(buf, hw);
 
-    *hwRet = *hw;
+    SynapticsCopyHwState(hwRet, hw);
     return TRUE;
 }
 
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 1ae8442..a414827 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -714,7 +714,7 @@ EventReadHwState(InputInfoPtr pInfo,
 		EventProcessTouch(pInfo);
 		hw->numFingers = count_fingers(comm);
 		hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
-		*hwRet = *hw;
+		SynapticsCopyHwState(hwRet, hw);
 		return TRUE;
 	    }
 	    break;
diff --git a/src/ps2comm.c b/src/ps2comm.c
index 74bd937..5b34414 100644
--- a/src/ps2comm.c
+++ b/src/ps2comm.c
@@ -650,7 +650,7 @@ PS2ReadHwStateProto(InputInfoPtr pInfo,
 	}
     }
     hw->millis = GetTimeInMillis();
-    *hwRet = *hw;
+    SynapticsCopyHwState(hwRet, hw);
     return TRUE;
 }
 
diff --git a/src/synaptics.c b/src/synaptics.c
index c74f6b7..f7d21ea 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1337,7 +1337,7 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
     sigstate = xf86BlockSIGIO();
 
     priv->hwState->millis += now - priv->timer_time;
-    *hw = *priv->hwState;
+    SynapticsCopyHwState(hw, priv->hwState);
     delay = HandleState(pInfo, hw, hw->millis, TRUE);
 
     priv->timer_time = now;
@@ -1378,7 +1378,7 @@ ReadInput(InputInfoPtr pInfo)
     Bool newDelay = FALSE;
 
     while (SynapticsGetHwState(pInfo, priv, hw)) {
-	*priv->hwState = *hw;
+	SynapticsCopyHwState(priv->hwState, hw);
 	delay = HandleState(pInfo, hw, hw->millis, FALSE);
 	newDelay = TRUE;
     }
@@ -2842,3 +2842,10 @@ SynapticsHwStateFree(struct SynapticsHwState **hw)
     free(*hw);
     *hw = NULL;
 }
+
+void
+SynapticsCopyHwState(struct SynapticsHwState *dst,
+                     const struct SynapticsHwState *src)
+{
+    *dst = *src;
+}
diff --git a/src/synproto.h b/src/synproto.h
index 74becca..8d50ce6 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -95,5 +95,7 @@ extern struct SynapticsProtocolOperations psm_proto_operations;
 
 extern struct SynapticsHwState *SynapticsHwStateAlloc(SynapticsPrivate *priv);
 extern void SynapticsHwStateFree(struct SynapticsHwState **hw);
+extern void SynapticsCopyHwState(struct SynapticsHwState *dst,
+                                 const struct SynapticsHwState *src);
 
 #endif /* _SYNPROTO_H_ */
diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index 389c3c8..b674387 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -1,4 +1,5 @@
 #include "fake-symbols.h"
+#include "synproto.h"
 
 _X_EXPORT
 int xf86ReadSerial (int fd, void *buf, int count)
@@ -481,3 +482,8 @@ _X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid,
 {
 }
 #endif
+
+void SynapticsCopyHwState(struct SynapticsHwState *src,
+                          const struct SynapticsHwState *dst)
+{
+}
-- 
1.7.8.3



More information about the xorg-devel mailing list