public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Huajing Li <huajing.li@intel.com>, Jaben Carsey <jaben.carsey@intel.com>
Subject: [PATCH 12/14] ShellPkg/dh: Modify the dump of UsbIo protocol
Date: Fri, 22 Sep 2017 13:50:12 +0800	[thread overview]
Message-ID: <20170922055014.27288-13-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170922055014.27288-1-ruiyu.ni@intel.com>

From: Huajing Li <huajing.li@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Huajing Li <huajing.li@intel.com>
---
 .../UefiHandleParsingLib/UefiHandleParsingLib.c    | 61 +++++++++++++++++++++-
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  |  5 +-
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index e5b4bea8f6..164caa9b91 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -1245,6 +1245,65 @@ PciIoProtocolDumpInformation (
 }
 
 /**
+  Function to dump information about UsbIoProtocol.
+
+  This will allocate the return buffer from boot services pool.
+
+  @param[in] TheHandle      The handle that has PciRootBridgeIo installed.
+  @param[in] Verbose        TRUE for additional information, FALSE otherwise.
+
+  @retval A poitner to a string containing the information.
+**/
+CHAR16*
+EFIAPI
+UsbIoProtocolDumpInformation (
+  IN CONST EFI_HANDLE TheHandle,
+  IN CONST BOOLEAN    Verbose
+  )
+{
+  EFI_STATUS                    Status;
+  EFI_USB_IO_PROTOCOL           *UsbIo;
+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDesc;
+  CHAR16                        *GetString;
+  CHAR16                        *RetVal;
+
+  if (!Verbose) {
+    return (NULL);
+  }
+  RetVal = NULL;
+  GetString = NULL;
+  Status = gBS->OpenProtocol (
+                  TheHandle,
+                  &gEfiUsbIoProtocolGuid,
+                  (VOID**)&UsbIo,
+                  gImageHandle,
+                  NULL,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+
+  if (EFI_ERROR(Status)) {
+    return NULL;
+  }
+  UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
+  HandleParsingHiiInit ();
+  GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_USBIO_DUMP_MAIN), NULL);
+  if (GetString == NULL) {
+    return NULL;
+  }
+  RetVal = CatSPrint (
+            NULL,
+            GetString,
+            InterfaceDesc.InterfaceNumber,
+            InterfaceDesc.InterfaceClass,
+            InterfaceDesc.InterfaceSubClass,
+            InterfaceDesc.InterfaceProtocol
+            );
+
+  FreePool (GetString);
+  return RetVal;
+}
+
+/**
   Function to dump information about EfiAdapterInformation Protocol.
 
   @param[in] TheHandle      The handle that has the protocol installed.
@@ -1964,7 +2023,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   {STRING_TOKEN(STR_SCSI_IO),               &gEfiScsiIoProtocolGuid,                          NULL},
   {STRING_TOKEN(STR_SCSI_PT_EXT),           &gEfiExtScsiPassThruProtocolGuid,                 NULL},
   {STRING_TOKEN(STR_ISCSI),                 &gEfiIScsiInitiatorNameProtocolGuid,              NULL},
-  {STRING_TOKEN(STR_USB_IO),                &gEfiUsbIoProtocolGuid,                           NULL},
+  {STRING_TOKEN(STR_USB_IO),                &gEfiUsbIoProtocolGuid,                           UsbIoProtocolDumpInformation},
   {STRING_TOKEN(STR_USB_HC),                &gEfiUsbHcProtocolGuid,                           NULL},
   {STRING_TOKEN(STR_USB_HC2),               &gEfiUsb2HcProtocolGuid,                          NULL},
   {STRING_TOKEN(STR_DEBUG_SUPPORT),         &gEfiDebugSupportProtocolGuid,                    DebugSupportProtocolDumpInformation},
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
index 59409d9ca0..98299cd1d0 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
@@ -358,7 +358,10 @@
                                                   "     Device ID.....: %04x\r\n"
                                                   "     Class Code....: %02x %02x %02x\r\n"
                                                   "     Configuration Header :"
-
+#string STR_USBIO_DUMP_MAIN       #language en-US "     Interface Number #.....: %02x\r\n"
+                                                  "     Interface Class #......: %02x\r\n"
+                                                  "     Interface Subclass #...: %02x\r\n"
+                                                  "     Interface Protocol #...: %02x"
 
 #string STR_LI_DUMP_NAME          #language en-US "     Name..........: %%H%s%%N\r\n"
 
-- 
2.12.2.windows.2



  parent reply	other threads:[~2017-09-22  5:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22  5:50 [PATCH 00/14] Refine output of "dh" Ruiyu Ni
2017-09-22  5:50 ` [PATCH 01/14] ShellPkg/dh: display all the protocol names in a single line Ruiyu Ni
2017-09-22  5:50 ` [PATCH 02/14] ShellPkg/dh: change the key information color from blue to hilight Ruiyu Ni
2017-09-22  5:50 ` [PATCH 03/14] ShellPkg/dh: fix the error display "Child Controllers" to "Managing" Ruiyu Ni
2017-09-22  5:50 ` [PATCH 04/14] ShellPkg/dh: Display the protocol instance pointer value for "-v" Ruiyu Ni
2017-09-22  5:50 ` [PATCH 05/14] ShellPkg/dh: Modify the dump of "ImageDevicePath" and "DevicePath" Ruiyu Ni
2017-09-22  5:50 ` [PATCH 06/14] ShellPkg/dh: Modify the dump of LoadedImage protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 07/14] ShellPkg/dh: Modify the dump of BusSpecificDriverOverride protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 08/14] ShellPkg/dh: Modify the dump of BlockIo protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 09/14] ShellPkg/dh: Modify the dump of DebugSupport protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 10/14] ShellPkg/dh: Modify the dump of GraphicsOutput protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 11/14] ShellPkg/dh: Modify the dump of PciIo protocol Ruiyu Ni
2017-09-22  5:50 ` Ruiyu Ni [this message]
2017-09-22  5:50 ` [PATCH 13/14] ShellPkg/dh: Modify the dump of UsbIo protocol Ruiyu Ni
2017-09-22  5:50 ` [PATCH 14/14] ShellPkg/dh: Refine the dump output Ruiyu Ni
2017-09-22 11:57 ` [PATCH 00/14] Refine output of "dh" Laszlo Ersek
2017-09-22 14:04 ` Carsey, Jaben

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=20170922055014.27288-13-ruiyu.ni@intel.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