Hi Hervé, On Sun, Oct 21, 2018 at 9:12 PM Hervé Poussineau <hpous...@reactos.org> wrote: > A check for scan_enabled has been added to ps2_keyboard_event in commit > 143c04c7e0639e53086519592ead15d2556bfbf2 to prevent stream corruption. > This works well as long as operating system is resetting keyboard, or > enabling it. > > This fixes IBM 40p firmware, which doesn't bother sending KBD_CMD_RESET, > KBD_CMD_ENABLE or KBD_CMD_RESET_ENABLE before trying to use the keyboard. > > Signed-off-by: Hervé Poussineau <hpous...@reactos.org> > --- > hw/input/ps2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/input/ps2.c b/hw/input/ps2.c > index fdfcadf9a1..eded4f0f8d 100644 > --- a/hw/input/ps2.c > +++ b/hw/input/ps2.c > @@ -938,7 +938,7 @@ static void ps2_kbd_reset(void *opaque) > > trace_ps2_kbd_reset(opaque); > ps2_common_reset(&s->common); > - s->scan_enabled = 0; > + s->scan_enabled = 1; > s->translate = 0; > s->scancode_set = 2; > s->modifiers = 0; > -- > 2.11.0 >
I think QOM'ifying this device would force a cleanup of those various reset functions. Then ps2_kbd_reset could call ps2_reset_keyboard. In the meantime this patch makes sense as a bugfix. Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> Regards, Phil.