summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiUsbLib/Hid.c
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-08 04:59:00 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-08 04:59:00 +0000
commit11ceade4ba5ea80bfa660ea2c464c50593b9a993 (patch)
treeea9f95b31e40d673d3374ab32e22f6beeaa87fce /MdePkg/Library/UefiUsbLib/Hid.c
parent7f932291b5070e44891d5b9128b40ca588c20472 (diff)
downloadedk2-11ceade4ba5ea80bfa660ea2c464c50593b9a993.tar.gz
edk2-11ceade4ba5ea80bfa660ea2c464c50593b9a993.tar.bz2
edk2-11ceade4ba5ea80bfa660ea2c464c50593b9a993.zip
Add Usb Hid class request type into IndustryStandard/Usb.h, and replace the hard value in UefiUsbLib by them.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5834 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiUsbLib/Hid.c')
-rw-r--r--MdePkg/Library/UefiUsbLib/Hid.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/MdePkg/Library/UefiUsbLib/Hid.c b/MdePkg/Library/UefiUsbLib/Hid.c
index 3a62d523f1..ad2c158401 100644
--- a/MdePkg/Library/UefiUsbLib/Hid.c
+++ b/MdePkg/Library/UefiUsbLib/Hid.c
@@ -1,6 +1,7 @@
/** @file
- The library provides USB descriptor, protocol operations.
+ The library provides USB HID Class standard and specific requests defined
+ in USB HID Firmware Specification 7 section : Requests.
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -15,6 +16,18 @@
#include <UefiUsbLibInternal.h>
+//
+// Hid RequestType Bits specifying characteristics of request.
+// Valid values are 10100001b (0xa1) or 00100001b (0x21).
+// The following description:
+// 7 Data transfer direction
+// 0 = Host to device
+// 1 = Device to host
+// 6..5 Type
+// 1 = Class
+// 4..0 Recipient
+// 1 = Interface
+//
/**
Get Hid Descriptor.
@@ -44,9 +57,9 @@ UsbGetHidDescriptor (
return EFI_INVALID_PARAMETER;
}
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x21 << 8);
+ Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
+ Request.Request = USB_REQ_GET_DESCRIPTOR;
+ Request.Value = (UINT16) (USB_DESC_TYPE_HID << 8);
Request.Index = InterfaceNum;
Request.Length = sizeof (EFI_USB_HID_DESCRIPTOR);
@@ -96,9 +109,9 @@ UsbGetReportDescriptor (
//
// Fill Device request packet
//
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x22 << 8);
+ Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
+ Request.Request = USB_REQ_GET_DESCRIPTOR;
+ Request.Value = (UINT16) (USB_DESC_TYPE_REPORT << 8);
Request.Index = InterfaceNum;
Request.Length = DescriptorSize;
@@ -145,10 +158,7 @@ UsbGetProtocolRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
+ Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
Request.Value = 0;
Request.Index = Interface;
@@ -199,10 +209,7 @@ UsbSetProtocolRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
+ Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
Request.Value = Protocol;
Request.Index = Interface;
@@ -252,10 +259,7 @@ UsbSetIdleRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
+ Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
Request.Request = EFI_USB_SET_IDLE_REQUEST;
Request.Value = (UINT16) ((Duration << 8) | ReportId);
Request.Index = Interface;
@@ -305,10 +309,7 @@ UsbGetIdleRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
+ Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
Request.Request = EFI_USB_GET_IDLE_REQUEST;
Request.Value = ReportId;
Request.Index = Interface;
@@ -364,10 +365,7 @@ UsbSetReportRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
+ Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
Request.Request = EFI_USB_SET_REPORT_REQUEST;
Request.Value = (UINT16) ((ReportType << 8) | ReportId);
Request.Index = Interface;
@@ -422,10 +420,7 @@ UsbGetReportRequest (
//
// Fill Device request packet
//
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
+ Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
Request.Request = EFI_USB_GET_REPORT_REQUEST;
Request.Value = (UINT16) ((ReportType << 8) | ReportId);
Request.Index = Interface;