]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Input: goodix - add support for capacitive home button
authorSergei A. Trusov <sergei.a.trusov@ya.ru>
Thu, 7 Sep 2017 00:29:24 +0000 (17:29 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 11 Sep 2017 21:23:15 +0000 (14:23 -0700)
On some x86 tablets with a Goodix touchscreen, the Windows logo on the
front is a capacitive home button. Touching this button results in a touch
with bit 4 of the first byte set, while only the lower 4 bits (0-3) are
used to indicate the number of touches.

Report a KEY_LEFTMETA press when this happens.

Note that the hardware might support more than one button, in which
case the "id" byte of coor_data would identify the button in question.
This is not implemented as we don't have access to hardware with
multiple buttons.

Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
Acked-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/goodix.c

index 240b16f3ee9797c4961709ef8f9a50b874febb3f..32d2762448aa24168c9dd0ad38c8c9eb1ec13ff3 100644 (file)
@@ -267,6 +267,12 @@ static void goodix_process_events(struct goodix_ts_data *ts)
        if (touch_num < 0)
                return;
 
+       /*
+        * Bit 4 of the first byte reports the status of the capacitive
+        * Windows/Home button.
+        */
+       input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
+
        for (i = 0; i < touch_num; i++)
                goodix_ts_report_touch(ts,
                                &point_data[1 + GOODIX_CONTACT_SIZE * i]);
@@ -612,6 +618,9 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
        ts->input_dev->id.product = ts->id;
        ts->input_dev->id.version = ts->version;
 
+       /* Capacitive Windows/Home button on some devices */
+       input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA);
+
        error = input_register_device(ts->input_dev);
        if (error) {
                dev_err(&ts->client->dev,