lkml.org 
[lkml]   [2011]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] Input: elantech - work around EC buffer
On 08/18/2011 09:57 AM, JJ Ding wrote:
> With some EC chips, when we resync due to bad packets, those bad bytes would
> still remain in EC's buffer area. That makes us always get bad data back,
> no matter what.
>
> So shift packet for 1 byte when encounter bad packet, until we get rid of those
> bytes.
>
> Signed-off-by: JJ Ding<jj_ding@emc.com.tw>
> ---
> drivers/input/mouse/elantech.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index 032181c..7b9b6e5 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -411,20 +411,25 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
> switch (etd->hw_version) {
> case 1:
> if (etd->paritycheck&& !elantech_check_parity_v1(psmouse))
> - return PSMOUSE_BAD_DATA;
> + goto bad_packet;
>
> elantech_report_absolute_v1(psmouse);
> break;
>
> case 2:
> if (etd->paritycheck&& !packet_simple_check_v2(psmouse))
> - return PSMOUSE_BAD_DATA;
> + goto bad_packet;
>
> elantech_report_absolute_v2(psmouse);
> break;
> }
>
> return PSMOUSE_FULL_PACKET;
> +
> + bad_packet:
You may introduce space here.
> + memmove(psmouse->packet, psmouse->packet + 1, psmouse->pktsize - 1);
> + psmouse->pktcnt--;
> + return PSMOUSE_GOOD_DATA;
> }
>
> /*


--
Thanks
Wanlong Gao


\
 
 \ /
  Last update: 2011-08-18 05:11    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog