Skip to content

Commit 872e57a

Browse files
stephan-ghdtor
authored andcommitted
Input: tm2-touchkey - allow changing keycodes from userspace
At the moment the touch keys have key codes assigned from the device tree. In some cases, users might want to change the key code from userspace. There is existing functionality for this in the input core using the EVIOCSKEYCODE ioctl, which is integrated for example into udev. Make it possible to use this functionality for tm2-touchkey by simply making the input core aware of the array that holds the keycodes. Similar code also exists in mcs_touchkey and mpr121_touchkey. Signed-off-by: Stephan Gerhold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f041a7a commit 872e57a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/input/keyboard/tm2-touchkey.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ static int tm2_touchkey_probe(struct i2c_client *client,
252252
touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
253253
touchkey->input_dev->id.bustype = BUS_I2C;
254254

255+
touchkey->input_dev->keycode = touchkey->keycodes;
256+
touchkey->input_dev->keycodemax = touchkey->num_keycodes;
257+
touchkey->input_dev->keycodesize = sizeof(touchkey->keycodes[0]);
258+
255259
input_set_capability(touchkey->input_dev, EV_MSC, MSC_SCAN);
256260
for (i = 0; i < touchkey->num_keycodes; i++)
257261
input_set_capability(touchkey->input_dev, EV_KEY,

0 commit comments

Comments
 (0)