annotate USBLib/Internal/Windows/UsbApi.cs @ 31:af27992b5972

FBGUI: Added Form Closed event
author Ivo Smits <Ivo@UCIS.nl>
date Thu, 18 Apr 2013 22:45:54 +0200
parents dcfec2be27c9
children fd63c453ff65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
1 using System;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
2 using System.Runtime.InteropServices;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
3
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
4 namespace UCIS.USBLib.Internal.Windows {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
5 class UsbApi {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
6 //public const int INVALID_HANDLE_VALUE = -1;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
7
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
8 public const int USBUSER_GET_CONTROLLER_INFO_0 = 0x00000001;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
9 public const int USBUSER_GET_CONTROLLER_DRIVER_KEY = 0x00000002;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
10
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
11 public const int IOCTL_GET_HCD_DRIVERKEY_NAME = 0x220424;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
12 public const int IOCTL_USB_GET_ROOT_HUB_NAME = 0x220408;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
13 public const int IOCTL_USB_GET_NODE_INFORMATION = 0x220408;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
14 public const int IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX = 0x220448;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
15 public const int IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION = 0x220410;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
16 public const int IOCTL_USB_GET_NODE_CONNECTION_NAME = 0x220414;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
17 public const int IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME = 0x220420;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
18 public const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
19
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
20 public const int USB_DEVICE_DESCRIPTOR_TYPE = 0x1;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
21 public const int USB_CONFIGURATION_DESCRIPTOR_TYPE = 0x2;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
22 public const int USB_STRING_DESCRIPTOR_TYPE = 0x3;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
23 public const int USB_INTERFACE_DESCRIPTOR_TYPE = 0x4;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
24 public const int USB_ENDPOINT_DESCRIPTOR_TYPE = 0x5;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
25
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
26 public const string GUID_DEVINTERFACE_HUBCONTROLLER = "3abf6f2d-71c4-462a-8a92-1e6861e6af27";
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
27 public const string GUID_DEVINTERFACE_USB_HOST_CONTROLLER = "{3ABF6F2D-71C4-462A-8A92-1E6861E6AF27}";
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
28 public const string GUID_DEVINTERFACE_USB_HUB = "{F18A0E88-C30C-11D0-8815-00A0C906BED8}";
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
29 public const string GUID_DEVINTERFACE_USB_DEVICE = "{A5DCBF10-6530-11D2-901F-00C04FB951ED}";
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
30
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
31 public const int MAX_BUFFER_SIZE = 2048;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
32 public const int MAXIMUM_USB_STRING_LENGTH = 255;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
33 public const string REGSTR_KEY_USB = "USB";
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
34 public const int REG_SZ = 1;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
35 public const int DIF_PROPERTYCHANGE = 0x00000012;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
36 public const int DICS_FLAG_GLOBAL = 0x00000001;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
37
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
38
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
39 //public const int SPDRP_DRIVER = 0x9;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
40 //public const int SPDRP_DEVICEDESC = 0x0;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
41
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
42 public const int DICS_ENABLE = 0x00000001;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
43 public const int DICS_DISABLE = 0x00000002;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
44
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
45 //#endregion
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
46 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
47
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
48 #region enumerations
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
49
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
50 enum UsbDeviceClass : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
51 UnspecifiedDevice = 0x00,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
52 AudioInterface = 0x01,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
53 CommunicationsAndCDCControlBoth = 0x02,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
54 HIDInterface = 0x03,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
55 PhysicalInterfaceDevice = 0x5,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
56 ImageInterface = 0x06,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
57 PrinterInterface = 0x07,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
58 MassStorageInterface = 0x08,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
59 HubDevice = 0x09,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
60 CDCDataInterface = 0x0A,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
61 SmartCardInterface = 0x0B,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
62 ContentSecurityInterface = 0x0D,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
63 VidioInterface = 0x0E,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
64 PersonalHeathcareInterface = 0x0F,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
65 DiagnosticDeviceBoth = 0xDC,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
66 WirelessControllerInterface = 0xE0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
67 MiscellaneousBoth = 0xEF,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
68 ApplicationSpecificInterface = 0xFE,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
69 VendorSpecificBoth = 0xFF
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
70 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
71
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
72 enum HubCharacteristics : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
73 GangedPowerSwitching = 0x00,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
74 IndividualPotPowerSwitching = 0x01,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
75 // to do
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
76 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
77
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
78 enum USB_HUB_NODE {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
79 UsbHub,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
80 UsbMIParent
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
81 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
82
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
83 enum USB_DESCRIPTOR_TYPE : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
84 DeviceDescriptorType = 0x1,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
85 ConfigurationDescriptorType = 0x2,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
86 StringDescriptorType = 0x3,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
87 InterfaceDescriptorType = 0x4,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
88 EndpointDescriptorType = 0x5,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
89 HubDescriptor = 0x29
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
90 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
91
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
92 [Flags]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
93 enum USB_CONFIGURATION : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
94 RemoteWakeUp = 32,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
95 SelfPowered = 64,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
96 BusPowered = 128,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
97 RemoteWakeUp_BusPowered = 160,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
98 RemoteWakeUp_SelfPowered = 96
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
99 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
100
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
101 enum USB_TRANSFER : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
102 Control = 0x0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
103 Isochronous = 0x1,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
104 Bulk = 0x2,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
105 Interrupt = 0x3
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
106 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
107
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
108 enum USB_CONNECTION_STATUS : int {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
109 NoDeviceConnected,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
110 DeviceConnected,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
111 DeviceFailedEnumeration,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
112 DeviceGeneralFailure,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
113 DeviceCausedOvercurrent,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
114 DeviceNotEnoughPower,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
115 DeviceNotEnoughBandwidth,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
116 DeviceHubNestedTooDeeply,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
117 DeviceInLegacyHub
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
118 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
119
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
120 enum USB_DEVICE_SPEED : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
121 UsbLowSpeed = 0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
122 UsbFullSpeed,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
123 UsbHighSpeed
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
124 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
125
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
126 [Flags]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
127 enum DeviceInterfaceDataFlags : uint {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
128 Unknown = 0x00000000,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
129 Active = 0x00000001,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
130 Default = 0x00000002,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
131 Removed = 0x00000004
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
132 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
133
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
134 [Flags]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
135 enum HubPortStatus : short {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
136 Connection = 0x0001,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
137 Enabled = 0x0002,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
138 Suspend = 0x0004,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
139 OverCurrent = 0x0008,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
140 BeingReset = 0x0010,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
141 Power = 0x0100,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
142 LowSpeed = 0x0200,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
143 HighSpeed = 0x0400,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
144 TestMode = 0x0800,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
145 Indicator = 0x1000,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
146 // these are the bits which cause the hub port state machine to keep moving
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
147 //kHubPortStateChangeMask = kHubPortConnection | kHubPortEnabled | kHubPortSuspend | kHubPortOverCurrent | kHubPortBeingReset
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
148 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
149
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
150 enum HubStatus : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
151 LocalPowerStatus = 1,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
152 OverCurrentIndicator = 2,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
153 LocalPowerStatusChange = 1,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
154 OverCurrentIndicatorChange = 2
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
155 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
156
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
157 enum PortIndicatorSlectors : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
158 IndicatorAutomatic = 0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
159 IndicatorAmber,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
160 IndicatorGreen,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
161 IndicatorOff
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
162 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
163
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
164 enum PowerSwitching : byte {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
165 SupportsGangPower = 0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
166 SupportsIndividualPortPower = 1,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
167 SetPowerOff = 0,
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
168 SetPowerOn = 1
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
169 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
170
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
171 #endregion
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
172
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
173 #region structures
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
174
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
175 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
176 struct SP_CLASSINSTALL_HEADER {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
177 public int cbSize;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
178 public int InstallFunction; //DI_FUNCTION InstallFunction;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
179 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
180
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
181 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
182 struct SP_PROPCHANGE_PARAMS {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
183 public SP_CLASSINSTALL_HEADER ClassInstallHeader;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
184 public int StateChange;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
185 public int Scope;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
186 public int HwProfile;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
187 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
188
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
189 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
190 struct USB_HCD_DRIVERKEY_NAME {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
191 public uint ActualLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
192 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsbApi.MAX_BUFFER_SIZE)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
193 public string DriverKeyName; //WCHAR DriverKeyName[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
194 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
195
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
196 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
197 struct USB_ROOT_HUB_NAME {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
198 public uint ActualLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
199 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsbApi.MAX_BUFFER_SIZE)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
200 public string RootHubName; //WCHAR RootHubName[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
201 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
202
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
203 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
204 struct USB_HUB_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
205 public byte bDescriptorLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
206 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
207 public byte bNumberOfPorts;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
208 public ushort wHubCharacteristics;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
209 public byte bPowerOnToPowerGood;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
210 public byte bHubControlCurrent;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
211 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
212 public byte[] bRemoveAndPowerMask; //UCHAR bRemoveAndPowerMask[64];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
213 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
214
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
215 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
216 struct USB_HUB_INFORMATION {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
217 public USB_HUB_DESCRIPTOR HubDescriptor;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
218 public bool HubIsBusPowered;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
219 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
220
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
221 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
222 struct USB_NODE_INFORMATION {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
223 //public int NodeType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
224 public USB_HUB_NODE NodeType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
225 public USB_HUB_INFORMATION HubInformation; // union { USB_HUB_INFORMATION HubInformation; USB_MI_PARENT_INFORMATION MiParentInformation; }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
226 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
227
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
228 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
229 struct USB_NODE_CONNECTION_INFORMATION_EX {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
230 public uint ConnectionIndex;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
231 public USB_DEVICE_DESCRIPTOR DeviceDescriptor;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
232 public byte CurrentConfigurationValue;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
233 public USB_DEVICE_SPEED Speed;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
234 public byte DeviceIsHub; //BOOLEAN DeviceIsHub;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
235 public ushort DeviceAddress;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
236 public uint NumberOfOpenPipes;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
237 public USB_CONNECTION_STATUS ConnectionStatus;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
238 //public IntPtr PipeList; //USB_PIPE_INFO PipeList[0];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
239 //[MarshalAs(UnmanagedType.ByValArray, SizeConst=100)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
240 //Byte[] PipeList;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
241 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
242
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
243 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
244 struct USB_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
245 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
246 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
247 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
248
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
249 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
250 class USB_DEVICE_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
251 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
252 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
253 public ushort bcdUSB;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
254 public UsbDeviceClass bDeviceClass;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
255 public byte bDeviceSubClass;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
256 public byte bDeviceProtocol;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
257 public byte bMaxPacketSize0;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
258 public ushort idVendor;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
259 public ushort idProduct;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
260 public ushort bcdDevice;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
261 public byte iManufacturer;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
262 public byte iProduct;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
263 public byte iSerialNumber;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
264 public byte bNumConfigurations;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
265 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
266
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
267 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
268 struct USB_ENDPOINT_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
269 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
270 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
271 public byte bEndpointAddress;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
272 public USB_TRANSFER bmAttributes;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
273 public short wMaxPacketSize;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
274 public byte bInterval;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
275 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
276
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
277 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
278 struct USB_STRING_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
279 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
280 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
281 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsbApi.MAXIMUM_USB_STRING_LENGTH)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
282 public string bString; //WCHAR bString[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
283 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
284
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
285 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
286 struct USB_INTERFACE_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
287 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
288 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
289 public byte bInterfaceNumber;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
290 public byte bAlternateSetting;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
291 public byte bNumEndpoints;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
292 public byte bInterfaceClass;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
293 public byte bInterfaceSubClass;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
294 public byte bInterfaceProtocol;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
295 public byte Interface;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
296 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
297
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
298 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
299 struct USB_CONFIGURATION_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
300 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
301 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
302 public ushort wTotalLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
303 public byte bNumInterface;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
304 public byte bConfigurationsValue;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
305 public byte iConfiguration;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
306 public USB_CONFIGURATION bmAttributes;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
307 public byte MaxPower;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
308 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
309
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
310 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
311 struct HID_DESCRIPTOR_DESC_LIST {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
312 public byte bReportType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
313 public short wReportLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
314 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
315
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
316 [StructLayout(LayoutKind.Sequential, Pack = 1)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
317 struct HID_DESCRIPTOR {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
318 public byte bLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
319 public USB_DESCRIPTOR_TYPE bDescriptorType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
320 public ushort bcdHID;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
321 public byte bCountry;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
322 public byte bNumDescriptors;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
323 public HID_DESCRIPTOR_DESC_LIST hid_desclist; //DescriptorList [1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
324 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
325
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
326 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
327 struct USB_SETUP_PACKET {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
328 public byte bmRequest;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
329 public byte bRequest;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
330 public ushort wValue;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
331 public ushort wIndex;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
332 public ushort wLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
333 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
334
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
335 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
336 struct USB_DESCRIPTOR_REQUEST {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
337 public uint ConnectionIndex;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
338 public USB_SETUP_PACKET SetupPacket;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
339 //public byte[] Data; //UCHAR Data[0];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
340 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
341
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
342 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
343 struct USB_NODE_CONNECTION_NAME {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
344 public uint ConnectionIndex;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
345 public uint ActualLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
346 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsbApi.MAX_BUFFER_SIZE)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
347 public string NodeName; //WCHAR NodeName[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
348 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
349
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
350 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
351 struct USB_NODE_CONNECTION_DRIVERKEY_NAME {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
352 public uint ConnectionIndex;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
353 public uint ActualLength;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
354 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsbApi.MAX_BUFFER_SIZE)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
355 public string DriverKeyName; //WCHAR DriverKeyName[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
356 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
357
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
358 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
359 struct STORAGE_DEVICE_NUMBER {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
360 public int DeviceType; //DEVICE_TYPE DeviceType;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
361 public uint DeviceNumber;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
362 public uint PartitionNumber;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
363 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
364
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
365 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
366 class SP_DEVINFO_DATA1 {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
367 public int cbSize;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
368 public Guid ClassGuid;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
369 public int DevInst;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
370 public ulong Reserved;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
371 };
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
372
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
373 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
374 class RAW_ROOTPORT_PARAMETERS {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
375 public ushort PortNumber;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
376 public ushort PortStatus;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
377 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
378
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
379 [StructLayout(LayoutKind.Sequential)]
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
380 class USB_UNICODE_NAME {
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
381 public uint Length;
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
382 public string str; //WCHAR String[1];
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
383 }
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
384
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
385 #endregion
dcfec2be27c9 Added USBLib
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
386 }