audk/MdeModulePkg/Bus/Usb/UsbKbDxe
Ruiyu Ni dd190645eb MdeModulePkg/UsbKb: fix shell edit cannot read '!@#$%^&*' characters
Commit 5563281fa2
* ShellPkg/[hex]edit: use SimpleTextInEx to read console
changes shell edit and hexedit to read input through SimpleTextInEx.

It exposes a issue in UsbKeyboard driver:
Per UEFI Spec,
When interpreting the data from this function (ReadKeyStrokeEx), it
should be noted that if a class of printable characters that are
normally adjusted by shift modifiers (e.g. Shift Key + "f" key) would
be presented solely as a KeyData.Key.UnicodeChar without the
associated shift state. So in the previous example of a Shift Key +
"f" key being pressed, the only pertinent data returned would be
KeyData.Key.UnicodeChar with the value of "F".

UsbKeyboard driver does convert Shift Key + "f" to "F" without the
shift state. But it doesn't do the conversion for all printable
characters, e.g.: Shift Key + "1" --> "!".

The root cause is today's logic to check whether a character is
printable or not is as below:
  if ((KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_CAPS_LOCK)
      != 0) {

So it only converts Shift + "a"-"z", but doesn't for Shift + "0"-"9",
and Shift + "["...

The patch updates the check logic as below to fix the issue:
  if ((KeyDescriptor->Unicode != CHAR_NULL) &&
      (KeyDescriptor->ShiftedUnicode != CHAR_NULL) &&
      (KeyDescriptor->Unicode != KeyDescriptor->ShiftedUnicode)) {

The above check is TRUE when the character is printable and
it's *really* affected by Shift key.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-03-26 09:28:58 +08:00
..
ComponentName.c Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid/invalid. 2011-07-06 03:55:36 +00:00
EfiKey.c MdeModulePkg/UsbKb: ReadKeyStrokeEx always return key state 2018-02-01 14:03:58 +08:00
EfiKey.h MdeModulePkg: Update comments in SimpleTextInEx according to UEFI 2.7 2017-06-20 09:29:42 +08:00
KeyBoard.c MdeModulePkg/UsbKb: fix shell edit cannot read '!@#$%^&*' characters 2018-03-26 09:28:58 +08:00
KeyBoard.h MdeModulePkg/UsbKb: ReadKeyStrokeEx always return key state 2018-02-01 14:03:58 +08:00
UsbKbDxe.inf MdeModulePkg: list ARM and AARCH64 as valid architectures for some modules 2015-02-23 16:05:50 +00:00
UsbKbDxe.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UsbKbDxeExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00