summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb/UsbKbDxe
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-13 08:46:31 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-13 08:46:31 +0000
commitc92e277d99335fa827994e410a3dc0830904a264 (patch)
tree67a5fba32dbd73d284523d82621d5f77a593f76c /MdeModulePkg/Bus/Usb/UsbKbDxe
parent55a64ae0f40421a26dee619dbc3f1e8096081a97 (diff)
downloadedk2-platforms-c92e277d99335fa827994e410a3dc0830904a264.tar.xz
Minor refinement for USB modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7257 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbKbDxe')
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c14
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h2
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c36
3 files changed, 27 insertions, 25 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
index 1ccc8784d0..74f19c3278 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
@@ -120,7 +120,7 @@ USBKeyboardDriverBindingSupported (
}
/**
- Starts the device with this driver.
+ Starts the keyboard device with this driver.
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
@@ -219,7 +219,7 @@ USBKeyboardDriverBindingStart (
EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;
//
- // Traverse endpoints to find interrupt endpoints
+ // Traverse endpoints to find interrupt endpoint
//
Found = FALSE;
for (Index = 0; Index < EndpointNumber; Index++) {
@@ -230,7 +230,7 @@ USBKeyboardDriverBindingStart (
&EndpointDescriptor
);
- if ((EndpointDescriptor.Attributes & 0x03) == USB_ENDPOINT_INTERRUPT) {
+ if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {
//
// We only care interrupt endpoint here
//
@@ -392,7 +392,7 @@ ErrorExit:
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
}
- gBS->FreePool (UsbKeyboardDevice);
+ FreePool (UsbKeyboardDevice);
UsbKeyboardDevice = NULL;
}
gBS->CloseProtocol (
@@ -515,7 +515,7 @@ USBKeyboardDriverBindingStop (
FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);
}
- gBS->FreePool (UsbKeyboardDevice);
+ FreePool (UsbKeyboardDevice);
return Status;
}
@@ -815,7 +815,7 @@ KbdFreeNotifyList (
Link = GetFirstNode (NotifyList);
NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);
RemoveEntryList (Link);
- gBS->FreePool (NotifyNode);
+ FreePool (NotifyNode);
}
return EFI_SUCCESS;
@@ -1165,7 +1165,7 @@ USBKeyboardUnregisterKeyNotify (
NULL
);
ASSERT_EFI_ERROR (Status);
- gBS->FreePool (CurrentNotify);
+ FreePool (CurrentNotify);
return EFI_SUCCESS;
}
}
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
index f8248300ee..84950beab9 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
@@ -209,7 +209,7 @@ USBKeyboardDriverBindingSupported (
);
/**
- Starts the device with this driver.
+ Starts the keyboard device with this driver.
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 3c72822a6d..48972ae0a6 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -413,7 +413,7 @@ GetCurrentKeyboardLayout (
KeyboardLayout
);
if (EFI_ERROR (Status)) {
- gBS->FreePool (KeyboardLayout);
+ FreePool (KeyboardLayout);
KeyboardLayout = NULL;
}
}
@@ -814,7 +814,6 @@ InitUSBKeyboard (
//
// Set boot protocol for the USB Keyboard.
// This driver only supports boot protocol.
- // The device that does not support boot protocol is not supported.
//
if (Protocol != BOOT_PROTOCOL) {
UsbSetProtocolRequest (
@@ -871,33 +870,36 @@ InitUSBKeyboard (
ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);
//
- // Set a timer for repeat keys' generation.
+ // Create event for repeat keys' generation.
//
if (UsbKeyboardDevice->RepeatTimer != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
UsbKeyboardDevice->RepeatTimer = NULL;
}
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- USBKeyboardRepeatHandler,
- UsbKeyboardDevice,
- &UsbKeyboardDevice->RepeatTimer
- );
+ gBS->CreateEvent (
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ USBKeyboardRepeatHandler,
+ UsbKeyboardDevice,
+ &UsbKeyboardDevice->RepeatTimer
+ );
+ //
+ // Create event for delayed recovery, which deals with device error.
+ //
if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
UsbKeyboardDevice->DelayedRecoveryEvent = NULL;
}
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- USBKeyboardRecoveryHandler,
- UsbKeyboardDevice,
- &UsbKeyboardDevice->DelayedRecoveryEvent
- );
+ gBS->CreateEvent (
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ USBKeyboardRecoveryHandler,
+ UsbKeyboardDevice,
+ &UsbKeyboardDevice->DelayedRecoveryEvent
+ );
return EFI_SUCCESS;
}