+}
diff --git a/hid-linux.c b/hid-linux.c
new file mode 100644
-index 0000000..9e09f97
+index 0000000..8b1a477
--- /dev/null
+++ b/hid-linux.c
-@@ -0,0 +1,557 @@
+@@ -0,0 +1,574 @@
+/*
+ * QEMU hid-linux /dev/input driver
+ *
+ KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z
+};
+
++static const uint32_t keycodes_pt[] = {
++ KEY_LEFTALT, KEY_RIGHTALT,
++ KEY_LEFTCTRL, KEY_RIGHTCTRL,
++ KEY_MSDOS,
++};
++
++static uint32_t const * const keycodes_pt_end =
++ keycodes_pt + sizeof (keycodes_pt) / sizeof (keycodes_pt[0]);
++
++
++
+static void hid_linux_secure_read(void *opaque);
+
+static char keycode2ascii(int keycode)
+ if (!hid_linux_driver.has_mouse)
+ return false;
+
-+ /* If Alt is pressed or just released, pass through */
-+ if (hid_linux_driver.key_status[KEY_LEFTALT] ||
-+ keycode == KEY_LEFTALT)
-+ return true;
++ for (const uint32_t * k = keycodes_pt; k != keycodes_pt_end; k++)
++ /* If Alt is pressed or just released, pass through */
++ if (hid_linux_driver.key_status[*k] || keycode == *k)
++ return true;
+ return false;
+}
+
+
+void hid_linux_reset_keyboard(void)
+{
-+ int i = 0;
-+
-+ for (i = 0; i < 256; i++)
++ for (int i = 0; i < 256; i++)
++ {
++ for (const uint32_t * k = keycodes_pt; k != keycodes_pt_end; k++)
++ if (i == *k)
++ goto no_reset;
+ if (hid_linux_driver.key_status[i])
+ {
+ hid_linux_key_inject(0, i);
+ hid_linux_driver.key_status[i] = 0;
+ }
++
++ no_reset:
++ continue;
++ }
+}
+
+static void hid_linux_redirect_fds(int *fd, IOHandler *cb)