More recent versions of QEMU disable scanning until the controller and keyboard device have been explicitly reset.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/pc_kbd.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/pc_kbd.c b/drivers/pc_kbd.c index 51b7a1f..3b74f8c 100644 --- a/drivers/pc_kbd.c +++ b/drivers/pc_kbd.c @@ -134,6 +134,24 @@ unsigned char pc_kbd_readdata(void) return tmp; }
+static void +pc_kbd_reset(void) +{ + /* Reset first port */ + outb(0xae, 0x64); + while (inb(0x64) & 2); + + /* Write mode command, translated mode */ + pc_kbd_controller_cmd(0x60, 0x40); + + /* Reset keyboard device */ + outb(0xff, 0x60); + while (inb(0x64) & 2); + inb(0x60); /* Should be 0xfa */ + while (inb(0x64) & 2); + inb(0x60); /* Should be 0xaa */ +} + /* ( addr len -- actual ) */ static void pc_kbd_read(void) @@ -280,8 +298,8 @@ ob_pc_kbd_init(const char *path, const char *kdev_name, const char *mdev_name, aliases = find_dev("/aliases"); set_property(aliases, "keyboard", nodebuff, strlen(nodebuff) + 1);
- pc_kbd_controller_cmd(0x60, 0x40); // Write mode command, translated mode - + pc_kbd_reset(); + /* Mouse (optional) */ if (mdev_name != NULL) { snprintf(nodebuff, sizeof(nodebuff), "%s/8042", path);