diff mbox

[v2] Input: goodix: Add support for capacitive home button found on some x86 tablets

Message ID 1749277.ynzOHhpSB9@z12 (mailing list archive)
State Superseded
Headers show

Commit Message

Sergei A. Trusov June 20, 2017, 11:08 a.m. UTC
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 normally only the lower 4 bits
are used to indicate the number of touches.

Detect this and report a KEY_LEFTMETA press when this happens. Note the
hardware might support more than one button, the number of a button is
reported by the 'id' byte of coor_data. Now we ignore button id.

Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
---
 drivers/input/touchscreen/goodix.c | 9 +++++++++
 1 file changed, 9 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bastien Nocera June 20, 2017, 11:47 a.m. UTC | #1
On Tue, 2017-06-20 at 21:08 +1000, Sergei A. Trusov wrote:
> On some x86 tablets with a goodix touchscreen the windows logo on the

"Goodix" and "Windows", comma after "touchscreen".

> front is a capacitive home button. Touching this button results in a
> touch
> with bit 4 of the first byte set, while normally only the lower 4
> bits

Add "(0-3)" after "bits".

> are used to indicate the number of touches.
> 
> Detect this and report a KEY_LEFTMETA press when this happens. Note 

You can remove the "Detect this and".

> the
> hardware might support more than one button, the number of a button
> is
> reported by the 'id' byte of coor_data.

"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."

>  Now we ignore button id.

Remove that last sentence.

> 
> Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>

Looks good from me. Sergei, Dmitry, let me know if you want me to re-
send the patch with a fixed up commit message.

Acked-by: Bastien Nocera <hadess@hadess.net>

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei A. Trusov June 20, 2017, 12:25 p.m. UTC | #2
On Tuesday, 20 June 2017 21:47:39 +10 Bastien Nocera wrote:
> On Tue, 2017-06-20 at 21:08 +1000, Sergei A. Trusov wrote:
> > On some x86 tablets with a goodix touchscreen the windows logo on the
> 
> "Goodix" and "Windows", comma after "touchscreen".
> 
> > front is a capacitive home button. Touching this button results in a
> > touch
> > with bit 4 of the first byte set, while normally only the lower 4
> > bits
> 
> Add "(0-3)" after "bits".
> 
> > are used to indicate the number of touches.
> > 
> > Detect this and report a KEY_LEFTMETA press when this happens. Note 
> 
> You can remove the "Detect this and".
> 
> > the
> > hardware might support more than one button, the number of a button
> > is
> > reported by the 'id' byte of coor_data.
> 
> "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."
> 
> >  Now we ignore button id.
> 
> Remove that last sentence.
> 
> > 
> > Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
> 
> Looks good from me. Sergei, Dmitry, let me know if you want me to re-
> send the patch with a fixed up commit message.

Thanks for all these corrections and patience (with a newbe like me). I think
it would be better if you re-send the correct patch. I just do not know what
should I do with this now.

> 
> Acked-by: Bastien Nocera <hadess@hadess.net>
> 
> Cheers
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 240b16f3ee97..c1bb59c96dbd 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -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] & 0x10));
+
 	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,