Skip to contentSkip to conversation

Input: cap1106 - allow changing key mapping from userspace

PATCH In review Dmitry Torokhov 2 participants 5 messages Jul 21, 2014 – Aug 8, 2014

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: cap1106 - allow changing key mapping from userspace

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace.

---

Just compiled, not tested.

 drivers/input/keyboard/cap1106.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/input/keyboard/cap1106.c +7 -1
index f7d7a0d..180b184 100644
@@ -64,7 +64,7 @@ struct cap1106_priv {
 	struct input_dev *idev;
 
 	/* config */
-	unsigned int keycodes[CAP1106_NUM_CHN];
+	unsigned short keycodes[CAP1106_NUM_CHN];
 };
 
 static const struct reg_default cap1106_reg_defaults[] = {
@@ -272,6 +272,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
 	for (i = 0; i < CAP1106_NUM_CHN; i++)
 		__set_bit(priv->keycodes[i], priv->idev->keybit);
 
+	__clear_bit(KEY_RESERVED, priv->idev->keybit);
+
+	priv->idev->keycode = priv->keycodes;
+	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
+	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+
 	priv->idev->id.vendor = CAP1106_MANUFACTURER_ID;
 	priv->idev->id.product = CAP1106_PRODUCT_ID;
 	priv->idev->id.version = rev;
Signature · 5 lines
2.0.0.526.g5318336


-- 
Dmitry
author maintainer
#1 lore raw
Quoted 7 lines · Dmitry Torokhov

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace.

---

Just compiled, not tested.

*ping* Any chance you could give it a try? Thanks!

Quoted 36 lines
 drivers/input/keyboard/cap1106.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/input/keyboard/cap1106.c +7 -1
index f7d7a0d..180b184 100644
@@ -64,7 +64,7 @@ struct cap1106_priv {
 	struct input_dev *idev;
 
 	/* config */
-	unsigned int keycodes[CAP1106_NUM_CHN];
+	unsigned short keycodes[CAP1106_NUM_CHN];
 };
 
 static const struct reg_default cap1106_reg_defaults[] = {
@@ -272,6 +272,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
 	for (i = 0; i < CAP1106_NUM_CHN; i++)
 		__set_bit(priv->keycodes[i], priv->idev->keybit);
 
+	__clear_bit(KEY_RESERVED, priv->idev->keybit);
+
+	priv->idev->keycode = priv->keycodes;
+	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
+	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+
 	priv->idev->id.vendor = CAP1106_MANUFACTURER_ID;
 	priv->idev->id.product = CAP1106_PRODUCT_ID;
 	priv->idev->id.version = rev;
Signature · 5 lines
2.0.0.526.g5318336


-- 
Dmitry
Signature · 1 line
Dmitry
#2 lore raw

Hi Dmitry,

Quoted 10 lines · Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace.

---

Just compiled, not tested.

*ping* Any chance you could give it a try? Thanks!

Oh, sorry, I didn't realize you're waiting for me on this.

Unfortunately, I can't test it myself anymore, as I had to return the board I found this chip on. But as the change looks very straight forward, I'd suggest you just apply that patch and I ask the vendor to give it a quick try. In case of any problems, I'll let you know. Does that sound feasible?

Thanks,
Daniel

Quoted 38 lines
Quoted 37 lines

 drivers/input/keyboard/cap1106.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/input/keyboard/cap1106.c +7 -1
index f7d7a0d..180b184 100644
@@ -64,7 +64,7 @@ struct cap1106_priv {
 	struct input_dev *idev;
 
 	/* config */
-	unsigned int keycodes[CAP1106_NUM_CHN];
+	unsigned short keycodes[CAP1106_NUM_CHN];
 };
 
 static const struct reg_default cap1106_reg_defaults[] = {
@@ -272,6 +272,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
 	for (i = 0; i < CAP1106_NUM_CHN; i++)
 		__set_bit(priv->keycodes[i], priv->idev->keybit);
 
+	__clear_bit(KEY_RESERVED, priv->idev->keybit);
+
+	priv->idev->keycode = priv->keycodes;
+	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
+	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+
 	priv->idev->id.vendor = CAP1106_MANUFACTURER_ID;
 	priv->idev->id.product = CAP1106_PRODUCT_ID;
 	priv->idev->id.version = rev;
Signature · 5 lines
2.0.0.526.g5318336


-- 
Dmitry
author maintainer
#3 lore raw
Quoted 14 lines · Daniel Mack

Hi Dmitry,

Quoted 10 lines · Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace.

---

Just compiled, not tested.

*ping* Any chance you could give it a try? Thanks!

Quoted 7 lines

Oh, sorry, I didn't realize you're waiting for me on this.

Unfortunately, I can't test it myself anymore, as I had to return the board I found this chip on. But as the change looks very straight forward, I'd suggest you just apply that patch and I ask the vendor to give it a quick try. In case of any problems, I'll let you know. Does that sound feasible?

OK, I'll put you down as reviewed-by then so we can share the glory (and the blame ;))

Thanks.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Daniel Mack

Hi Dmitry,

Quoted 10 lines · Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace.

---

Just compiled, not tested.

*ping* Any chance you could give it a try? Thanks!

Oh, sorry, I didn't realize you're waiting for me on this.

Quoted 8 lines
Quoted 5 lines

Unfortunately, I can't test it myself anymore, as I had to return the board I found this chip on. But as the change looks very straight forward, I'd suggest you just apply that patch and I ask the vendor to give it a quick try. In case of any problems, I'll let you know. Does that sound feasible?

OK, I'll put you down as reviewed-by then so we can share the glory (and the blame ;))

Alright, thanks :)

Thanks,
Daniel