summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiUsbLib
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/UefiUsbLib')
-rw-r--r--MdePkg/Library/UefiUsbLib/Hid.c133
-rw-r--r--MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h1
-rw-r--r--MdePkg/Library/UefiUsbLib/UsbDxeLib.c253
3 files changed, 182 insertions, 205 deletions
diff --git a/MdePkg/Library/UefiUsbLib/Hid.c b/MdePkg/Library/UefiUsbLib/Hid.c
index 1d65552719..a03922cf1f 100644
--- a/MdePkg/Library/UefiUsbLib/Hid.c
+++ b/MdePkg/Library/UefiUsbLib/Hid.c
@@ -45,23 +45,23 @@
EFI_STATUS
EFIAPI
UsbGetHidDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
)
{
UINT32 Status;
EFI_STATUS Result;
EFI_USB_DEVICE_REQUEST Request;
- ASSERT(UsbIo != NULL);
- ASSERT(HidDescriptor != NULL);
+ ASSERT (UsbIo != NULL);
+ ASSERT (HidDescriptor != NULL);
Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
Request.Request = USB_REQ_GET_DESCRIPTOR;
- Request.Value = (UINT16) (USB_DESC_TYPE_HID << 8);
+ Request.Value = (UINT16)(USB_DESC_TYPE_HID << 8);
Request.Index = Interface;
- Request.Length = (UINT16) sizeof (EFI_USB_HID_DESCRIPTOR);
+ Request.Length = (UINT16)sizeof (EFI_USB_HID_DESCRIPTOR);
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -74,7 +74,6 @@ UsbGetHidDescriptor (
);
return Result;
-
}
/**
@@ -101,10 +100,10 @@ UsbGetHidDescriptor (
EFI_STATUS
EFIAPI
UsbGetReportDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT16 DescriptorLength,
- OUT UINT8 *DescriptorBuffer
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT16 DescriptorLength,
+ OUT UINT8 *DescriptorBuffer
)
{
UINT32 Status;
@@ -119,7 +118,7 @@ UsbGetReportDescriptor (
//
Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
Request.Request = USB_REQ_GET_DESCRIPTOR;
- Request.Value = (UINT16) (USB_DESC_TYPE_REPORT << 8);
+ Request.Value = (UINT16)(USB_DESC_TYPE_REPORT << 8);
Request.Index = Interface;
Request.Length = DescriptorLength;
@@ -134,7 +133,6 @@ UsbGetReportDescriptor (
);
return Result;
-
}
/**
@@ -157,9 +155,9 @@ UsbGetReportDescriptor (
EFI_STATUS
EFIAPI
UsbGetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- OUT UINT8 *Protocol
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ OUT UINT8 *Protocol
)
{
UINT32 Status;
@@ -173,10 +171,10 @@ UsbGetProtocolRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
- Request.Value = 0;
- Request.Index = Interface;
- Request.Length = 1;
+ Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
+ Request.Value = 0;
+ Request.Index = Interface;
+ Request.Length = 1;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -191,8 +189,6 @@ UsbGetProtocolRequest (
return Result;
}
-
-
/**
Set the HID protocol of the specified USB HID interface.
@@ -212,9 +208,9 @@ UsbGetProtocolRequest (
EFI_STATUS
EFIAPI
UsbSetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 Protocol
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 Protocol
)
{
UINT32 Status;
@@ -227,10 +223,10 @@ UsbSetProtocolRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
- Request.Value = Protocol;
- Request.Index = Interface;
- Request.Length = 0;
+ Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
+ Request.Value = Protocol;
+ Request.Index = Interface;
+ Request.Length = 0;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -244,7 +240,6 @@ UsbSetProtocolRequest (
return Result;
}
-
/**
Set the idle rate of the specified USB HID report.
@@ -265,10 +260,10 @@ UsbSetProtocolRequest (
EFI_STATUS
EFIAPI
UsbSetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 Duration
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 Duration
)
{
UINT32 Status;
@@ -280,10 +275,10 @@ UsbSetIdleRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_IDLE_REQUEST;
- Request.Value = (UINT16) ((Duration << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = 0;
+ Request.Request = EFI_USB_SET_IDLE_REQUEST;
+ Request.Value = (UINT16)((Duration << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = 0;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -297,7 +292,6 @@ UsbSetIdleRequest (
return Result;
}
-
/**
Get the idle rate of the specified USB HID report.
@@ -319,10 +313,10 @@ UsbSetIdleRequest (
EFI_STATUS
EFIAPI
UsbGetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- OUT UINT8 *Duration
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ OUT UINT8 *Duration
)
{
UINT32 Status;
@@ -335,10 +329,10 @@ UsbGetIdleRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_IDLE_REQUEST;
- Request.Value = ReportId;
- Request.Index = Interface;
- Request.Length = 1;
+ Request.Request = EFI_USB_GET_IDLE_REQUEST;
+ Request.Value = ReportId;
+ Request.Index = Interface;
+ Request.Length = 1;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -353,8 +347,6 @@ UsbGetIdleRequest (
return Result;
}
-
-
/**
Set the report descriptor of the specified USB HID interface.
@@ -379,12 +371,12 @@ UsbGetIdleRequest (
EFI_STATUS
EFIAPI
UsbSetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 ReportType,
+ IN UINT16 ReportLen,
+ IN UINT8 *Report
)
{
UINT32 Status;
@@ -398,10 +390,10 @@ UsbSetReportRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
+ Request.Request = EFI_USB_SET_REPORT_REQUEST;
+ Request.Value = (UINT16)((ReportType << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = ReportLen;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -416,7 +408,6 @@ UsbSetReportRequest (
return Result;
}
-
/**
Get the report descriptor of the specified USB HID interface.
@@ -444,12 +435,12 @@ UsbSetReportRequest (
EFI_STATUS
EFIAPI
UsbGetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- OUT UINT8 *Report
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 ReportType,
+ IN UINT16 ReportLen,
+ OUT UINT8 *Report
)
{
UINT32 Status;
@@ -463,10 +454,10 @@ UsbGetReportRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
+ Request.Request = EFI_USB_GET_REPORT_REQUEST;
+ Request.Value = (UINT16)((ReportType << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = ReportLen;
Result = UsbIo->UsbControlTransfer (
UsbIo,
diff --git a/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h b/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
index 5909d96e9a..185fc6d86e 100644
--- a/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
+++ b/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
@@ -20,5 +20,4 @@
#include <IndustryStandard/Usb.h>
-
#endif
diff --git a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
index e75df8d044..53b90984f7 100644
--- a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
+++ b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
@@ -10,7 +10,6 @@
#include "UefiUsbLibInternal.h"
-
/**
Get the descriptor of the specified USB device.
@@ -40,12 +39,12 @@
EFI_STATUS
EFIAPI
UsbGetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ OUT VOID *Descriptor,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -56,11 +55,11 @@ UsbGetDescriptor (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
+ DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_DESCRIPTOR;
+ DevReq.Value = Value;
+ DevReq.Index = Index;
+ DevReq.Length = DescriptorLength;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -73,7 +72,6 @@ UsbGetDescriptor (
);
}
-
/**
Set the descriptor of the specified USB device.
@@ -100,12 +98,12 @@ UsbGetDescriptor (
EFI_STATUS
EFIAPI
UsbSetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- IN VOID *Descriptor,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ IN VOID *Descriptor,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -116,11 +114,11 @@ UsbSetDescriptor (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
+ DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_DESCRIPTOR;
+ DevReq.Value = Value;
+ DevReq.Index = Index;
+ DevReq.Length = DescriptorLength;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -133,7 +131,6 @@ UsbSetDescriptor (
);
}
-
/**
Get the interface setting of the specified USB device.
@@ -158,10 +155,10 @@ UsbSetDescriptor (
EFI_STATUS
EFIAPI
UsbGetInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Interface,
- OUT UINT16 *AlternateSetting,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Interface,
+ OUT UINT16 *AlternateSetting,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -174,10 +171,10 @@ UsbGetInterface (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_INTERFACE;
- DevReq.Index = Interface;
- DevReq.Length = 1;
+ DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_INTERFACE;
+ DevReq.Index = Interface;
+ DevReq.Length = 1;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -190,7 +187,6 @@ UsbGetInterface (
);
}
-
/**
Set the interface setting of the specified USB device.
@@ -214,10 +210,10 @@ UsbGetInterface (
EFI_STATUS
EFIAPI
UsbSetInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Interface,
- IN UINT16 AlternateSetting,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Interface,
+ IN UINT16 AlternateSetting,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -227,10 +223,10 @@ UsbSetInterface (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_INTERFACE;
- DevReq.Value = AlternateSetting;
- DevReq.Index = Interface;
+ DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_INTERFACE;
+ DevReq.Value = AlternateSetting;
+ DevReq.Index = Interface;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -243,7 +239,6 @@ UsbSetInterface (
);
}
-
/**
Get the device configuration.
@@ -267,9 +262,9 @@ UsbSetInterface (
EFI_STATUS
EFIAPI
UsbGetConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT16 *ConfigurationValue,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ OUT UINT16 *ConfigurationValue,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -282,9 +277,9 @@ UsbGetConfiguration (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_CONFIG;
- DevReq.Length = 1;
+ DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_CONFIG;
+ DevReq.Length = 1;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -297,7 +292,6 @@ UsbGetConfiguration (
);
}
-
/**
Set the device configuration.
@@ -320,9 +314,9 @@ UsbGetConfiguration (
EFI_STATUS
EFIAPI
UsbSetConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 ConfigurationValue,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 ConfigurationValue,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -332,9 +326,9 @@ UsbSetConfiguration (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_CONFIG;
- DevReq.Value = ConfigurationValue;
+ DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_CONFIG;
+ DevReq.Value = ConfigurationValue;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -347,7 +341,6 @@ UsbSetConfiguration (
);
}
-
/**
Set the specified feature of the specified device.
@@ -374,11 +367,11 @@ UsbSetConfiguration (
EFI_STATUS
EFIAPI
UsbSetFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -389,29 +382,28 @@ UsbSetFeature (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_SET_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
+ DevReq.Request = USB_REQ_SET_FEATURE;
+ DevReq.Value = Value;
+ DevReq.Index = Target;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -424,7 +416,6 @@ UsbSetFeature (
);
}
-
/**
Clear the specified feature of the specified device.
@@ -451,11 +442,11 @@ UsbSetFeature (
EFI_STATUS
EFIAPI
UsbClearFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -463,33 +454,31 @@ UsbClearFeature (
ASSERT (UsbIo != NULL);
ASSERT (Status != NULL);
-
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_CLEAR_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
+ DevReq.Request = USB_REQ_CLEAR_FEATURE;
+ DevReq.Value = Value;
+ DevReq.Index = Target;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -502,7 +491,6 @@ UsbClearFeature (
);
}
-
/**
Get the status of the specified device.
@@ -530,11 +518,11 @@ UsbClearFeature (
EFI_STATUS
EFIAPI
UsbGetStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Target,
- OUT UINT16 *DeviceStatus,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Target,
+ OUT UINT16 *DeviceStatus,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -546,29 +534,29 @@ UsbGetStatus (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_GET_STATUS;
- DevReq.Value = 0;
- DevReq.Index = Target;
- DevReq.Length = 2;
+ DevReq.Request = USB_REQ_GET_STATUS;
+ DevReq.Value = 0;
+ DevReq.Index = Target;
+ DevReq.Length = 2;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -581,7 +569,6 @@ UsbGetStatus (
);
}
-
/**
Clear halt feature of the specified usb endpoint.
@@ -606,9 +593,9 @@ UsbGetStatus (
EFI_STATUS
EFIAPI
UsbClearEndpointHalt (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Endpoint,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Endpoint,
+ OUT UINT32 *Status
)
{
EFI_STATUS Result;
@@ -654,12 +641,12 @@ UsbClearEndpointHalt (
}
Result = UsbClearFeature (
- UsbIo,
- USB_TARGET_ENDPOINT,
- USB_FEATURE_ENDPOINT_HALT,
- EndpointDescriptor.EndpointAddress,
- Status
- );
+ UsbIo,
+ USB_TARGET_ENDPOINT,
+ USB_FEATURE_ENDPOINT_HALT,
+ EndpointDescriptor.EndpointAddress,
+ Status
+ );
return Result;
}