lkml.org 
[lkml]   [2019]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] input: keyboard: imx_sc_key: Only take the valid data from SCU firmware as key state
On Fri, Dec 13, 2019 at 10:08:29AM +0800, Anson Huang wrote:
> When reading key state from SCU, the response data from SCU firmware
> is 4 bytes due to MU message protocol, but ONLY the first byte is the
> key state, other 3 bytes could be some dirty data, so we should ONLY
> take the first byte as key state to avoid reporting incorrect state.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied, thank you.

> ---
> drivers/input/keyboard/imx_sc_key.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index 5379952..9f809ae 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -78,7 +78,13 @@ static void imx_sc_check_for_events(struct work_struct *work)
> return;
> }
>
> - state = (bool)msg.state;
> + /*
> + * The response data from SCU firmware is 4 bytes,
> + * but ONLY the first byte is the key state, other
> + * 3 bytes could be some dirty data, so we should
> + * ONLY take the first byte as key state.
> + */
> + state = (bool)(msg.state & 0xff);
>
> if (state ^ priv->keystate) {
> priv->keystate = state;
> --
> 2.7.4
>

--
Dmitry

\
 
 \ /
  Last update: 2019-12-13 23:04    [W:0.027 / U:2.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site