USB Keyboard Driver that manages USB keyboard and produces Simple Text Input\r
Protocol and Simple Text Input Ex Protocol.\r
\r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;\r
\r
//\r
- // Traverse endpoints to find interrupt endpoint\r
+ // Traverse endpoints to find interrupt endpoint IN\r
//\r
Found = FALSE;\r
for (Index = 0; Index < EndpointNumber; Index++) {\r
&EndpointDescriptor\r
);\r
\r
- if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {\r
+ if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) &&\r
+ ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0)) {\r
//\r
// We only care interrupt endpoint here\r
//\r
}\r
\r
if (IsQueueEmpty (&UsbKeyboardDevice->EfiKeyQueue)) {\r
+ ZeroMem (&KeyData->Key, sizeof (KeyData->Key));\r
+ InitializeKeyState (UsbKeyboardDevice, &KeyData->KeyState);\r
return EFI_NOT_READY;\r
}\r
\r
\r
//\r
// Enter critical section\r
- // \r
+ //\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
- \r
+\r
//\r
// WaitforKey doesn't suppor the partial key.\r
// Considering if the partial keystroke is enabled, there maybe a partial\r
while (TRUE) {\r
//\r
// Enter critical section\r
- // \r
+ //\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
Status = Dequeue (&UsbKeyboardDevice->EfiKeyQueueForNotify, &KeyData, sizeof (KeyData));\r
//\r