Repository navigation
Expand file tree
/
Copy pathHidDeclarations.cs
More file actions
126 lines (106 loc) · 5.79 KB
/
Copy pathHidDeclarations.cs
File metadata and controls
126 lines (106 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using Microsoft.Win32.SafeHandles;
using System;
using System.Runtime.InteropServices;
namespace SMDProfiler
{
internal sealed partial class Hid
{
// API declarations for HID communications.
// from hidpi.h
// Typedef enum defines a set of integer constants for HidP_Report_Type
internal const Int16 HidP_Input = 0;
internal const Int16 HidP_Output = 1;
internal const Int16 HidP_Feature = 2;
[ StructLayout( LayoutKind.Sequential ) ]
internal struct HIDD_ATTRIBUTES
{
internal Int32 Size;
internal UInt16 VendorID;
internal UInt16 ProductID;
internal UInt16 VersionNumber;
}
internal struct HIDP_CAPS
{
internal Int16 Usage;
internal Int16 UsagePage;
internal Int16 InputReportByteLength;
internal Int16 OutputReportByteLength;
internal Int16 FeatureReportByteLength;
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=17 ) ]internal Int16[] Reserved;
internal Int16 NumberLinkCollectionNodes;
internal Int16 NumberInputButtonCaps;
internal Int16 NumberInputValueCaps;
internal Int16 NumberInputDataIndices;
internal Int16 NumberOutputButtonCaps;
internal Int16 NumberOutputValueCaps;
internal Int16 NumberOutputDataIndices;
internal Int16 NumberFeatureButtonCaps;
internal Int16 NumberFeatureValueCaps;
internal Int16 NumberFeatureDataIndices;
}
// If IsRange is false, UsageMin is the Usage and UsageMax is unused.
// If IsStringRange is false, StringMin is the String index and StringMax is unused.
// If IsDesignatorRange is false, DesignatorMin is the designator index and DesignatorMax is unused.
internal struct HidP_Value_Caps
{
internal Int16 UsagePage;
internal Byte ReportID;
internal Int32 IsAlias;
internal Int16 BitField;
internal Int16 LinkCollection;
internal Int16 LinkUsage;
internal Int16 LinkUsagePage;
internal Int32 IsRange;
internal Int32 IsStringRange;
internal Int32 IsDesignatorRange;
internal Int32 IsAbsolute;
internal Int32 HasNull;
internal Byte Reserved;
internal Int16 BitSize;
internal Int16 ReportCount;
internal Int16 Reserved2;
internal Int16 Reserved3;
internal Int16 Reserved4;
internal Int16 Reserved5;
internal Int16 Reserved6;
internal Int32 LogicalMin;
internal Int32 LogicalMax;
internal Int32 PhysicalMin;
internal Int32 PhysicalMax;
internal Int16 UsageMin;
internal Int16 UsageMax;
internal Int16 StringMin;
internal Int16 StringMax;
internal Int16 DesignatorMin;
internal Int16 DesignatorMax;
internal Int16 DataIndexMin;
internal Int16 DataIndexMax;
}
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_FlushQueue( SafeFileHandle HidDeviceObject );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_FreePreparsedData( IntPtr PreparsedData );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_GetAttributes( SafeFileHandle HidDeviceObject, ref HIDD_ATTRIBUTES Attributes );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_GetFeature( SafeFileHandle HidDeviceObject, Byte[] lpReportBuffer, Int32 ReportBufferLength );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_GetInputReport( SafeFileHandle HidDeviceObject, Byte[] lpReportBuffer, Int32 ReportBufferLength );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern void HidD_GetHidGuid( ref System.Guid HidGuid );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_GetNumInputBuffers( SafeFileHandle HidDeviceObject, ref Int32 NumberBuffers );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_GetPreparsedData( SafeFileHandle HidDeviceObject, ref IntPtr PreparsedData );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_SetFeature( SafeFileHandle HidDeviceObject, Byte[] lpReportBuffer, Int32 ReportBufferLength );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_SetNumInputBuffers( SafeFileHandle HidDeviceObject, Int32 NumberBuffers );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Boolean HidD_SetOutputReport( SafeFileHandle HidDeviceObject, Byte[] lpReportBuffer, Int32 ReportBufferLength );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Int32 HidP_GetCaps( IntPtr PreparsedData, ref HIDP_CAPS Capabilities );
[ DllImport( "hid.dll", SetLastError=true ) ]
internal static extern Int32 HidP_GetValueCaps(Int32 ReportType, Byte[] ValueCaps, ref Int32 ValueCapsLength, IntPtr PreparsedData);
}
}