![]() ![]() Since there were no errors during driver installation I don't know why this happens. So it cannot find any devices belonging to that GUID, right? Nevertheless, I tried your code and it already fails in the for loop, as the SetupDiEnumDeviceInterfaces ( hDevInfo, nullptr, pGuidItf, idx, & spdid )įails with the error code ERROR_NO_MORE_ITEMS in the first call. But as I thought, the problem was that no device interface for the I2C_LPSS_INTERFACE_GUID has been created yet, I used Thanks for the fast reply, actually I forgot to mention that my first approach was differently and more or less the way you described it. MessageBox(nullptr, pError, nullptr, MB_OK) If(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, static_cast(hr), 0, reinterpret_cast(&pError), 0, nullptr)) You can then call the enum function: HRESULT hr = EnumDeviceInterfaces(&I2C_LPSS_INTERFACE_GUID, EnumDevInterfacesCB, nullptr) MessageBox(nullptr, pszDeviceName, nullptr, MB_OK) Hr = HRESULT_FROM_SETUPAPI(GetLastError()) Īll you have to do now is to implement the callback function, for example: BOOL CALLBACK EnumDevInterfacesCB(PCTSTR pszDeviceName, void* pCtx) If(SetupDiGetDeviceInterfaceDetail(hDevInfo, &spdid, pspdidd, dwSize, &dwSize, nullptr))īlContinue = CallbackProc(pspdidd->DevicePath, pCtx) Pspdidd->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) SP_DEVICE_INTERFACE_DETAIL_DATA* pspdidd = reinterpret_cast(malloc(dwSize)) If((dwSize) & (GetLastError() = ERROR_INSUFFICIENT_BUFFER)) SetupDiGetDeviceInterfaceDetail(hDevInfo, &spdid, nullptr, 0, &dwSize, nullptr) Spdid.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA) įor(DWORD idx = 0 SetupDiEnumDeviceInterfaces(hDevInfo, nullptr, pGuidItf, idx, &spdid) ++idx) HDEVINFO hDevInfo = SetupDiGetClassDevs(pGuidItf, nullptr, nullptr, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT) HRESULT EnumDeviceInterfaces(const GUID* pGuidItf, ENUMDEVICEINTERFACESCALLBACKPROC CallbackProc, void* pCtx) Many years ago, I wrote an enumerator function that behaves the same way as other API enum function (EnumWindows, for example): typedef BOOL (CALLBACK * ENUMDEVICEINTERFACESCALLBACKPROC)(PCTSTR pszDeviceName, void* ctx) Without going too much into detail: This looks completely wrong. Thank you! (Only for reading all this stuff) The datasheet of the Intel atom E3800 series can be found here: ![]() The driver package including the header files and the software developer's manual can be found here: ![]() Why do I get other HW IDs of the I2C ports if I use the class GUID defined in the iaioi2c.inf file? Is my procedure wrong or is there anything missing?Ģ. While (SetupDiEnumDeviceInfo(hDvcInfoSet, i, &devInfo)) ġ. Loop through all the devices information elements, create an interface for each element and get details about each interface: HDvcInfoSet = SetupDiGetClassDevs(&I2C_LPSS_INTERFACE_GUID, NULL, NULL, DIGCF_ALLCLASSES)Ģ. Get the device interface class corresponding to that GUID: To get the device name and create a handle for that device I used the following procedure:ġ. The problem is that no devices can be found using the global unique identifier I2C_LPSS_INTERFACE_GUID defined in the I2Cpublic.h header file which was included in the driver package and that should be used within the user-mode Win API functions according After trying to figure out how to communicate with the I2C driver using the Win API for several days, I hope you can help me.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |