If the request is for // an overlapped device we will close the device below and get a handle to an // overlapped device // // The hid.dll api's do not pass the overlapped structure into deviceiocontrol // so to use them we must have a non overlapped device. // RoutineDescription: // Given the HardwareDeviceInfo, representing a handle to the plug and // play information, and deviceInfoData, representing a specific hid device, // open that device and fill in all the relivant information in the given // HID_DEVICE structure. Void OpenHIDDevice( String DevicePath, ref HID_DEVICE HID_Device, Int32 iHIDD) This function extend FindKnownHIDDevices(). OpenHidDevice(functionClassDeviceData.DevicePath, ref HID_Devices, iHIDD) // Open device with just generic query abilities to begin with // SetupDiGetDeviceInterfaceDetail(hardwareDeviceInfo, ref deviceInfoData, ref functionClassDeviceData, RequiredLength, ref RequiredLength, IntPtr.Zero) // Retrieve the information from Plug and Play. SetupDiGetDeviceInterfaceDetail(hardwareDeviceInfo, ref deviceInfoData, IntPtr.Zero, 0, ref RequiredLength, IntPtr.Zero) // Allocate a function class device data structure to receive the // goods about this particular device. While (SetupDiEnumDeviceInterfaces(hardwareDeviceInfo, IntPtr.Zero, ref hidGuid, iHIDD, ref deviceInfoData)) HardwareDeviceInfo = SetupDiGetClassDevs( ref hidGuid, IntPtr.Zero, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE) ĭeviceInfoData.cbSize = Marshal.SizeOf( typeof(SP_DEVICE_INTERFACE_DATA)) SetupDiDestroyDeviceInfoList(hardwareDeviceInfo) // Open a handle to the plug and play dev node. Var functionClassDeviceData = new SP_DEVICE_INTERFACE_DETAIL_DATA() Var deviceInfoData = new SP_DEVICE_INTERFACE_DATA() Int32 FindKnownHIDDevices( ref HID_DEVICE HID_Devices)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |