CopyMem (Key, &Queue->Q[Queue->Front], sizeof (EFI_KEY_DATA));\r
Queue->Front = (Queue->Front + 1) % MAX_Q;\r
\r
+ if (Key->Key.ScanCode == SCAN_NULL && Key->Key.UnicodeChar == CHAR_NULL) {\r
+ if (!Private->IsPartialKeySupport) {\r
+ //\r
+ // If partial keystrok is not enabled, don't return the partial keystroke.\r
+ //\r
+ Private->WinNtThunk->LeaveCriticalSection (&Queue->Cs);\r
+ ZeroMem (Key, sizeof (EFI_KEY_DATA));\r
+ return EFI_NOT_READY;\r
+ }\r
+ }\r
Private->WinNtThunk->LeaveCriticalSection (&Queue->Cs);\r
return EFI_SUCCESS;\r
}\r
\r
Arguments:\r
\r
- RegsiteredData - A pointer to a buffer that is filled in with the keystroke \r
+ RegsiteredData - A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was registered.\r
- InputData - A pointer to a buffer that is filled in with the keystroke \r
+ InputData - A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was pressed.\r
\r
Returns:\r
TRUE - Key be pressed matches a registered key.\r
- FLASE - Match failed. \r
- \r
+ FLASE - Match failed.\r
+\r
--*/\r
{\r
ASSERT (RegsiteredData != NULL && InputData != NULL);\r
- \r
+\r
if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||\r
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {\r
- return FALSE; \r
- } \r
- \r
+ return FALSE;\r
+ }\r
+\r
//\r
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.\r
//\r
if (RegsiteredData->KeyState.KeyShiftState != 0 &&\r
RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {\r
- return FALSE; \r
- } \r
+ return FALSE;\r
+ }\r
if (RegsiteredData->KeyState.KeyToggleState != 0 &&\r
RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {\r
- return FALSE; \r
- } \r
- \r
+ return FALSE;\r
+ }\r
+\r
return TRUE;\r
\r
}\r
Arguments:\r
\r
Private - The private structure of WinNt Gop device.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ KeyData - A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was pressed.\r
\r
Returns:\r
\r
EFI_SUCCESS - The status light is updated successfully.\r
\r
---*/ \r
-{ \r
+--*/\r
+{\r
LIST_ENTRY *Link;\r
WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;\r
- \r
+\r
for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
CurrentNotify = CR (\r
- Link, \r
- WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY, \r
- NotifyEntry, \r
+ Link,\r
+ WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY,\r
+ NotifyEntry,\r
WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE\r
);\r
if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
CurrentNotify->KeyNotificationFn (KeyData);\r
}\r
- } \r
+ }\r
}\r
\r
VOID\r
}\r
if (Private->LeftShift) {\r
KeyData.KeyState.KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;\r
- } \r
+ }\r
if (Private->RightShift) {\r
KeyData.KeyState.KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;\r
}\r
}\r
if (Private->SysReq) {\r
KeyData.KeyState.KeyShiftState |= EFI_SYS_REQ_PRESSED;\r
- } \r
+ }\r
if (Private->CapsLock) {\r
KeyData.KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;\r
}\r
if (Private->ScrollLock) {\r
KeyData.KeyState.KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;\r
}\r
- \r
+ if (Private->IsPartialKeySupport) {\r
+ KeyData.KeyState.KeyToggleState |= EFI_KEY_STATE_EXPOSED;\r
+ }\r
+\r
//\r
// Convert Ctrl+[1-26] to Ctrl+[A-Z]\r
//\r
- if ((Private->LeftCtrl || Private->RightCtrl) && \r
+ if ((Private->LeftCtrl || Private->RightCtrl) &&\r
(KeyData.Key.UnicodeChar >= 1) && (KeyData.Key.UnicodeChar <= 26)\r
) {\r
if ((Private->LeftShift || Private->RightShift) == Private->CapsLock) {\r
\r
EFI_SUCCESS - The status light is updated successfully.\r
\r
---*/ \r
-{ \r
+--*/\r
+{\r
//\r
- // BUGBUG:Only SendInput/keybd_event function can toggle \r
+ // BUGBUG:Only SendInput/keybd_event function can toggle\r
// NumLock, CapsLock and ScrollLock keys.\r
// Neither of these functions is included in EFI_WIN_NT_THUNK_PROTOCOL.\r
// Thus, return immediately without operation.\r
//\r
return EFI_SUCCESS;\r
- \r
+\r
}\r
\r
\r
Private->RightLogo = FALSE;\r
Private->Menu = FALSE;\r
Private->SysReq = FALSE;\r
- \r
+\r
Private->CapsLock = FALSE;\r
Private->NumLock = FALSE;\r
Private->ScrollLock = FALSE;\r
- \r
+ Private->IsPartialKeySupport = FALSE;\r
+\r
Private->KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;\r
Private->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
\r
/*++\r
\r
Routine Description:\r
- Reads the next keystroke from the input device. The WaitForKey Event can \r
+ Reads the next keystroke from the input device. The WaitForKey Event can\r
be used to test for existance of a keystroke via WaitForEvent () call.\r
\r
Arguments:\r
Private - The private structure of WinNt Gop device.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ KeyData - A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was pressed.\r
\r
Returns:\r
EFI_SUCCESS - The keystroke information was returned.\r
EFI_NOT_READY - There was no keystroke data availiable.\r
- EFI_DEVICE_ERROR - The keystroke information was not returned due to \r
+ EFI_DEVICE_ERROR - The keystroke information was not returned due to\r
hardware errors.\r
- EFI_INVALID_PARAMETER - KeyData is NULL. \r
+ EFI_INVALID_PARAMETER - KeyData is NULL.\r
\r
--*/\r
{\r
EFI_STATUS Status;\r
- EFI_TPL OldTpl; \r
+ EFI_TPL OldTpl;\r
\r
if (KeyData == NULL) {\r
return EFI_INVALID_PARAMETER;\r
Status = GopPrivateDeleteQ (Private, &Private->QueueForRead, KeyData);\r
if (!EFI_ERROR (Status)) {\r
//\r
- // Leave critical section and return\r
+ // If partial keystroke is not enabled, check whether it is value key. If not return\r
+ // EFI_NOT_READY.\r
//\r
- gBS->RestoreTPL (OldTpl);\r
- return EFI_SUCCESS;\r
+ if (!Private->IsPartialKeySupport) {\r
+ if (KeyData->Key.ScanCode == SCAN_NULL && KeyData->Key.UnicodeChar == CHAR_NULL) {\r
+ Status = EFI_NOT_READY;\r
+ }\r
+ }\r
}\r
}\r
\r
EFI_KEY_DATA KeyData;\r
\r
Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);\r
-\r
- Status = GopPrivateReadKeyStrokeWorker (Private, &KeyData);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
- \r
- return EFI_SUCCESS; \r
+ //\r
+ // Considering if the partial keystroke is enabled, there maybe a partial\r
+ // keystroke in the queue, so here skip the partial keystroke and get the\r
+ // next key from the queue\r
+ //\r
+ while (1) {\r
+ Status = GopPrivateReadKeyStrokeWorker (Private, &KeyData);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {\r
+ continue;\r
+ }\r
+ CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
+ return EFI_SUCCESS;\r
+ } \r
}\r
\r
\r
GOP_PRIVATE_DATA *Private;\r
EFI_STATUS Status;\r
EFI_TPL OldTpl;\r
+ EFI_KEY_DATA KeyData;\r
\r
Private = (GOP_PRIVATE_DATA *) Context;\r
\r
// Enter critical section\r
//\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
- \r
+\r
//\r
// Call hot key callback before telling caller there is a key available\r
//\r
WinNtGopSimpleTextInTimerHandler (NULL, Private);\r
-\r
- Status = GopPrivateCheckQ (&Private->QueueForRead);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // If a there is a key in the queue signal our event.\r
- //\r
- gBS->SignalEvent (Event);\r
- } else {\r
- //\r
- // We need to sleep or NT will schedule this thread with such high\r
- // priority that WinProc thread will never run and we will not see\r
- // keyboard input. This Sleep makes the syste run 10x faster, so don't\r
- // remove it.\r
- //\r
- Private->WinNtThunk->Sleep (1);\r
+ \r
+ //\r
+ // WaitforKey doesn't suppor the partial key.\r
+ // Considering if the partial keystroke is enabled, there maybe a partial\r
+ // keystroke in the queue, so here skip the partial keystroke and get the\r
+ // next key from the queue\r
+ //\r
+ while (1) {\r
+ Status = GopPrivateCheckQ (&Private->QueueForRead);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // If a there is a key in the queue and it is not partial keystroke, signal event.\r
+ //\r
+ if (Private->QueueForRead.Q[Private->QueueForRead.Front].Key.ScanCode == SCAN_NULL &&\r
+ Private->QueueForRead.Q[Private->QueueForRead.Front].Key.UnicodeChar == CHAR_NULL) {\r
+ GopPrivateDeleteQ (Private,&Private->QueueForRead,&KeyData);\r
+ continue;\r
+ }\r
+ gBS->SignalEvent (Event);\r
+ } else {\r
+ //\r
+ // We need to sleep or NT will schedule this thread with such high\r
+ // priority that WinProc thread will never run and we will not see\r
+ // keyboard input. This Sleep makes the syste run 10x faster, so don't\r
+ // remove it.\r
+ //\r
+ Private->WinNtThunk->Sleep (1);\r
+ }\r
+ break;\r
}\r
\r
//\r
GOP_PRIVATE_DATA *Private;\r
\r
Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);\r
- \r
+\r
return GopPrivateResetWorker (Private);\r
}\r
\r
/*++\r
\r
Routine Description:\r
- Reads the next keystroke from the input device. The WaitForKey Event can \r
+ Reads the next keystroke from the input device. The WaitForKey Event can\r
be used to test for existance of a keystroke via WaitForEvent () call.\r
\r
Arguments:\r
This - Protocol instance pointer.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ KeyData - A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was pressed.\r
\r
Returns:\r
EFI_SUCCESS - The keystroke information was returned.\r
EFI_NOT_READY - There was no keystroke data availiable.\r
- EFI_DEVICE_ERROR - The keystroke information was not returned due to \r
+ EFI_DEVICE_ERROR - The keystroke information was not returned due to\r
hardware errors.\r
- EFI_INVALID_PARAMETER - KeyData is NULL. \r
+ EFI_INVALID_PARAMETER - KeyData is NULL.\r
\r
--*/\r
{\r
}\r
\r
Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);\r
- \r
+\r
return GopPrivateReadKeyStrokeWorker (Private, KeyData);\r
\r
}\r
\r
Arguments:\r
This - Protocol instance pointer.\r
- KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
+ KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
state for the input device.\r
- \r
- Returns: \r
+\r
+ Returns:\r
EFI_SUCCESS - The device state was set successfully.\r
- EFI_DEVICE_ERROR - The device is not functioning correctly and could \r
+ EFI_DEVICE_ERROR - The device is not functioning correctly and could\r
not have the setting adjusted.\r
EFI_UNSUPPORTED - The device does not have the ability to set its state.\r
- EFI_INVALID_PARAMETER - KeyToggleState is NULL. \r
+ EFI_INVALID_PARAMETER - KeyToggleState is NULL.\r
\r
---*/ \r
+--*/\r
{\r
EFI_STATUS Status;\r
GOP_PRIVATE_DATA *Private;\r
\r
if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||\r
((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {\r
- return EFI_UNSUPPORTED; \r
+ return EFI_UNSUPPORTED;\r
}\r
\r
- Private->ScrollLock = FALSE;\r
- Private->NumLock = FALSE;\r
- Private->CapsLock = FALSE;\r
+ Private->ScrollLock = FALSE;\r
+ Private->NumLock = FALSE;\r
+ Private->CapsLock = FALSE;\r
+ Private->IsPartialKeySupport = FALSE;\r
\r
if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {\r
Private->ScrollLock = TRUE;\r
- } \r
+ }\r
if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {\r
Private->NumLock = TRUE;\r
}\r
if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {\r
Private->CapsLock = TRUE;\r
}\r
+ if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {\r
+ Private->IsPartialKeySupport = TRUE;\r
+ }\r
\r
- Status = GopPrivateUpdateStatusLight (Private); \r
+ Status = GopPrivateUpdateStatusLight (Private);\r
if (EFI_ERROR (Status)) {\r
return EFI_DEVICE_ERROR;\r
}\r
\r
Private->KeyState.KeyToggleState = *KeyToggleState;\r
return EFI_SUCCESS;\r
- \r
+\r
}\r
\r
EFI_STATUS\r
\r
Arguments:\r
This - Protocol instance pointer.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ KeyData - A pointer to a buffer that is filled in with the keystroke\r
information data for the key that was pressed.\r
- KeyNotificationFunction - Points to the function to be called when the key \r
- sequence is typed specified by KeyData. \r
- NotifyHandle - Points to the unique handle assigned to the registered notification. \r
+ KeyNotificationFunction - Points to the function to be called when the key\r
+ sequence is typed specified by KeyData.\r
+ NotifyHandle - Points to the unique handle assigned to the registered notification.\r
\r
Returns:\r
EFI_SUCCESS - The notification function was registered successfully.\r
EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r
- EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. \r
- \r
---*/ \r
+ EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.\r
+\r
+--*/\r
{\r
GOP_PRIVATE_DATA *Private;\r
WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;\r
LIST_ENTRY *Link;\r
- WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify; \r
+ WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify;\r
\r
if (KeyData == NULL || KeyNotificationFunction == NULL || NotifyHandle == NULL) {\r
return EFI_INVALID_PARAMETER;\r
//\r
for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
CurrentNotify = CR (\r
- Link, \r
- WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY, \r
- NotifyEntry, \r
+ Link,\r
+ WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY,\r
+ NotifyEntry,\r
WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE\r
);\r
- if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) { \r
+ if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {\r
*NotifyHandle = CurrentNotify->NotifyHandle;\r
return EFI_SUCCESS;\r
}\r
}\r
- } \r
- \r
+ }\r
+\r
//\r
// Allocate resource to save the notification function\r
- // \r
+ //\r
NewNotify = (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY));\r
if (NewNotify == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- NewNotify->Signature = WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE; \r
+ NewNotify->Signature = WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE;\r
NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify;\r
CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));\r
InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry);\r
\r
- *NotifyHandle = NewNotify->NotifyHandle; \r
- \r
+ *NotifyHandle = NewNotify->NotifyHandle;\r
+\r
return EFI_SUCCESS;\r
- \r
+\r
}\r
\r
EFI_STATUS\r
Remove a registered notification function from a particular keystroke.\r
\r
Arguments:\r
- This - Protocol instance pointer. \r
+ This - Protocol instance pointer.\r
NotificationHandle - The handle of the notification function being unregistered.\r
\r
Returns:\r
EFI_SUCCESS - The notification function was unregistered successfully.\r
EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r
- \r
---*/ \r
+\r
+--*/\r
{\r
GOP_PRIVATE_DATA *Private;\r
LIST_ENTRY *Link;\r
\r
if (NotificationHandle == NULL) {\r
return EFI_INVALID_PARAMETER;\r
- } \r
+ }\r
\r
if (((WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) NotificationHandle)->Signature != WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) {\r
return EFI_INVALID_PARAMETER;\r
- } \r
+ }\r
\r
Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);\r
\r
for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
CurrentNotify = CR (\r
- Link, \r
- WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY, \r
- NotifyEntry, \r
+ Link,\r
+ WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY,\r
+ NotifyEntry,\r
WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE\r
- ); \r
+ );\r
if (CurrentNotify->NotifyHandle == NotificationHandle) {\r
//\r
// Remove the notification function from NotifyList and free resources\r
//\r
- RemoveEntryList (&CurrentNotify->NotifyEntry); \r
+ RemoveEntryList (&CurrentNotify->NotifyEntry);\r
\r
- gBS->FreePool (CurrentNotify); \r
+ gBS->FreePool (CurrentNotify);\r
return EFI_SUCCESS;\r
}\r
}\r
&Private->SimpleTextIn.WaitForKey\r
);\r
\r
- \r
+\r
Private->SimpleTextInEx.Reset = WinNtGopSimpleTextInExResetEx;\r
Private->SimpleTextInEx.ReadKeyStrokeEx = WinNtGopSimpleTextInExReadKeyStrokeEx;\r
Private->SimpleTextInEx.SetState = WinNtGopSimpleTextInExSetState;\r
Private->SimpleTextInEx.UnregisterKeyNotify = WinNtGopSimpleTextInExUnregisterKeyNotify;\r
\r
Private->SimpleTextInEx.Reset (&Private->SimpleTextInEx, FALSE);\r
- \r
+\r
InitializeListHead (&Private->NotifyList);\r
\r
Status = gBS->CreateEvent (\r
&Private->TimerEvent\r
);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
Status = gBS->SetTimer (\r
Private->TimerEvent,\r
TimerPeriodic,\r