MdeModulePkg/UsbMass: Fix USB key write failure
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 23 Oct 2018 02:26:01 +0000 (10:26 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 24 Oct 2018 04:00:19 +0000 (12:00 +0800)
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>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c

index c35c7bd..69e2252 100644 (file)
@@ -861,7 +861,7 @@ UsbBootReadWriteBlocks (
                UsbMass,\r
                &Cmd,\r
                (UINT8) sizeof (USB_BOOT_READ_WRITE_10_CMD),\r
-               EfiUsbDataIn,\r
+               Write ? EfiUsbDataOut : EfiUsbDataIn,\r
                Buffer,\r
                ByteSize,\r
                Timeout\r
@@ -941,7 +941,7 @@ UsbBootReadWriteBlocks16 (
                UsbMass,\r
                Cmd,\r
                (UINT8) sizeof (Cmd),\r
-               EfiUsbDataIn,\r
+               Write ? EfiUsbDataOut : EfiUsbDataIn,\r
                Buffer,\r
                ByteSize,\r
                Timeout\r