Skip to content

Commit 771a081

Browse files
jason77-wangdtor
authored andcommitted
Input: alps - fix a mismatch between a condition check and its comment
In the function alps_is_cs19_trackpoint(), we check if the param[1] is in the 0x20~0x2f range, but the code we wrote for this checking is not correct: (param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f, it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f... Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20). Fixes: 7e4935c ("Input: alps - don't handle ALPS cs19 trackpoint-only device") Cc: [email protected] Signed-off-by: Hui Wang <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 49e6979 commit 771a081

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/mouse/alps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,7 @@ static bool alps_is_cs19_trackpoint(struct psmouse *psmouse)
28762876
* trackpoint-only devices have their variant_ids equal
28772877
* TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range.
28782878
*/
2879-
return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20);
2879+
return param[0] == TP_VARIANT_ALPS && ((param[1] & 0xf0) == 0x20);
28802880
}
28812881

28822882
static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)

0 commit comments

Comments
 (0)