diff mbox series

[1/2] Input: tm2-touchkey - report scan codes

Message ID 20211013112305.41574-1-stephan@gerhold.net (mailing list archive)
State Mainlined
Commit f041a7af12636639d9c87e541c4c261d40f5afa7
Headers show
Series [1/2] Input: tm2-touchkey - report scan codes | expand

Commit Message

Stephan Gerhold Oct. 13, 2021, 11:23 a.m. UTC
Report the index of pressed touch key as MSC_SCAN code to userspace
so it is possible to identify which of the keys was pressed (not
just the function that is currently assigned to the key).

This is done similarly also in mcs_touchkey and mpr121_touchkey.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/input/keyboard/tm2-touchkey.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Dmitry Torokhov Oct. 16, 2021, 3:27 a.m. UTC | #1
On Wed, Oct 13, 2021 at 01:23:04PM +0200, Stephan Gerhold wrote:
> Report the index of pressed touch key as MSC_SCAN code to userspace
> so it is possible to identify which of the keys was pressed (not
> just the function that is currently assigned to the key).
> 
> This is done similarly also in mcs_touchkey and mpr121_touchkey.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
index 6218b1c682ef..ce40ea2d940f 100644
--- a/drivers/input/keyboard/tm2-touchkey.c
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -156,6 +156,8 @@  static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
 		goto out;
 	}
 
+	input_event(touchkey->input_dev, EV_MSC, MSC_SCAN, index);
+
 	if (data & TM2_TOUCHKEY_BIT_PRESS_EV) {
 		for (i = 0; i < touchkey->num_keycodes; i++)
 			input_report_key(touchkey->input_dev,
@@ -250,6 +252,7 @@  static int tm2_touchkey_probe(struct i2c_client *client,
 	touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
 	touchkey->input_dev->id.bustype = BUS_I2C;
 
+	input_set_capability(touchkey->input_dev, EV_MSC, MSC_SCAN);
 	for (i = 0; i < touchkey->num_keycodes; i++)
 		input_set_capability(touchkey->input_dev, EV_KEY,
 				     touchkey->keycodes[i]);