From a58a421c3629e5f28b4a6887c28da4ee6976cd61 Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Tue, 23 Oct 2018 10:26:01 +0800 Subject: [PATCH] MdeModulePkg/UsbMass: Fix USB key write failure 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 Reviewed-by: Star Zeng --- 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