From: Lei Xia Date: Wed, 10 Nov 2010 04:27:06 +0000 (-0600) Subject: Update char_stream device for virtual console input event X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a55bf2a12c7a1fe3daa7ecb1598b67acb246774;p=palacios.git Update char_stream device for virtual console input event --- diff --git a/palacios/include/palacios/vmm_host_events.h b/palacios/include/palacios/vmm_host_events.h index 7a462b7..4d17a6c 100644 --- a/palacios/include/palacios/vmm_host_events.h +++ b/palacios/include/palacios/vmm_host_events.h @@ -48,7 +48,7 @@ struct v3_vm_info; typedef enum {HOST_KEYBOARD_EVT, HOST_MOUSE_EVT, HOST_TIMER_EVT, - HOST_CONSLE_EVT} v3_host_evt_type_t; + HOST_CONSOLE_EVT} v3_host_evt_type_t; union v3_host_event_handler { diff --git a/palacios/src/devices/char_stream.c b/palacios/src/devices/char_stream.c index 4590cae..33a0a32 100644 --- a/palacios/src/devices/char_stream.c +++ b/palacios/src/devices/char_stream.c @@ -35,6 +35,17 @@ struct stream_state { }; +static int console_event_handler(struct v3_vm_info * vm, + struct v3_console_event * evt, + void * private_data) { + struct stream_state *state = (struct stream_state *)private_data; + + if(state->char_ops.push != NULL){ + state->char_ops.push(vm, evt->data, evt->len, state->push_fn_arg); + } + + return 0; +} static int stream_write(uint8_t * buf, uint64_t length, void * private_data) { @@ -102,6 +113,8 @@ static int stream_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) } + v3_hook_host_event(vm, HOST_CONSOLE_EVT, V3_HOST_EVENT_HANDLER(console_event_handler), state); + return 0; } diff --git a/palacios/src/palacios/vmm_host_events.c b/palacios/src/palacios/vmm_host_events.c index ec54c65..078fb08 100644 --- a/palacios/src/palacios/vmm_host_events.c +++ b/palacios/src/palacios/vmm_host_events.c @@ -28,6 +28,7 @@ int v3_init_host_events(struct v3_vm_info * vm) { INIT_LIST_HEAD(&(host_evts->keyboard_events)); INIT_LIST_HEAD(&(host_evts->mouse_events)); INIT_LIST_HEAD(&(host_evts->timer_events)); + INIT_LIST_HEAD(&(host_evts->console_events)); return 0; } @@ -60,7 +61,7 @@ int v3_hook_host_event(struct v3_vm_info * vm, case HOST_TIMER_EVT: list_add(&(hook->link), &(host_evts->timer_events)); break; - case HOST_CONSLE_EVT: + case HOST_CONSOLE_EVT: list_add(&(hook->link), &(host_evts->console_events)); break; }