+}
diff --git a/hid-linux.c b/hid-linux.c
new file mode 100644
-index 0000000..8b1a477
+index 0000000..9e09f97
--- /dev/null
+++ b/hid-linux.c
-@@ -0,0 +1,574 @@
+@@ -0,0 +1,557 @@
+/*
+ * 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;
+
-+ 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;
++ /* If Alt is pressed or just released, pass through */
++ if (hid_linux_driver.key_status[KEY_LEFTALT] ||
++ keycode == KEY_LEFTALT)
++ return true;
+ return false;
+}
+
+
+void hid_linux_reset_keyboard(void)
+{
-+ 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;
++ int i = 0;
++
++ for (i = 0; i < 256; i++)
+ 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)