⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hid_commands.h

📁 pci 底层驱动
💻 H
字号:
//
//  File:   hid_commands.h
//  Description: The definitions of various HID usages, structures for
//    sending usage page reports, and flags for setting bits in the
//    usage page reports.
//
//  Created:  Wed. Jan 15, 2003
//
//
// Copyright and Disclaimer:
//
//   ---------------------------------------------------------------
//   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
//   EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//   IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//   PARTICULAR PURPOSE.
//
//   IN NO EVENT SHALL CONEXANT BE LIABLE TO ANY PARTY FOR DIRECT,
//   INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
//   INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
//   AND ITS DOCUMENTATION, EVEN IF CONEXANT HAS BEEN ADVISED OF THE
//   POSSIBILITY OF SUCH DAMAGE.
//
//   Copyright (c) 2000-2001 Conexant Systems, Inc.
//
//   All Rights Reserved.
//   ---------------------------------------------------------------
//
// Module Revision Id:
//
//

#ifndef _HID_COMMANDS_H_
#define _HID_COMMANDS_H_

#include <PSHPACK1.H>

//This is the structure to return for IOCTL_HID_GET_DEVICE_DESCRIPTOR
typedef struct _USB_HID_DESCRIPTOR
{
    UCHAR   bLength;
    UCHAR   bDescriptorType;
    USHORT  bcdHID;
    UCHAR   bCountry;
    UCHAR   bNumDescriptors;
    UCHAR   bReportType;
    USHORT  wReportLength;
} USB_HID_DESCRIPTOR, * PUSB_HID_DESCRIPTOR;

//The report descriptor is just an array of bytes
typedef UCHAR HID_REPORT_DESCRIPTOR, *PHID_REPORT_DESCRIPTOR;

#include <POPPACK.H>

//Report ID's.  These go in the first byte of each report.  Note that
// we are not allowed to use an ID with a value of 0.
#define REPORT_ID_KEYBOARD  0x01
#define REPORT_ID_CONSUMER  0x02
#define REPORT_ID_FFBC      0x03

//Report structure for keyboard reports
typedef struct _KEYBOARD_USAGE_PAGE_REPORT
{
    UCHAR report_id; //Set to REPORT_ID_KEYBOARD
    UCHAR modifier;  //Specifies rather shift or ctrl was pressed
    UCHAR reserved;
    UCHAR keystroke[6];
}KEYBOARD_USAGE_PAGE_REPORT, *PKEYBOARD_USAGE_PAGE_REPORT;

//Report structure for consumer reports
typedef struct _CONSUMER_USAGE_PAGE_REPORT
{
    UCHAR report_id;    //Set to REPORT_ID_CONSUMER
    UCHAR volume;       //One or more of CONSUMER_FLAG_VOLUME_XXX
    UCHAR channel;      //One or more of CONSUMER_FLAG_CHANNEL_XXX
    UCHAR pvr;          //One or more of CONSUMER_FLAG_PVR_XXX
}CONSUMER_USAGE_PAGE_REPORT, *PCONSUMER_USAGE_PAGE_REPORT;


/////////////////////////////////////////////////////////////////////////////////////////
//The following flags set various bits in the members of the 
// CONSUMER_USAGE_PAGE_REPORT

//Volume flags for the consumer report
#define CONSUMER_FLAG_VOLUME_UP     0x01
#define CONSUMER_FLAG_VOLUME_DOWN   0x02
#define CONSUMER_FLAG_VOLUME_MUTE   0x04

//Channel flags for the consumer report
#define CONSUMER_FLAG_CHANNEL_UP     0x01
#define CONSUMER_FLAG_CHANNEL_DOWN   0x02

//PVR flags for the consumer report
#define CONSUMER_FLAG_PVR_PLAY           0x01
#define CONSUMER_FLAG_PVR_STOP           0x02
#define CONSUMER_FLAG_PVR_PAUSE          0x04
#define CONSUMER_FLAG_PVR_RECORD         0x08
#define CONSUMER_FLAG_PVR_FAST_FORWARD   0x10
#define CONSUMER_FLAG_PVR_REWIND         0x20

//Replay and skip should also be in this group

/////////////////////////////////////////////////////////////////////////////////////////
//HID report descriptor definitions

//The following flags can be OR'ed together to define the data format of an input item.
// in the HID report descriptor

//Bit 0
#define ITEM_DATA           0x0     //Modifiable device data  
#define ITEM_CONSTANT       0x1     //Read only data

//Bit 1
#define ITEM_ARRAY          0x0     //Array of data fields
#define ITEM_VARIABLE       0x2     //Single data field

//Bit 2
#define ITEM_ABSOLUTE       0x0     //Data is absolute
#define ITEM_RELATIVE       0x4     //Data is relative to the last data provided

/////////////////////////////////////////////////////////////////////////////////////////
//Consumer control page usages taken from the USB HID usage table document
#define HID_USAGE_CONSUMER_CONTROL      ((USAGE) 0x01)

//Volume
#define HID_USAGE_CONSUMER_VOLUME_UP    ((USAGE) 0xE9)
#define HID_USAGE_CONSUMER_VOLUME_DOWN  ((USAGE) 0xEA)
#define HID_USAGE_CONSUMER_MUTE         ((USAGE) 0xE2)

//Channel
#define HID_USAGE_CONSUMER_CHANNEL_UP    ((USAGE) 0x9C)
#define HID_USAGE_CONSUMER_CHANNEL_DOWN  ((USAGE) 0x9D)

//PVR
#define HID_USAGE_CONSUMER_PLAY         ((USAGE) 0xB0)
#define HID_USAGE_CONSUMER_STOP         ((USAGE) 0xB7)
#define HID_USAGE_CONSUMER_PAUSE        ((USAGE) 0xB1)
#define HID_USAGE_CONSUMER_RECORD       ((USAGE) 0xB2)
#define HID_USAGE_CONSUMER_FAST_FORWARD ((USAGE) 0xB3)
#define HID_USAGE_CONSUMER_REWIND       ((USAGE) 0xB4)

/////////////////////////////////////////////////////////////////////////////////////////
//product and vender ID for our device
#define HIDMINI_PID              0xFEED
#define HIDMINI_VID              0xBEEF
#define HIDMINI_VERSION          0x0101


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -