All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Dinesh Subhraveti <subhraveti@gmail.com>
Cc: Tomasz Chmielewski <mangoo@wpkg.org>,
	qemu-devel@nongnu.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] Initialize PS2 keyboard / mouse state on reset
Date: Tue, 14 Jul 2009 20:45:05 -0500	[thread overview]
Message-ID: <4A5D34A1.2020301@codemonkey.ws> (raw)
In-Reply-To: <df4386c0907141830o55b39665w81bae40cdbeb949b@mail.gmail.com>

Dinesh Subhraveti wrote:
> Currently only common PS2 state is initialized, leaving keyboard and
> mouse specific state to contain stale values.
>   

And... this fixes the bug where some Linux guests are unable to detect 
the keyboard after a reboot due to the PS/2 queue being full.

In the future, please make sure to include more information in commit 
messages.

Thanks for the patch!

Regards,

Anthony Liguori

> Signed-off-by: Dinesh Subhraveti <dineshs@us.ibm.com>
>
> ---
> diff --git a/hw/ps2.c b/hw/ps2.c
> index fb77005..0915b9f 100644
> --- a/hw/ps2.c
> +++ b/hw/ps2.c
> @@ -488,9 +488,8 @@ void ps2_write_mouse(void *opaque, int val)
>      }
>  }
>
> -static void ps2_reset(void *opaque)
> +static void ps2_common_reset(PS2State *s)
>  {
> -    PS2State *s = (PS2State *)opaque;
>      PS2Queue *q;
>      s->write_cmd = -1;
>      q = &s->queue;
> @@ -500,6 +499,33 @@ static void ps2_reset(void *opaque)
>      s->update_irq(s->update_arg, 0);
>  }
>
> +static void ps2_kbd_reset(void *opaque)
> +{
> +    PS2KbdState *s = (PS2KbdState *) opaque;
> +
> +    ps2_common_reset(&s->common);
> +    s->scan_enabled = 0;
> +    s->translate = 0;
> +    s->scancode_set = 0;
> +}
> +
> +static void ps2_mouse_reset(void *opaque)
> +{
> +    PS2MouseState *s = (PS2MouseState *) opaque;
> +
> +    ps2_common_reset(&s->common);
> +    s->mouse_status = 0;
> +    s->mouse_resolution = 0;
> +    s->mouse_sample_rate = 0;
> +    s->mouse_wrap = 0;
> +    s->mouse_type = 0;
> +    s->mouse_detect_state = 0;
> +    s->mouse_dx = 0;
> +    s->mouse_dy = 0;
> +    s->mouse_dz = 0;
> +    s->mouse_buttons = 0;
> +}
> +
>  static void ps2_common_save (QEMUFile *f, PS2State *s)
>  {
>      qemu_put_be32 (f, s->write_cmd);
> @@ -590,10 +616,10 @@ void *ps2_kbd_init(void (*update_irq)(void *,
> int), void *update_arg)
>      s->common.update_irq = update_irq;
>      s->common.update_arg = update_arg;
>      s->scancode_set = 2;
> -    ps2_reset(&s->common);
> +    ps2_kbd_reset(s);
>      register_savevm("ps2kbd", 0, 3, ps2_kbd_save, ps2_kbd_load, s);
>      qemu_add_kbd_event_handler(ps2_put_keycode, s);
> -    qemu_register_reset(ps2_reset, &s->common);
> +    qemu_register_reset(ps2_kbd_reset, s);
>      return s;
>  }
>
> @@ -603,9 +629,9 @@ void *ps2_mouse_init(void (*update_irq)(void *,
> int), void *update_arg)
>
>      s->common.update_irq = update_irq;
>      s->common.update_arg = update_arg;
> -    ps2_reset(&s->common);
> +    ps2_mouse_reset(s);
>      register_savevm("ps2mouse", 0, 2, ps2_mouse_save, ps2_mouse_load, s);
>      qemu_add_mouse_event_handler(ps2_mouse_event, s, 0, "QEMU PS/2 Mouse");
> -    qemu_register_reset(ps2_reset, &s->common);
> +    qemu_register_reset(ps2_mouse_reset, s);
>      return s;
>  }
>
>
>   

      reply	other threads:[~2009-07-15  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  1:30 [Qemu-devel] [PATCH] Initialize PS2 keyboard / mouse state on reset Dinesh Subhraveti
2009-07-15  1:45 ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A5D34A1.2020301@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=mangoo@wpkg.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=subhraveti@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.