Skip to contentSkip to conversation

ps2kbd: default to scan enabled after reset

PATCH In review Hervé Poussineau 3 participants 6 messages Oct 21, 2018 – Nov 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ps2kbd: default to scan enabled after reset

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.

---
 hw/input/ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/ps2.c +1 -1
index fdfcadf9a1..eded4f0f8d 100644
@@ -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;
Signature · 1 line
2.11.0
#1 lore raw

Ping.

Le 21/10/2018 à 21:07, Hervé Poussineau a écrit :

Quoted 26 lines

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.

---
  hw/input/ps2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/ps2.c +1 -1
index fdfcadf9a1..eded4f0f8d 100644
@@ -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 lore raw

Ping again.

v3.0 didn't contain 143c04c7e0639e53086519592ead15d2556bfbf2, so this commit fixes a regression.

Le 10/11/2018 à 21:53, Hervé Poussineau a écrit :

Quoted 29 lines

Ping.

Le 21/10/2018 à 21:07, Hervé Poussineau a écrit :

Quoted 25 lines

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.

---
  hw/input/ps2.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/ps2.c +1 -1
index fdfcadf9a1..eded4f0f8d 100644
@@ -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;
 
#3 lore raw

Ping again.

Le 18/11/2018 à 11:09, Hervé Poussineau a écrit :

Quoted 36 lines

Ping again.

v3.0 didn't contain 143c04c7e0639e53086519592ead15d2556bfbf2, so this commit fixes a regression.

Le 10/11/2018 à 21:53, Hervé Poussineau a écrit :

Quoted 29 lines

Ping.

Le 21/10/2018 à 21:07, Hervé Poussineau a écrit :

Quoted 25 lines

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.

---
  hw/input/ps2.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/ps2.c +1 -1
index fdfcadf9a1..eded4f0f8d 100644
@@ -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;
 
#4 lore raw
Quoted 1 line · Hervé Poussineau

Ping again.

Queued up for 3.1

thanks,
Gerd

Reviewed-by on v1 1/1
#5 lore raw
In reply to Hervé Poussineau

Hi Hervé,

Quoted 26 lines · Hervé Poussineau

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.

---
 hw/input/ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/ps2.c +1 -2
index fdfcadf9a1..eded4f0f8d 100644
@@ -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;
--
Quoted 2 lines

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.

Regards,

Phil.