qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] Support for multiple keyboard devices


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] Support for multiple keyboard devices
Date: Wed, 31 Mar 2010 17:23:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Shahar Havivi <address@hidden> writes:

> Currently you get segfault when trying to remove keyboard (device_del
> monitor command) because no keyboard handling is done.
>
> This patch add QEMUPutKbdEntry structure, handling each keyboard entry.
> Adding a keyboard add to the list, removing keyboard select the previous
> keyboard in list.
>
> Signed-off-by: Shahar Havivi <address@hidden>
> ---
[...]
> diff --git a/input.c b/input.c
> index 8f0941e..e6dda25 100644
> --- a/input.c
> +++ b/input.c
[...]
> @@ -60,6 +54,38 @@ static void check_mode_change(void)
>      current_has_absolute = has_absolute;
>  }
>  
> +QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
> +                                            void *opaque,
> +                                            const char *name)
> +{
> +    static int mouse_index = 0;

"mouse_index" is an unorthodox name for counting keyboards ;)

> +    QEMUPutKbdEntry *s, *cursor;
> +
> +    QTAILQ_FOREACH(cursor, &kbd_handlers, node) {
> +        if (cursor->qemu_put_kbd_event == func &&
> +            cursor->qemu_put_kbd_event_opaque == opaque) {
> +            return cursor;
> +        }
> +    }
> +
> +    s = qemu_mallocz(sizeof(QEMUPutKbdEntry));
> +
> +    s->qemu_put_kbd_event_opaque = opaque;
> +    s->qemu_put_kbd_event = func;
> +    s->qemu_put_kbd_name = qemu_strdup(name);
> +    s->index = mouse_index++;
> +
> +    QTAILQ_INSERT_TAIL(&kbd_handlers, s, node);
> +
> +    return s;
> +}
[...]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]