public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Wu, Hao A" <hao.a.wu@intel.com>,
	"patrick.rudolph@9elements.com" <patrick.rudolph@9elements.com>,
	Matt DeVillier <matt.devillier@gmail.com>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>, "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls
Date: Thu, 28 Jan 2021 02:14:23 +0000	[thread overview]
Message-ID: <BN8PR11MB3666B2935BE17862DFE749BFCABA9@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <DM6PR11MB367333A2183F2C47955B9926CAA00@DM6PR11MB3673.namprd11.prod.outlook.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao
> A
> Sent: Friday, January 22, 2021 9:17 AM
> To: devel@edk2.groups.io; patrick.rudolph@9elements.com
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c:
> remove Get/SetConfig calls
> 
> Sorry, please grant me some time for this patch series. I will try to provide
> feedbacks before end of next week.
> Meanwhile, could you help to provide the information on what kind of tests
> have been performed for these 2 patches? Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Patrick
> > Rudolph
> > Sent: Wednesday, January 20, 2021 11:59 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> > <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>
> > Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c:
> > remove Get/SetConfig calls
> >
> > From: Matt DeVillier <matt.devillier@gmail.com>
> >
> > SetConfig is already called during device enumeration, no need to do
> > it again here.


I found that the InitUSBKeyboard() function, which includes this Get/SetConfig
calls, is triggered during the keyboard reset flow. Even though the
configuration for the keyboard will be set during enumeration, I think it would
be better to keep this reconfiguration in the reset flow.

Best Regards,
Hao Wu


> >
> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> > ---
> >  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 37 --------------------
> >  1 file changed, 37 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > index 5faf82ea57..77e20b203f 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > @@ -801,10 +801,8 @@ InitUSBKeyboard (
> >    IN OUT USB_KB_DEV   *UsbKeyboardDevice
> >
> >    )
> >
> >  {
> >
> > -  UINT16              ConfigValue;
> >
> >    UINT8               Protocol;
> >
> >    EFI_STATUS          Status;
> >
> > -  UINT32              TransferResult;
> >
> >
> >
> >    REPORT_STATUS_CODE_WITH_DEVICE_PATH (
> >
> >      EFI_PROGRESS_CODE,
> >
> > @@ -816,41 +814,6 @@ InitUSBKeyboard (
> >    InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
> >
> >    InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof
> > (EFI_KEY_DATA));
> >
> >
> >
> > -  //
> >
> > -  // Use the config out of the descriptor
> >
> > -  // Assumed the first config is the correct one and this is not
> > always the case
> >
> > -  //
> >
> > -  Status = UsbGetConfiguration (
> >
> > -             UsbKeyboardDevice->UsbIo,
> >
> > -             &ConfigValue,
> >
> > -             &TransferResult
> >
> > -             );
> >
> > -  if (EFI_ERROR (Status)) {
> >
> > -    ConfigValue = 0x01;
> >
> > -    //
> >
> > -    // Uses default configuration to configure the USB Keyboard device.
> >
> > -    //
> >
> > -    Status = UsbSetConfiguration (
> >
> > -               UsbKeyboardDevice->UsbIo,
> >
> > -               ConfigValue,
> >
> > -               &TransferResult
> >
> > -               );
> >
> > -    if (EFI_ERROR (Status)) {
> >
> > -      //
> >
> > -      // If configuration could not be set here, it means
> >
> > -      // the keyboard interface has some errors and could
> >
> > -      // not be initialized
> >
> > -      //
> >
> > -      REPORT_STATUS_CODE_WITH_DEVICE_PATH (
> >
> > -        EFI_ERROR_CODE | EFI_ERROR_MINOR,
> >
> > -        (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),
> >
> > -        UsbKeyboardDevice->DevicePath
> >
> > -        );
> >
> > -
> >
> > -      return EFI_DEVICE_ERROR;
> >
> > -    }
> >
> > -  }
> >
> > -
> >
> >    UsbGetProtocolRequest (
> >
> >      UsbKeyboardDevice->UsbIo,
> >
> >      UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
> >
> > --
> > 2.26.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#70585):
> > https://edk2.groups.io/g/devel/message/70585
> > Mute This Topic: https://groups.io/mt/79981643/1768737
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> > -=-=-=-=-=-=
> >
> 
> 
> 
> 
> 


      reply	other threads:[~2021-01-28  2:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 15:58 [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls Patrick Rudolph
2021-01-20 15:59 ` [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting Patrick Rudolph
2021-01-28  2:14   ` Wu, Hao A
2021-01-28  7:31     ` Patrick Rudolph
2021-01-22  1:17 ` [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls Wu, Hao A
2021-01-28  2:14   ` Wu, Hao A [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN8PR11MB3666B2935BE17862DFE749BFCABA9@BN8PR11MB3666.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox