📄 hid.h
字号:
//
// File: hid.h
// Description: The declaration of class HidProcessing
//
// 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_H_
#define _HID_H_
#include "IrpList.h"
#include "RequestCount.h"
#include "hid_commands.h"
/////////////////////////////////////////////////////////////////////////////////////////
//Class HidProcessing
//
// HidProcessing is in charge of processing HID IOCTL requests. (Actual internal IOCTLs)
//
// The main entry point is processHidIoctl() which is called when an HID IRP is received.
// The class internally queues read report IRPs in a cancelable state. When the user
// of the class has a something to report to the system through HID, it fills in one
// of the several read report stuctures, and then passes it to submitReadReport().
//
// Since this driver does not use the HID class' polling option, the system sends it one
// read report IRP at a time, which the driver queues until it has data to put into it.
// Hid's completion routine for the read report IRP will send us a new read report IRP.
// In this way, there will always be one read report IRP queued while the device is running.
//
// It is required that we hold IRPs in a cancelable state in order for Device to receive
// IRP_MN_REMOVE_DEVICE. The HID class driver will not send us that IRP if we have any
// outstanding IRPs.
//
class HidProcessing
{
public:
//Main entry point for an HID internal device control IRP
NTSTATUS processHidIoctl(PIRP p_irp);
//submit an HID report to be completed
VOID submitReport(PVOID p_report, ULONG report_size);
//Cancel any requests we are holding
VOID cancelOutstandingRequests();
~HidProcessing();
protected:
//IRP processing routines
NTSTATUS getAttributes(PIRP p_irp);
NTSTATUS getReportDescriptor(PIRP p_irp);
NTSTATUS getHidDescriptor(PIRP p_irp);
NTSTATUS readReport(PIRP p_irp);
static VOID static_readReportCancel(
PDEVICE_OBJECT DeviceObject,
PIRP p_irp);
VOID cancelReadReport(PIRP p_irp);
private:
IrpList _irp_list;
RequestCount _request_count;
static HID_REPORT_DESCRIPTOR _s_report_descriptor[];
static USB_HID_DESCRIPTOR _s_hid_descriptor;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -