public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/UsbMass: Fix USB key write failure
@ 2018-10-23  2:26 Ruiyu Ni
  2018-10-23  2:26 ` Zeng, Star
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2018-10-23  2:26 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

Commit e59db6a732dbbb064b1e39a288a25edc90adac5d
* MdeModulePkg/UsbMass: Merge UsbBoot(Read|Write)Blocks(16)
introduces a bug that causes writing to USB key always fails.

When that patch is verified, only reading was verified.

The root cause is when the writing operation is performed,
the data direction EfiUsbDataIn is wrongly used. Instead, it
should be EfiUsbDataOut.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
index c35c7bdc12..69e2252134 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
@@ -861,7 +861,7 @@ UsbBootReadWriteBlocks (
                UsbMass,
                &Cmd,
                (UINT8) sizeof (USB_BOOT_READ_WRITE_10_CMD),
-               EfiUsbDataIn,
+               Write ? EfiUsbDataOut : EfiUsbDataIn,
                Buffer,
                ByteSize,
                Timeout
@@ -941,7 +941,7 @@ UsbBootReadWriteBlocks16 (
                UsbMass,
                Cmd,
                (UINT8) sizeof (Cmd),
-               EfiUsbDataIn,
+               Write ? EfiUsbDataOut : EfiUsbDataIn,
                Buffer,
                ByteSize,
                Timeout
-- 
2.16.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-23  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-23  2:26 [PATCH] MdeModulePkg/UsbMass: Fix USB key write failure Ruiyu Ni
2018-10-23  2:26 ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox