I am creating a DLL to utilize the Intel I2C Driver for the Atom E3800 processor. This will allow me to access devices on the specific I2C bus.
Everything appears to be working as expected until I try to execute CreateFile with the path provided by the SetupDiGetDeviceInterfaceDetail function. The DevicePath provided by this call is:
L"\\?\pci#ven_8086&dev_0f41&subsys_72708086&rev_11#3&11583659&0&c1#{4d36e97d-e325-11ce-bfc1-08002be10318}"
In device manager the Device Instance Path is
PCI\VEN_8086&DEV_0F41&SUBSYS_72708086&REV_11\3&11583659&0&C1
These obviously do not match. Questions:
- Should they match?
- Do I need to manipulate the DevicePath? According to MSDN, I should not have to.
- Am I missing something?
Here is the code in question:
while (SetupDiEnumDeviceInfo(DeviceInfoSet, Index, &DeviceInfoData))
{
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
SetupDiCreateDeviceInterface(DeviceInfoSet, &DeviceInfoData, &DeviceInfoData.ClassGuid, NULL, 0, &DeviceInterfaceData);
// call the first time to get required buffer size
SetupDiGetDeviceInterfaceDetail(DeviceInfoSet, &DeviceInterfaceData, NULL, 0, &requiredSize, NULL);
// allocate required buffer
if ((DeviceInterfaceDetailData = (PSP_INTERFACE_DEVICE_DETAIL_DATA)malloc(requiredSize)) == NULL)
{
SetupDiDestroyDeviceInfoList(DeviceInfoSet);
return status = INSUFFICIENT_MEMORY;
}
// call the second time to get detailed info
DeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
SetupDiGetDeviceInterfaceDetail(DeviceInfoSet, &DeviceInterfaceData, DeviceInterfaceDetailData, requiredSize, 0, &DeviceInfoData);
// check for i2c controller #1
if(wcsstr(DeviceInterfaceDetailData->DevicePath, i2cDevice) != NULL)
break;
Index++;
}
tempHandle = CreateFile(DeviceInterfaceDetailData->DevicePath,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
Thanks.