Skip to content

Commit

Permalink
Input: elan_i2c - handle firmware not implementing "get pattern" command
Browse files Browse the repository at this point in the history
Not all versions of firmware implement "get pattern" command. When
encountering those assume that the controllers use older pattern.

Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Jingle Wu authored and Dmitry Torokhov committed Jul 18, 2020
1 parent 3d77e6a commit 77da21c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/input/mouse/elan_i2c_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ static int elan_i2c_get_pattern(struct i2c_client *client, u8 *pattern)
dev_err(&client->dev, "failed to get pattern: %d\n", error);
return error;
}
*pattern = val[1];

/*
* Not all versions of firmware implement "get pattern" command.
* When this command is not implemented the device will respond
* with 0xFF 0xFF, which we will treat as "old" pattern 0.
*/
*pattern = val[0] == 0xFF && val[1] == 0xFF ? 0 : val[1];

return 0;
}
Expand Down

0 comments on commit 77da21c

Please sign in to comment.