[RFC] Have new interface in EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey support


Nickle Wang
 

Thanks for your feedback, Liming. Please see my comment below.

-----Original Message-----
From: rfc@edk2.groups.io <rfc@edk2.groups.io> On Behalf Of gaoliming
Sent: Friday, March 26, 2021 9:51 AM
To: Wang, Nickle (HPS SW) <nickle.wang@...>; rfc@edk2.groups.io;
lersek@...
Cc: 'Dandan Bi' <dandan.bi@...>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@...>
Subject: 回复: [edk2-rfc] [RFC] Have new interface in
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey support

Nickle:

-----邮件原件-----
发件人: Wang, Nickle (HPS SW) <nickle.wang@...>
发送时间: 2021年3月25日 15:41
收件人: rfc@edk2.groups.io; gaoliming@...;
lersek@...
抄送: 'Dandan Bi' <dandan.bi@...>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@...>; Wang, Nickle (HPS SW)
<nickle.wang@...>
主题: RE: [edk2-rfc] [RFC] Have new interface in
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey
support


-----Original Message-----
From: rfc@edk2.groups.io <rfc@edk2.groups.io> On Behalf Of gaoliming
Sent: Thursday, March 25, 2021 11:40 AM
To: rfc@edk2.groups.io; lersek@...; Wang, Nickle (HPS SW)
<nickle.wang@...>
Cc: 'Dandan Bi' <dandan.bi@...>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@...>
Subject: 回复: [edk2-rfc] [RFC] Have new interface in
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey
support



-----邮件原件-----
发件人: rfc@edk2.groups.io <rfc@edk2.groups.io> 代表 Laszlo Ersek
发送时间: 2021年3月24日 19:37
收件人: rfc@edk2.groups.io; nickle.wang@...
抄送: Dandan Bi <dandan.bi@...>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@...>
主题: Re: [edk2-rfc] [RFC] Have new interface in
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey
support

On 03/24/21 09:21, Nickle Wang wrote:
Hi All,

I am having trouble to disable hotkey support in HII browser
with existing
interface. I am wondering if we could have new interface to
disable hotkey support in form browser extension2 protocol.

1. Background:
In some HII driver, there is no need to have hotkey support in
certain HII
menu due to its design. The examples are EDK2 iSCSI driver, secure
boot configuration and Tls auth configuration driver. In these HII
menus, there is HII button to do submit or discard job and they do
not answer to hotkey action. I also see this design in 3rd party
option card driver. In this case, user feels confused because it
dose not do anything while pressing hotkey. The only way to save
or discard data is by pressing the button on HII menu. So, we need
to disable hotkey
support and force user to use HII button.

I agree with the problem statement. I've noticed this too, and
found it confusing.

I wonder if there are HII guidelines or best known practices to
deal with it -- I assume that one desirable solution might be if
we could control the hotkeys just from the VFR, one way or
another. But indeed I don't know if that's feasible by design.
UEFI driver write guide 12.6.1 Minimize callbacks section defines
the guide line.
https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Driver-
Writer%27s-Guide

But, some HII drivers still like to control submit/discard/exit in
its form by Callback function.
Hotkey way is to consume HII driver ConfigAccess protocol
RouteConfig() function for data saving.
So, HotKey doesn't work on those drivers.

For this proposal, I want to understand when new interface will be
trigged and what module calls this new API.
The module to call this new API is the HII driver which has no hotkey
support in its HII menu. The HII driver could also be option card driver.

As for when the new interface will be triggered, there are two cases
in my
mind:

1. Driver wants to disable hotkey support for entire HII form-set.
1.1 Driver will call new interface in ExtractConfig() function with
Scope "FormSetLevel".
1.2 Driver calls new interface in Callback() function when Action is
set to EFI_BROWSER_ACTION_FORM_OPEN. With Scope " FormLevel", this
will disable hotkey for every HII menu.
2. Driver only disable hotkey support for certain HII menu.
2. Same as 1.2 but driver have condition check to see if this is
target HII menu or not. The Scope is set to " FormLevel" and the
hotkey support is restored automatically by display engine when user
leaves this HII menu.
So, your proposal is to let HII driver call new API to disable or enable Hotkey
on its page.
There are still some issues here.
1. UEFI option rom driver is the independent driver. It refers to the standard
UEFI interface.
But, form browser extension2 protocol is edk2 extension. Other UEFI
implementation may not provide this protocol.
It would be good if we could have HII hotkey definition in UEFI specification. But it looks like the HII hotkey support is just EDK2 form browser implementation specific. So I would like to address the issue from EDK2 protocol.

As far as I know, option card vendor has chance to support edk2 protocol because edk2 is kind like the industrial UEFI implementation. And it is also easy to know if this system supports form browser extension2 protocol or not. Option card driver could code its behaviour accordingly

2. Browser may have the different Hotkey. UEFI driver doesn't know to
disable which Hotkey.
Yes, I also noticed this. So the new interface accept "Action" of hotkey as parameter. So that UEFI driver does not need to know which hotkey he has to disable. For example, browser may define F9 for BROWSER_ACTION_SUBMIT and F10 to do BROWSER_ACTION_DEFAULT. Then, no matter what hotkey that browser defines for submit and default job, UEFI driver can disable them by below calls:

EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL.DisableHotkey (BROWSER_ACTION_SUBMIT, FormLevel);
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL.DisableHotkey (BROWSER_ACTION_DEFAULT, FormLevel);

Then browser will disable the hotkey that is binding to above actions. UEFI driver does not need to know the specific hotkey to disable. Instead, UEFI driver disable the action that he does not want to support through hotkey. When UEFI driver provides their own HII button for these actions, he would understand what action that they do not want hotkey support.

In fact, UEFI spec defines HII ConfigAccess protocol for data read and write.
HII driver should follow this way.
I am not the owner of EDK2 iSCSI driver but I expect that there might be some trouble to support hotkey to save iSCSI attempt setting. My guess is: iSCSI attempt menu is not one-to-one mapping between iSCSI attempt setting and HII option. iSCSI attempt menu is shared between multiple network interfaces. In this design, there might be difficulty to do this through HII hotkey. And this also applies to secure boot key enrolment case and TLS certificate enrolment case in EDK2 drivers.

If HII driver doesn't use this way, it can't be handled by Browser. I think this is
the expected behavior.
We don't need to introduce new API for it.
Yes it is expected behavior. But from my point of view, as I mentioned above, there might be some trouble to support it so HII driver does not follow this way. I can see cases in EDK2 driver.

Thanks,
Nickle

Thanks,
Nickle

Thanks
Liming
Thanks
Laszlo


2. Issue:
Currently we have
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL.RegisterHotKey to
create or
delete hotkey support. With value 0 in "Action", we can delete
corresponding hotkey.

typedef
EFI_STATUS
(EFIAPI *REGISTER_HOT_KEY) (
IN EFI_INPUT_KEY *KeyData,
IN UINT32 Action,
IN UINT16 DefaultId,
IN EFI_STRING HelpString OPTIONAL
);

However, there are some troubles for driver or option card
driver to use it
and delete hotkey support.

* Usually, display engine is the one who creates hotkey in HII
browser.
So driver has no information about the key data. And there is no
way to get these hotkey information programmatically.
* If driver tries to delete hotkey for its HII menu, it requires driver
to
restore hokey support when user leaves its HII menu. This could
easily break the hotkey support in HII browser because display
engine has no control to this.

3. Proposal:
I would like to propose new interface in
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL so that driver can
temporarily
disable hotkey support for certain HII menu in its own form-set.
And display engine will handle the hotkey support accordingly.

struct EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL {
...
REGISTER_HOT_KEY RegisterHotKey;
DISABLE_HOT_KEY DisableHotKey;
...
};

/**
Disable the hotkey by given its browser action.

@param[in] Action Action value to disable corresponding
hotkey.
@param[in] Scope Hotkey scope level to be disabled.

@retval EFI_SUCCESS Hotkey is disabled.
@retval EFI_NOT_FOUND Hotkey with given Action is not found.
**/
typedef
EFI_STATUS
(EFIAPI *DISABLE_HOT_KEY) (
IN UINT32 Action,
IN BROWSER_SETTING_SCOPE Scope );



May I have your comment about this? Is this good idea for driver to
disable
hotkey support?

Thanks,
Nickle