* [Qemu-devel] [PATCH] un-register kbd driver for USB kbd unplug
@ 2010-06-08 10:43 Jes.Sorensen
2010-06-08 10:43 ` [Qemu-devel] [PATCH] un-register kbd driver in case of " Jes.Sorensen
2010-06-08 12:14 ` [Qemu-devel] Re: [PATCH] un-register kbd driver for " Shahar Havivi
0 siblings, 2 replies; 3+ messages in thread
From: Jes.Sorensen @ 2010-06-08 10:43 UTC (permalink / raw)
To: anthony; +Cc: shavivi, qemu-devel, Jes Sorensen
From: Jes Sorensen <Jes.Sorensen@redhat.com>
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/qemu-devel@nongnu.org/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(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH] un-register kbd driver in case of USB kbd unplug.
2010-06-08 10:43 [Qemu-devel] [PATCH] un-register kbd driver for USB kbd unplug Jes.Sorensen
@ 2010-06-08 10:43 ` Jes.Sorensen
2010-06-08 12:14 ` [Qemu-devel] Re: [PATCH] un-register kbd driver for " Shahar Havivi
1 sibling, 0 replies; 3+ messages in thread
From: Jes.Sorensen @ 2010-06-08 10:43 UTC (permalink / raw)
To: anthony; +Cc: shavivi, qemu-devel, Jes Sorensen
From: Jes Sorensen <Jes.Sorensen@redhat.com>
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.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
console.h | 1 +
hw/usb-hid.c | 3 +++
input.c | 6 ++++++
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/console.h b/console.h
index cac959f..aafb031 100644
--- a/console.h
+++ b/console.h
@@ -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);
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 8e6c6e0..333b626 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -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 */
}
diff --git a/input.c b/input.c
index 651442d..ec05548 100644
--- a/input.c
+++ b/input.c
@@ -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;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] un-register kbd driver for USB kbd unplug
2010-06-08 10:43 [Qemu-devel] [PATCH] un-register kbd driver for USB kbd unplug Jes.Sorensen
2010-06-08 10:43 ` [Qemu-devel] [PATCH] un-register kbd driver in case of " Jes.Sorensen
@ 2010-06-08 12:14 ` Shahar Havivi
1 sibling, 0 replies; 3+ messages in thread
From: Shahar Havivi @ 2010-06-08 12:14 UTC (permalink / raw)
To: Jes.Sorensen, anthony; +Cc: qemu-devel
On Tue, Jun 08, 2010 at 12:43:50PM +0200, Jes.Sorensen@redhat.com wrote:
> Date: Tue, 8 Jun 2010 12:43:50 +0200
> From: Jes.Sorensen@redhat.com
> To: anthony@codemonkey.ws
> Cc: qemu-devel@nongnu.org, shavivi@redhat.com,
> Jes Sorensen <Jes.Sorensen@redhat.com>
> Subject: [PATCH] un-register kbd driver for USB kbd unplug
>
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> 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
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.
>
> [1]: http://www.mail-archive.com/qemu-devel@nongnu.org/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(-)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-08 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 10:43 [Qemu-devel] [PATCH] un-register kbd driver for USB kbd unplug Jes.Sorensen
2010-06-08 10:43 ` [Qemu-devel] [PATCH] un-register kbd driver in case of " Jes.Sorensen
2010-06-08 12:14 ` [Qemu-devel] Re: [PATCH] un-register kbd driver for " Shahar Havivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).