回复: [edk2-rfc] [RFC] Have new interface in EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL to disable hotkey support


gaoliming
 

Nickle:

-----邮件原件-----
发件人: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>
发送时间: 2021年3月25日 15:41
收件人: rfc@edk2.groups.io; gaoliming@byosoft.com.cn; lersek@redhat.com
抄送: 'Dandan Bi' <dandan.bi@intel.com>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@hpe.com>; Wang, Nickle (HPS SW)
<nickle.wang@hpe.com>
主题: 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@redhat.com; Wang, Nickle (HPS SW)
<nickle.wang@hpe.com>
Cc: 'Dandan Bi' <dandan.bi@intel.com>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@hpe.com>
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@hpe.com
抄送: Dandan Bi <dandan.bi@intel.com>; Chang, Abner (HPS SW/FW
Technologist) <abner.chang@hpe.com>
主题: 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.
2. Browser may have the different Hotkey. UEFI driver doesn't know to disable which Hotkey.

In fact, UEFI spec defines HII ConfigAccess protocol for data read and write. HII driver should follow this way.
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.

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