[edk2-devel] [PATCH v2] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device

Guomin Jiang posted 1 patch 4 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20200426072451.884-1-guomin.jiang@intel.com
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
[edk2-devel] [PATCH v2] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device
Posted by Guomin Jiang 4 years ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2694

When the USB fail and then Reset Device, it should rebuild description.

Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 4b4915c019..90548da38b 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -869,6 +869,18 @@ UsbIoPortReset (
 
   DEBUG (( EFI_D_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", Dev->Address));
 
+  Status = UsbGetMaxPacketSize0 (Dev);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "UsbIoPortRest: Fail to get max packet size - %r\n", Status));
+    goto ON_EXIT;
+  }
+
+  Status = UsbBuildDescTable (Dev);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "UsbIoPortRest: Fail to build description table - %r\n", Status));
+    goto ON_EXIT;
+  }
+
   //
   // Reset the current active configure, after this device
   // is in CONFIGURED state.
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58141): https://edk2.groups.io/g/devel/message/58141
Mute This Topic: https://groups.io/mt/73278167/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-