soldernerd / HID_Utility

This open source (GNU GPLv3) project is aimed at simplifying the development of C# applications that communicate with USB HID (Human Interface Device) devices.
https://soldernerd.com/2017/02/14/c-usb-hid-utility/
40 stars 10 forks source link

Error getting Device Details #2

Open PhillyNJ opened 5 years ago

PhillyNJ commented 5 years ago

Hi, I loaded your demo project, change the VID and PID to a known device, When trying to connect here:

if (SetupDiEnumDeviceInterfaces(DeviceInfoTable, IntPtr.Zero, ref InterfaceClassGuid, InterfaceIndex, ref InterfaceDataStructure)) { ErrorStatus = (uint)Marshal.GetLastWin32Error(); if (ErrorStatus == ERROR_NO_MORE_ITEMS) //Did we reach the end of the list of matching devices in the DeviceInfoTable? { //Cound not find the device. Must not have been attached. SetupDiDestroyDeviceInfoList(DeviceInfoTable); //Clean up the old structure we no longer need. return null; } } else //Else some other kind of unknown error ocurred... { ErrorStatus = (uint)Marshal.GetLastWin32Error(); SetupDiDestroyDeviceInfoList(DeviceInfoTable); //Clean up the old structure we no longer need. return null; // error here }

SetupDiEnumDeviceInterfaces returns error 1784

PhillyNJ commented 5 years ago

Nevermind - Had to change the Platform to run in x86. Not dure that was even mentioned in anywhere,

soldernerd commented 5 years ago

Yes, it's described in the readme: "Please be aware that all projects must be compiled with "x86" setting even on a 64bit platform." But I'm glad you already identified and fixed the issue yourself.