Skip to contentSkip to conversation

input/xen-kbdfront: Enable auto repeat for xen keyboard frontend driver

PATCH Applied Liang Yan 2 participants 2 messages Aug 24, 2017 – Aug 28, 2017

Subsystems (2)
lore
Share & tools
lore

Liang Yan

author
#0 lore raw

PATCH v2 1/1 input/xen-kbdfront: Enable auto repeat for xen keyboard frontend driver

Long pressed key could not show right in XEN vncviewer after tigervnc client changed the way how to send repeat keys, from "Down Up Down Up ..." to "Down Down ... Up". This will report autorepeat to input by checking if same key being pressed, and let handler process it finally.

---
v2:
- Sending autorepeat event rather than enable EV_REP bit

drivers/input/misc/xen-kbdfront.c | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/input/misc/xen-kbdfront.c +4 -1
index fa130e7b734c..6bf56bb5f8d9 100644
@@ -84,17 +84,20 @@ static void xenkbd_handle_key_event(struct xenkbd_info *info,
 				    struct xenkbd_key *key)
 {
 	struct input_dev *dev;
+	int value = key->pressed;
 
 	if (test_bit(key->keycode, info->ptr->keybit)) {
 		dev = info->ptr;
 	} else if (test_bit(key->keycode, info->kbd->keybit)) {
 		dev = info->kbd;
+		if (key->pressed && test_bit(key->keycode, info->kbd->key))
+			value = 2; /* Mark as autorepeat */
 	} else {
 		pr_warn("unhandled keycode 0x%x\n", key->keycode);
 		return;
 	}
 
-	input_report_key(dev, key->keycode, key->pressed);
+	input_event(dev, EV_KEY, key->keycode, value);
 	input_sync(dev);
 }
 
Signature · 1 line
2.14.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Liang Yan

Long pressed key could not show right in XEN vncviewer after tigervnc client changed the way how to send repeat keys, from "Down Up Down Up ..." to "Down Down ... Up". This will report autorepeat to input by checking if same key being pressed, and let handler process it finally.

---
v2:
- Sending autorepeat event rather than enable EV_REP bit

Applied, thank you.

Quoted 33 lines

drivers/input/misc/xen-kbdfront.c | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/input/misc/xen-kbdfront.c +4 -1
index fa130e7b734c..6bf56bb5f8d9 100644
@@ -84,17 +84,20 @@ static void xenkbd_handle_key_event(struct xenkbd_info *info,
 				    struct xenkbd_key *key)
 {
 	struct input_dev *dev;
+	int value = key->pressed;
 
 	if (test_bit(key->keycode, info->ptr->keybit)) {
 		dev = info->ptr;
 	} else if (test_bit(key->keycode, info->kbd->keybit)) {
 		dev = info->kbd;
+		if (key->pressed && test_bit(key->keycode, info->kbd->key))
+			value = 2; /* Mark as autorepeat */
 	} else {
 		pr_warn("unhandled keycode 0x%x\n", key->keycode);
 		return;
 	}
 
-	input_report_key(dev, key->keycode, key->pressed);
+	input_event(dev, EV_KEY, key->keycode, value);
 	input_sync(dev);
 }
 
Signature · 1 line
2.14.1
Signature · 1 line
Dmitry