From f316a26013f2a8cfb1041d9f74a5c6d5bb9df9c9 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Sun, 9 Sep 2018 22:34:57 +0800 Subject: [PATCH] MdeModulePkg: Avoid key notification called more than once REF: https://bugzilla.tianocore.org/show_bug.cgi?id=996 Issue: In current code logic, when a key is pressed, it will search the whole NotifyList to find whether a notification has been registered with the keystroke. if yes, it will en-queue the key for notification execution later. And now if different notification functions have been registered with the same key, then the key will be en-queued more than once. Then it will cause the notification executed more than once. This patch is to enhance the code logic to fix this issue. Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Ruiyu Ni Reviewed-by: Star Zeng --- MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 1 + MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 1 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 1 + 3 files changed, 3 insertions(+) diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c index 2ee293d64d..53cb6f0b48 100644 --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c @@ -1451,6 +1451,7 @@ KeyGetchar ( // PushEfikeyBufTail (&ConsoleIn->EfiKeyQueueForNotify, &KeyData); gBS->SignalEvent (ConsoleIn->KeyNotifyProcessEvent); + break; } } diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c index b3b5fb9ff4..9cb4b5db6b 100644 --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c @@ -1695,6 +1695,7 @@ UsbKeyCodeToEfiInputKey ( // Enqueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, KeyData, sizeof (*KeyData)); gBS->SignalEvent (UsbKeyboardDevice->KeyNotifyProcessEvent); + break; } } diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 33f9b6e585..d681a3039e 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -987,6 +987,7 @@ EfiKeyFiFoInsertOneKey ( // EfiKeyFiFoForNotifyInsertOneKey (TerminalDevice->EfiKeyFiFoForNotify, Key); gBS->SignalEvent (TerminalDevice->KeyNotifyProcessEvent); + break; } } if (IsEfiKeyFiFoFull (TerminalDevice)) { -- 2.39.2