public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Implementing EFI_SIMPLE_TEXT_INPUT_PROTOCOL
@ 2018-09-06  3:27 Heinrich Schuchardt
  2018-09-06  5:27 ` Ni, Ruiyu
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2018-09-06  3:27 UTC (permalink / raw)
  To: Ruiyu Ni
  Cc: Leif Lindholm, Alexander Graf, Takahiro Akashi, Rob Clark,
	U-Boot Mailing List, edk2-devel

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?

But what about CTRL+[ - CTRL+_ ? Why are they suppressed in the EDK2
keyboard drivers? How do we enter U+001c - U+001f?

Best regards

Heinrich


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Implementing EFI_SIMPLE_TEXT_INPUT_PROTOCOL
  2018-09-06  3:27 Implementing EFI_SIMPLE_TEXT_INPUT_PROTOCOL Heinrich Schuchardt
@ 2018-09-06  5:27 ` Ni, Ruiyu
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ruiyu @ 2018-09-06  5:27 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Leif Lindholm, Alexander Graf, Takahiro Akashi, Rob Clark,
	U-Boot Mailing List, edk2-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-06  5:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06  3:27 Implementing EFI_SIMPLE_TEXT_INPUT_PROTOCOL Heinrich Schuchardt
2018-09-06  5:27 ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox