X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FUefiUsbLib%2FUsbDxeLib.c;h=b22a8294a4904b016ebd0ac6d072bb3a18cf8fbe;hp=a15ef6ebefc5db582c8a19576cbf811581240a6b;hb=2fc59a003ed9104f9feebe0e418f2a04a50f3284;hpb=d5954c618f10c9f75a4d125985550e694c7a3f22 diff --git a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c index a15ef6ebef..b22a8294a4 100644 --- a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c +++ b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c @@ -3,12 +3,12 @@ The library provides the USB Standard Device Requests defined in Usb specification 9.4 section. - Copyright (c) 2004 - 2007, Intel Corporation All rights - reserved. This program and the accompanying materials are + Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @@ -37,7 +37,7 @@ @retval EFI_SUCCESS The request executed successfully. @retval EFI_OUT_OF_RESOURCES The request could not be completed because the - buffer specifed by DescriptorLength and Descriptor + buffer specified by DescriptorLength and Descriptor is not large enough to hold the result of the request. @retval EFI_TIMEOUT A timeout occurred executing the request. @retval EFI_DEVICE_ERROR The request failed due to a device error. The transfer @@ -73,7 +73,7 @@ UsbGetDescriptor ( UsbIo, &DevReq, EfiUsbDataIn, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), Descriptor, DescriptorLength, Status @@ -133,7 +133,7 @@ UsbSetDescriptor ( UsbIo, &DevReq, EfiUsbDataOut, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), Descriptor, DescriptorLength, Status @@ -167,7 +167,7 @@ EFIAPI UsbGetInterface ( IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Interface, - OUT UINT8 *AlternateSetting, + OUT UINT16 *AlternateSetting, OUT UINT32 *Status ) { @@ -177,6 +177,8 @@ UsbGetInterface ( ASSERT (AlternateSetting != NULL); ASSERT (Status != NULL); + *AlternateSetting = 0; + ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE; @@ -188,7 +190,7 @@ UsbGetInterface ( UsbIo, &DevReq, EfiUsbDataIn, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), AlternateSetting, 1, Status @@ -241,7 +243,7 @@ UsbSetInterface ( UsbIo, &DevReq, EfiUsbNoData, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), NULL, 0, Status @@ -273,7 +275,7 @@ EFI_STATUS EFIAPI UsbGetConfiguration ( IN EFI_USB_IO_PROTOCOL *UsbIo, - OUT UINT8 *ConfigurationValue, + OUT UINT16 *ConfigurationValue, OUT UINT32 *Status ) { @@ -283,6 +285,8 @@ UsbGetConfiguration ( ASSERT (ConfigurationValue != NULL); ASSERT (Status != NULL); + *ConfigurationValue = 0; + ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE; @@ -293,7 +297,7 @@ UsbGetConfiguration ( UsbIo, &DevReq, EfiUsbDataIn, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), ConfigurationValue, 1, Status @@ -343,7 +347,7 @@ UsbSetConfiguration ( UsbIo, &DevReq, EfiUsbNoData, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), NULL, 0, Status @@ -404,6 +408,9 @@ UsbSetFeature ( case USB_TARGET_ENDPOINT: DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E; break; + + default: + break; } // // Fill device request, see USB1.1 spec @@ -417,7 +424,7 @@ UsbSetFeature ( UsbIo, &DevReq, EfiUsbNoData, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), NULL, 0, Status @@ -479,6 +486,9 @@ UsbClearFeature ( case USB_TARGET_ENDPOINT: DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E; break; + + default: + break; } // // Fill device request, see USB1.1 spec @@ -492,7 +502,7 @@ UsbClearFeature ( UsbIo, &DevReq, EfiUsbNoData, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), NULL, 0, Status @@ -555,6 +565,9 @@ UsbGetStatus ( case USB_TARGET_ENDPOINT: DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E; break; + + default: + break; } // // Fill device request, see USB1.1 spec @@ -568,7 +581,7 @@ UsbGetStatus ( UsbIo, &DevReq, EfiUsbDataIn, - TIMEOUT_VALUE, + PcdGet32 (PcdUsbTransferTimeoutValue), DeviceStatus, 2, Status @@ -581,7 +594,7 @@ UsbGetStatus ( Retrieve the USB endpoint descriptor specified by UsbIo and EndPoint. If the USB endpoint descriptor can not be retrieved, then return EFI_NOT_FOUND. - If the endpoint descriptor is found, then clear the halt fature of this USB endpoint. + If the endpoint descriptor is found, then clear the halt feature of this USB endpoint. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If Status is NULL, then ASSERT().