From: Erik van der Kouwe Date: Fri, 26 Nov 2010 17:00:25 +0000 (-0600) Subject: This implements command 0xf0 on the keyboard controller port 0x60. X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f67d9454f62c56af9576d52772b9f4ce693a050;p=palacios.git This implements command 0xf0 on the keyboard controller port 0x60. --- diff --git a/palacios/src/devices/keyboard.c b/palacios/src/devices/keyboard.c index 2aa4bec..5b06858 100644 --- a/palacios/src/devices/keyboard.c +++ b/palacios/src/devices/keyboard.c @@ -185,6 +185,9 @@ struct keyboard_internal { // After the Keyboard SET_RATE is called // we wait for the output byte on 64? SET_RATE, + // after having a f0 sent to 60 + // we wait for a new output byte on 60 + GETSET_SCANCODES, } state; @@ -209,6 +212,7 @@ struct keyboard_internal { uint8_t wrap; int mouse_enabled; + int scancode_set; struct queue kbd_queue; struct queue mouse_queue; @@ -866,6 +870,29 @@ static int keyboard_write_output(struct guest_info * core, ushort_t port, void * kbd->state = NORMAL; break; + case GETSET_SCANCODES: + switch (data) { + case 0: + PrintDebug("Keyboard: scancode set being read\n"); + push_to_output_queue(kbd, 0x45 - 2 * kbd->scancode_set, COMMAND, KEYBOARD); + break; + case 2: + PrintDebug("Keyboard: scancode set being set to %d\n", data); + kbd->scancode_set = data; + push_to_output_queue(kbd, 0xfa, COMMAND, KEYBOARD); + break; + case 1: + case 3: + PrintError("keyboard: unsupported scancode set %d selected\n", data); + return -1; + default: + PrintError("keyboard: unknown scancode set %d selected\n", data); + return -1; + + } + kbd->state = NORMAL; + break; + default: case NORMAL: { // command is being sent to keyboard controller @@ -905,6 +932,11 @@ static int keyboard_write_output(struct guest_info * core, ushort_t port, void * push_to_output_queue(kbd, 0xee, COMMAND, KEYBOARD); break; + case 0xf0: // get/set scancode set + push_to_output_queue(kbd, 0xfa, COMMAND, KEYBOARD); + kbd->state = GETSET_SCANCODES; + break; + case 0xfe: // resend case 0xfd: // set key type make case 0xfc: // set key typ make/break @@ -981,6 +1013,7 @@ static int keyboard_reset_device(struct keyboard_internal * kbd) { kbd->kbd_queue.count = 0; kbd->mouse_enabled = 0; + kbd->scancode_set = 2; kbd->state = NORMAL; kbd->mouse_state = STREAM;