Pardon the userland intrusion. W7Ux64 FWIW.
My Blackfin firmware now advertises itself as a composite device -
interface 2 sporting a single control endpoint only. Interface 1 is mass
storage and class compliant, Interface 2 is for really simple control
functions (mainly during device test). I thought WinUSB would be a great
solution here - inbox drivers, simple usermode interface, etc. etc.
Question: How to legitimately query the host for device paths in the
format required by CreateFile?
The current search starts off with the usual:
- SetupDiGetClassDevs with GUID_DEVINTERFACE_USB_DEVICE
- SetupDiEnumDeviceInterfaces
- SetupDiGetDeviceInterfaceDetail -> i.e. extract
pDetailDataBuffer->DevicePath
but since this is a composite device the enumerator only gets to the
parent. So the next steps are:
- SetupDiEnumDeviceInfo
- CM_Get_Device_ID
- CM_Get_DevNode_Status -> check it is a node in
the tree - CM_Get_Child and CM_Get_Sibling -> for each
child call CM_Get_Device_ID()
Now this all works. The next steps are:
- SetupDiOpenDeviceInfo using the path returned in 7.
- SetupDiOpenDevRegKey(hDevInfo,&da, DICS_FLAG_GLOBAL, 0, DIREG_DEV,
KEY_READ); - Finally RegQueryValueEx with the key obtained in 9 and a value of
‘DeviceInterfaceGUIDs’.
Step 10 always fails with a ERROR_FILE_NOT_FOUND. GetlastError() reports
‘operation completed successfully’
Step 3 returns the parent device path:
\?\usb#vid_XXXX&pid_a00a#123456789012#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Step 5 returns the parent device ID:
USB\VID_XXXX&PID_A00A\123456789012
Step 7 returns the correct child IDs:
USB\VID_XXXX&PID_A00A&MI_00\8&15CD2222&0&0000
USB\VID_XXXX&PID_A00A&MI_01\8&15CD2222&0&0001
What am I missing here? I can see the correct key/values in the
registry. I could cheat and build up the key myself but this seems
unsatisfactory.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_XXXX&PID_A00A&MI_01\8&15cd2222&0&0001\Device
Parameters
Thx++
Jerry