Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hidclass.h Source File

hidclass.h

00001 /*
00002  * hidclass.h
00003  *
00004  * HID class driver interface
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __HIDCLASS_H
00024 #define __HIDCLASS_H
00025 
00026 #if __GNUC__ >=3
00027 #pragma GCC system_header
00028 #endif
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "ntddk.h"
00035 #include "hidpi.h"
00036 
00037 #define HID_REVISION                      0x00000001
00038 
00039 DEFINE_GUID (GUID_DEVINTERFACE_HID, \
00040   0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
00041 DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \
00042   0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81);
00043 DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \
00044   0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b);
00045 
00046 #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
00047 
00048 #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
00049 
00050 
00051 #define HID_CTL_CODE(id) \
00052   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
00053 #define HID_BUFFER_CTL_CODE(id) \
00054   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
00055 #define HID_IN_CTL_CODE(id) \
00056   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
00057 #define HID_OUT_CTL_CODE(id) \
00058   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
00059 
00060 
00061 #define IOCTL_GET_PHYSICAL_DESCRIPTOR         HID_OUT_CTL_CODE(102)
00062 #define IOCTL_HID_FLUSH_QUEUE                 HID_CTL_CODE(101)
00063 #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR   HID_CTL_CODE(100)
00064 #define IOCTL_HID_GET_COLLECTION_INFORMATION  HID_BUFFER_CTL_CODE(106)
00065 #define IOCTL_HID_GET_FEATURE                 HID_OUT_CTL_CODE(100)
00066 #define IOCTL_HID_GET_HARDWARE_ID             HID_OUT_CTL_CODE(103)
00067 #define IOCTL_HID_GET_INDEXED_STRING          HID_OUT_CTL_CODE(120)
00068 #define IOCTL_HID_GET_INPUT_REPORT            HID_OUT_CTL_CODE(104)
00069 #define IOCTL_HID_GET_MANUFACTURER_STRING     HID_OUT_CTL_CODE(110)
00070 #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS    HID_BUFFER_CTL_CODE(104)
00071 #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC     HID_BUFFER_CTL_CODE(102)
00072 #define IOCTL_HID_GET_PRODUCT_STRING          HID_OUT_CTL_CODE(111)
00073 #define IOCTL_HID_GET_SERIALNUMBER_STRING     HID_OUT_CTL_CODE(112)
00074 #define IOCTL_HID_SET_FEATURE                 HID_IN_CTL_CODE(100)
00075 #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS    HID_BUFFER_CTL_CODE(105)
00076 #define IOCTL_HID_SET_OUTPUT_REPORT           HID_IN_CTL_CODE(101)
00077 #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC     HID_BUFFER_CTL_CODE(103)
00078 
00079 #define IOCTL_HID_GET_DRIVER_CONFIG           HID_BUFFER_CTL_CODE(100)
00080 #define IOCTL_HID_SET_DRIVER_CONFIG           HID_BUFFER_CTL_CODE(101)
00081 #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR     HID_OUT_CTL_CODE(121)
00082 
00083 
00084 enum DeviceObjectState {
00085   DeviceObjectStarted = 0,
00086   DeviceObjectStopped,
00087   DeviceObjectRemoved
00088 };
00089 
00090 typedef VOID DDKAPI (*PHID_STATUS_CHANGE)(
00091   PVOID  Context,
00092   enum DeviceObjectState  State);
00093 
00094 typedef NTSTATUS DDKAPI (*PHIDP_GETCAPS)(
00095   /*IN*/ PHIDP_PREPARSED_DATA  PreparsedData,
00096   /*OUT*/ PHIDP_CAPS  Capabilities);
00097 
00098 typedef struct _HID_COLLECTION_INFORMATION {
00099   ULONG  DescriptorSize;
00100   BOOLEAN  Polled;
00101   UCHAR  Reserved1[1];
00102   USHORT  VendorID;
00103   USHORT  ProductID;
00104   USHORT  VersionNumber;
00105 } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
00106 
00107 typedef struct _HID_DRIVER_CONFIG {
00108   ULONG  Size;
00109   ULONG  RingBufferSize;
00110 } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
00111 
00112 typedef struct _HID_INTERFACE_HIDPARSE {
00113 #ifdef __cplusplus
00114   INTERFACE  i;
00115 #else
00116   /* GCC doesn't support including unnamed structs, so INTERFACE is
00117      expanded here */
00118   USHORT  Size;
00119   USHORT  Version;
00120   PVOID  Context;
00121   PINTERFACE_REFERENCE  InterfaceReference;
00122   PINTERFACE_DEREFERENCE  InterfaceDereference;
00123 #endif
00124   PHIDP_GETCAPS  HidpGetCaps;
00125 } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
00126 
00127 typedef struct _HID_INTERFACE_NOTIFY_PNP {
00128 #ifdef __cplusplus
00129   INTERFACE  i;
00130 #else
00131   /* GCC doesn't support including unnamed structs, so INTERFACE is
00132      expanded here */
00133   USHORT  Size;
00134   USHORT  Version;
00135   PVOID  Context;
00136   PINTERFACE_REFERENCE  InterfaceReference;
00137   PINTERFACE_DEREFERENCE  InterfaceDereference;
00138 #endif
00139   PHID_STATUS_CHANGE  StatusChangeFn;
00140   PVOID  CallbackContext;
00141 } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
00142 
00143 typedef struct _HID_XFER_PACKET {
00144   PUCHAR  reportBuffer;
00145   ULONG  reportBufferLen;
00146   UCHAR  reportId;
00147 } HID_XFER_PACKET, *PHID_XFER_PACKET;
00148 
00149 #ifdef __cplusplus
00150 }
00151 #endif
00152 
00153 #endif /* __HIDCLASS_H */