un-register kbd driver for USB kbd unplug
PATCH 1/1 un-register kbd driver for USB kbd unplug
From: Jes Sorensen <[email protected]>
Hi,
This is a fairly simple fix for the problem where the keyboard event handler is left in place when a keyboard is unplugged, eg. USB.
The long term solution would be to use Shahar Havivi's multi-keyboard support patch[1] from March, but until Shahar's patch is ready, this one fixes the current crash problem.
Cheers,
Jes
[1]: http://www.mail-archive.com/[email protected]/msg28589.html
Jes Sorensen (1):
un-register kbd driver in case of USB kbd unplug.
console.h | 1 + hw/usb-hid.c | 3 +++ input.c | 6 ++++++ 3 files changed, 10 insertions(+), 0 deletions(-)
PATCH 1/1 un-register kbd driver in case of USB kbd unplug.
From: Jes Sorensen <[email protected]>
If a USB keyboard is unplugged, the keyboard eventhandler is never removed, and events will continue to be passed through to the device, causing crashes or memory corruption.
--- console.h | 1 + hw/usb-hid.c | 3 +++ input.c | 6 ++++++ 3 files changed, 10 insertions(+), 0 deletions(-)
console.h +1 -0
@@ -42,6 +42,7 @@ typedef struct QEMUPutLEDEntry { } QEMUPutLEDEntry;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque); +void qemu_remove_kbd_event_handler (void );QEMUPutMouseEntry *qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque,int absolute,const char *name);
hw/usb-hid.c +3 -0
@@ -856,6 +856,9 @@ static void usb_hid_handle_destroy(USBDevice *dev)if (s->kind !=USB_KEYBOARD )qemu_remove_mouse_event_handler (s->ptr.eh_entry); +if (s->kind ==USB_KEYBOARD ) +qemu_remove_kbd_event_handler (); +/* TODO: else */ }
input.c +6 -0
@@ -42,6 +42,12 @@ void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque) qemu_put_kbd_event = func; } +void qemu_remove_kbd_event_handler (void ) +{ + qemu_put_kbd_event_opaque =NULL ; + qemu_put_kbd_event =NULL ; +} +static void check_mode_change (void ) {static int current_is_absolute, current_has_absolute;
Signature · 1 line
1.6.5.2
Quoted 14 lines · On Tue, Jun 08, 2010 at 12:43:50PM +0200, [email protected] wrote:
Date: Tue, 8 Jun 2010 12:43:50 +0200
From: [email protected]
To: [email protected]
Cc: [email protected], [email protected],
Jes Sorensen <[email protected]>
Subject: [PATCH] un-register kbd driver for USB kbd unplugFrom: Jes Sorensen <[email protected]>
Hi,
This is a fairly simple fix for the problem where the keyboard event handler is left in place when a keyboard is unplugged, eg. USB.
Quoted 6 lines
The long term solution would be to use Shahar Havivi's multi-keyboard support patch[1] from March, but until Shahar's patch is ready, this one fixes the current crash problem.
Cheers,
Jes
Anthony,
You reply that you applied the patch:
http://lists.gnu.org/archive/html/qemu-devel/2010-05/msg00673.html
but it didn't made it, is there a problem with the patch?
Thanks,
Shahar.
Quoted 11 lines
[1]: http://www.mail-archive.com/[email protected]/msg28589.html
Jes Sorensen (1):
un-register kbd driver in case of USB kbd unplug.console.h | 1 + hw/usb-hid.c | 3 +++ input.c | 6 ++++++ 3 files changed, 10 insertions(+), 0 deletions(-)