Commit f041a7af authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Dmitry Torokhov

Input: tm2-touchkey - report scan codes

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: default avatarStephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211013112305.41574-1-stephan@gerhold.netSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 804f354a
...@@ -156,6 +156,8 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) ...@@ -156,6 +156,8 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
goto out; goto out;
} }
input_event(touchkey->input_dev, EV_MSC, MSC_SCAN, index);
if (data & TM2_TOUCHKEY_BIT_PRESS_EV) { if (data & TM2_TOUCHKEY_BIT_PRESS_EV) {
for (i = 0; i < touchkey->num_keycodes; i++) for (i = 0; i < touchkey->num_keycodes; i++)
input_report_key(touchkey->input_dev, input_report_key(touchkey->input_dev,
...@@ -250,6 +252,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, ...@@ -250,6 +252,7 @@ static int tm2_touchkey_probe(struct i2c_client *client,
touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME; touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
touchkey->input_dev->id.bustype = BUS_I2C; 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++) for (i = 0; i < touchkey->num_keycodes; i++)
input_set_capability(touchkey->input_dev, EV_KEY, input_set_capability(touchkey->input_dev, EV_KEY,
touchkey->keycodes[i]); touchkey->keycodes[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment