1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * hidclass.h 3*c2c66affSColin Finck * 4*c2c66affSColin Finck * HID class driver interface 5*c2c66affSColin Finck * 6*c2c66affSColin Finck * This file is part of the w32api package. 7*c2c66affSColin Finck * 8*c2c66affSColin Finck * Contributors: 9*c2c66affSColin Finck * Created by Casper S. Hornstrup <chorns@users.sourceforge.net> 10*c2c66affSColin Finck * 11*c2c66affSColin Finck * THIS SOFTWARE IS NOT COPYRIGHTED 12*c2c66affSColin Finck * 13*c2c66affSColin Finck * This source code is offered for use in the public domain. You may 14*c2c66affSColin Finck * use, modify or distribute it freely. 15*c2c66affSColin Finck * 16*c2c66affSColin Finck * This code is distributed in the hope that it will be useful but 17*c2c66affSColin Finck * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18*c2c66affSColin Finck * DISCLAIMED. This includes but is not limited to warranties of 19*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20*c2c66affSColin Finck * 21*c2c66affSColin Finck */ 22*c2c66affSColin Finck 23*c2c66affSColin Finck #ifndef __HIDCLASS_H 24*c2c66affSColin Finck #define __HIDCLASS_H 25*c2c66affSColin Finck 26*c2c66affSColin Finck #include "hidpi.h" 27*c2c66affSColin Finck 28*c2c66affSColin Finck #ifdef __cplusplus 29*c2c66affSColin Finck extern "C" { 30*c2c66affSColin Finck #endif 31*c2c66affSColin Finck 32*c2c66affSColin Finck #define HID_REVISION 0x00000001 33*c2c66affSColin Finck 34*c2c66affSColin Finck DEFINE_GUID (GUID_DEVINTERFACE_HID, \ 35*c2c66affSColin Finck 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30); 36*c2c66affSColin Finck DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \ 37*c2c66affSColin Finck 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81); 38*c2c66affSColin Finck DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \ 39*c2c66affSColin Finck 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b); 40*c2c66affSColin Finck 41*c2c66affSColin Finck #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID 42*c2c66affSColin Finck 43*c2c66affSColin Finck #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030" 44*c2c66affSColin Finck 45*c2c66affSColin Finck 46*c2c66affSColin Finck #define HID_CTL_CODE(id) \ 47*c2c66affSColin Finck CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS) 48*c2c66affSColin Finck #define HID_BUFFER_CTL_CODE(id) \ 49*c2c66affSColin Finck CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS) 50*c2c66affSColin Finck #define HID_IN_CTL_CODE(id) \ 51*c2c66affSColin Finck CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS) 52*c2c66affSColin Finck #define HID_OUT_CTL_CODE(id) \ 53*c2c66affSColin Finck CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS) 54*c2c66affSColin Finck 55*c2c66affSColin Finck 56*c2c66affSColin Finck #define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102) 57*c2c66affSColin Finck #define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101) 58*c2c66affSColin Finck #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100) 59*c2c66affSColin Finck #define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106) 60*c2c66affSColin Finck #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100) 61*c2c66affSColin Finck #define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103) 62*c2c66affSColin Finck #define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120) 63*c2c66affSColin Finck #define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104) 64*c2c66affSColin Finck #define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110) 65*c2c66affSColin Finck #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104) 66*c2c66affSColin Finck #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102) 67*c2c66affSColin Finck #define IOCTL_HID_GET_PRODUCT_STRING HID_OUT_CTL_CODE(111) 68*c2c66affSColin Finck #define IOCTL_HID_GET_SERIALNUMBER_STRING HID_OUT_CTL_CODE(112) 69*c2c66affSColin Finck #define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100) 70*c2c66affSColin Finck #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105) 71*c2c66affSColin Finck #define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101) 72*c2c66affSColin Finck #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103) 73*c2c66affSColin Finck 74*c2c66affSColin Finck #define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100) 75*c2c66affSColin Finck #define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101) 76*c2c66affSColin Finck #define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120) 77*c2c66affSColin Finck #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121) 78*c2c66affSColin Finck 79*c2c66affSColin Finck typedef enum _HID_STRING_TYPE 80*c2c66affSColin Finck { 81*c2c66affSColin Finck HID_STRING_INDEXED = 0, 82*c2c66affSColin Finck HID_STRING_ID_IMANUFACTURER, 83*c2c66affSColin Finck HID_STRING_ID_IPRODUCT, 84*c2c66affSColin Finck HID_STRING_ID_ISERIALNUMBER, 85*c2c66affSColin Finck HID_STRING_MAX 86*c2c66affSColin Finck } HID_STRING_TYPE; 87*c2c66affSColin Finck 88*c2c66affSColin Finck enum DeviceObjectState { 89*c2c66affSColin Finck DeviceObjectStarted = 0, 90*c2c66affSColin Finck DeviceObjectStopped, 91*c2c66affSColin Finck DeviceObjectRemoved 92*c2c66affSColin Finck }; 93*c2c66affSColin Finck 94*c2c66affSColin Finck typedef VOID 95*c2c66affSColin Finck (NTAPI *PHID_STATUS_CHANGE)( 96*c2c66affSColin Finck _In_ PVOID Context, 97*c2c66affSColin Finck _In_ enum DeviceObjectState State); 98*c2c66affSColin Finck 99*c2c66affSColin Finck _Must_inspect_result_ 100*c2c66affSColin Finck typedef NTSTATUS 101*c2c66affSColin Finck (NTAPI *PHIDP_GETCAPS)( 102*c2c66affSColin Finck _In_ PHIDP_PREPARSED_DATA PreparsedData, 103*c2c66affSColin Finck _Out_ PHIDP_CAPS Capabilities); 104*c2c66affSColin Finck 105*c2c66affSColin Finck typedef struct _HID_COLLECTION_INFORMATION { 106*c2c66affSColin Finck ULONG DescriptorSize; 107*c2c66affSColin Finck BOOLEAN Polled; 108*c2c66affSColin Finck UCHAR Reserved1[1]; 109*c2c66affSColin Finck USHORT VendorID; 110*c2c66affSColin Finck USHORT ProductID; 111*c2c66affSColin Finck USHORT VersionNumber; 112*c2c66affSColin Finck } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION; 113*c2c66affSColin Finck 114*c2c66affSColin Finck typedef struct _HID_DRIVER_CONFIG { 115*c2c66affSColin Finck ULONG Size; 116*c2c66affSColin Finck ULONG RingBufferSize; 117*c2c66affSColin Finck } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG; 118*c2c66affSColin Finck 119*c2c66affSColin Finck typedef struct _HID_INTERFACE_HIDPARSE { 120*c2c66affSColin Finck #ifdef __cplusplus 121*c2c66affSColin Finck INTERFACE i; 122*c2c66affSColin Finck #else 123*c2c66affSColin Finck /* GCC doesn't support including unnamed structs, so INTERFACE is 124*c2c66affSColin Finck expanded here */ 125*c2c66affSColin Finck USHORT Size; 126*c2c66affSColin Finck USHORT Version; 127*c2c66affSColin Finck PVOID Context; 128*c2c66affSColin Finck PINTERFACE_REFERENCE InterfaceReference; 129*c2c66affSColin Finck PINTERFACE_DEREFERENCE InterfaceDereference; 130*c2c66affSColin Finck #endif 131*c2c66affSColin Finck PHIDP_GETCAPS HidpGetCaps; 132*c2c66affSColin Finck } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE; 133*c2c66affSColin Finck 134*c2c66affSColin Finck typedef struct _HID_INTERFACE_NOTIFY_PNP { 135*c2c66affSColin Finck #ifdef __cplusplus 136*c2c66affSColin Finck INTERFACE i; 137*c2c66affSColin Finck #else 138*c2c66affSColin Finck /* GCC doesn't support including unnamed structs, so INTERFACE is 139*c2c66affSColin Finck expanded here */ 140*c2c66affSColin Finck USHORT Size; 141*c2c66affSColin Finck USHORT Version; 142*c2c66affSColin Finck PVOID Context; 143*c2c66affSColin Finck PINTERFACE_REFERENCE InterfaceReference; 144*c2c66affSColin Finck PINTERFACE_DEREFERENCE InterfaceDereference; 145*c2c66affSColin Finck #endif 146*c2c66affSColin Finck PHID_STATUS_CHANGE StatusChangeFn; 147*c2c66affSColin Finck PVOID CallbackContext; 148*c2c66affSColin Finck } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP; 149*c2c66affSColin Finck 150*c2c66affSColin Finck typedef struct _HID_XFER_PACKET { 151*c2c66affSColin Finck PUCHAR reportBuffer; 152*c2c66affSColin Finck ULONG reportBufferLen; 153*c2c66affSColin Finck UCHAR reportId; 154*c2c66affSColin Finck } HID_XFER_PACKET, *PHID_XFER_PACKET; 155*c2c66affSColin Finck 156*c2c66affSColin Finck #ifdef __cplusplus 157*c2c66affSColin Finck } 158*c2c66affSColin Finck #endif 159*c2c66affSColin Finck 160*c2c66affSColin Finck #endif /* __HIDCLASS_H */ 161