]> Git Repo - linux.git/commitdiff
Input: imx_sc_key - only take the valid data from SCU firmware as key state
authorAnson Huang <[email protected]>
Fri, 13 Dec 2019 22:02:30 +0000 (14:02 -0800)
committerDmitry Torokhov <[email protected]>
Sat, 14 Dec 2019 00:41:57 +0000 (16:41 -0800)
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 <[email protected]>
Fixes: 688f1dfb69b4 ("Input: keyboard - imx_sc: Add i.MX system controller key support")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
drivers/input/keyboard/imx_sc_key.c

index 53799527dc75b27b57a48639af7a8d71af134ffa..9f809aeb785c4927d60009d233610d313fc07e9d 100644 (file)
@@ -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;
This page took 0.060458 seconds and 4 git commands to generate.