On 9/6/2018 11:27 AM, Heinrich Schuchardt wrote:
Hello Ruiyu,

currently I am struggling a bit with interpreting the UEFI spec
concerning the EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

In UEFI spec 2.7. chapter 12.1.2 ConsoleIn Definition there is this
sentence:

"Only the control characters defined in Table 100 have meaning in the
Unicode input or output streams."

Table 100:

U+0000 Null character ignored when received.
U+0008 Backspace. Moves cursor left one column.
U+0009 Tab.
U+000A Linefeed. Moves cursor  to the next line.
U+000D Carriage Return. Moves cursor to left margin of the current line.

Rob interpreted this in a patch for U-Boot such that he simply
suppressed all other Unicode characters in the 0x00-01F range except for
special treatment of 0x001b as ESC.

When I look at EDK2 function USBKeyboardReadKeyStroke()
(MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c:700) it seems that EDK2 would
pass CTRL+C as Unicode character U+0003 (cf. your patch 608817ad7114
"Change the SimpleTextInEx implementation to return CTRL+C").

The same seems to be the case in function KeyboardReadKeyStroke()
(MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c:265).

So do I get it right that for CTRL+A to CTRL+Z we should return a value
U+0001 - U+001a in Key->UnicodeChar and table 100 is about meaning of
control characters only and does *not* prescribe a filter?
The reason to return U+0003 for CTRL+C because SimpleTextIn cannot return the CTRL state so it uses U+0003 to tell caller that CTRL+C is pressed. I think your interpretation to the spec is right.


But what about CTRL+[ - CTRL+_ ? Why are they suppressed in the EDK2
keyboard drivers? How do we enter U+001c - U+001f?
Good question. I didn't think about how to translate CTRL+[ and etc.
The patch I made 7 years ago was to meet the purpose how to tell caller the CTRL+[ALPHA] is pressed. There was no requirement to tell caller whether CTRL+[ (etc.) is pressed at that moment. I think since SimpleTextInEx is introduced in UEFI Spec, which can return more precise key state/toggle information, caller should use the Ex version. I think it's ok for your driver to translate CTRL+[. I doubt any consumer code cares about that.


Best regards

Heinrich



--
Thanks,
Ray
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to