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

Chase Douglas chase.douglas at canonical.com
Thu Feb 9 09:16:41 PST 2012


On 02/09/2012 03:17 PM, Peter Hutterer wrote:
> On Wed, Feb 08, 2012 at 06:35:14PM -0800, Chase Douglas wrote:
>> 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 058ed55..3455a71 100644
>> --- a/src/synaptics.c
>> +++ b/src/synaptics.c
>> @@ -1340,7 +1340,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;
>> @@ -1381,7 +1381,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;
>>      }
>> @@ -2844,3 +2844,10 @@ SynapticsHwStateFree(struct SynapticsHwState *hw)
>>  {
>>      free(hw);
>>  }
>> +
>> +void
>> +SynapticsCopyHwState(struct SynapticsHwState *dst,
>> +                     const struct SynapticsHwState *src)
>> +{
>> +    *dst = *src;
>> +}
>> diff --git a/src/synproto.h b/src/synproto.h
>> index 4245fcc..b2afda6 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)
>> +{
>> +}
> 
> this should not be necessary - the fake symbols are only for server
> functions.

eventcomm.c calls this function. Would you rather link in synaptics.c?

-- Chase


More information about the xorg-devel mailing list