Input: xen-kbdfront - enable auto repeat for xen keyboard frontend driver
authorLiang Yan <lyan@suse.com>
Mon, 28 Aug 2017 16:41:08 +0000 (09:41 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 28 Aug 2017 17:31:31 +0000 (10:31 -0700)
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.

Signed-off-by: Liang Yan <lyan@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/xen-kbdfront.c

index fa130e7b734c79b28c34c25e89ca53cc24408300..6bf56bb5f8d97dd4b5835e54c7e7ca764db98434 100644 (file)
@@ -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);
 }