mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
7f932291b5
commit
11ceade4ba
|
@ -170,6 +170,7 @@ typedef enum {
|
|||
USB_DESC_TYPE_INTERFACE = 0x04,
|
||||
USB_DESC_TYPE_ENDPOINT = 0x05,
|
||||
USB_DESC_TYPE_HID = 0x21,
|
||||
USB_DESC_TYPE_REPORT = 0x22,
|
||||
|
||||
//
|
||||
// Features to be cleared by CLEAR_FEATURE requests
|
||||
|
@ -198,6 +199,17 @@ typedef enum {
|
|||
// HID constants definition, see HID rev1.0
|
||||
//
|
||||
|
||||
//
|
||||
// HID standard GET_DESCRIPTOR request.
|
||||
//
|
||||
#define USB_HID_GET_DESCRIPTOR_REQ_TYPE 0x81
|
||||
|
||||
//
|
||||
// HID specific requests.
|
||||
//
|
||||
#define USB_HID_CLASS_GET_REQ_TYPE 0xa1
|
||||
#define USB_HID_CLASS_SET_REQ_TYPE 0x21
|
||||
|
||||
//
|
||||
// HID report item format
|
||||
//
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The library provides the USB descritor, interface and protocol
|
||||
operations.
|
||||
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
|
||||
|
@ -13,7 +13,6 @@
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include <UefiUsbLibInternal.h>
|
||||
|
|
Loading…
Reference in New Issue