Prev: Non-Plug&Play driver installation
Next: Driver that can be used to read/write IP packets on dial-up connection?
From: Drew Hohmann on 7 Apr 2010 10:40 I'm using the WinUSB sdk (running XP SP3) for a custom USB device. I've made the .inf file from the How to Use WinUSB to Communicate with a USB Device documentation, and modified appropriately. SetupDiGetClassDevs(&InterfaceGuid, NULL, NULL, DIGCF_PRESENT); works, and returns the appropriate list. SetupDiEnumDeviceInfo(hdevClassInfo, 0, &devinfo); works as well, and returns info about the device. However, SetupDiEnumDeviceInterfaces(hdevClassInfo, &devinfo, &InterfaceGuid, 0, &DeviceData); fails with ERROR_NO_MORE_ITEMS. As far as I can tell, everything is correct. The InterfaceGuid is set to 8D1C7D90-41A8-11DF-9879-001CC0A3A714, which is the class guid in my .inf file. I also tried the GUID GUID_DEVINTERFACE_USB_DEVICE, and that failed as well. Passing in a NULL instead of &devinfo also fails, so the devinfo structure is not the problem. Attached is the .inf file I am using. It almost seems like the device interface isn't registered properly, but I'm unable to figure out why or how. Please help, Thanks
From: Scott Noone on 7 Apr 2010 12:04 > SetupDiEnumDeviceInterfaces(hdevClassInfo, &devinfo, &InterfaceGuid, 0, > &DeviceData); fails with ERROR_NO_MORE_ITEMS. As far as I can tell, > everything is correct. The InterfaceGuid is set to > 8D1C7D90-41A8-11DF-9879-001CC0A3A714, which is the class guid in my .inf > file. Class install GUIDs and device interface GUIDs are different beasts. Class install GUIDs control the class that your device appears under in Device Manager. Device interface GUIDs indicate the interfaces that your device supports. As a bad example, I could install my custom whiz bang mouse device under a custom install class in Device Manager so that I could name it what I wanted and provide my own icon. But, in my driver I could then register and enable the mouse device interface GUID so that people looking for mouse devices would find it and talk to it like a mouse. Device interfaces are optional for drivers. I'm not entirely positive, but I don't believe that the WinUSB driver actually registers a device interface GUID for the devices that it creates (maybe someone that has actually written a WinUSB driver can confirm). -scott -- Scott Noone Consulting Associate OSR Open Systems Resources, Inc. http://www.osronline.com "Drew Hohmann" <drew(a)med-associates.com> wrote in message news:#kF8yAm1KHA.264(a)TK2MSFTNGP05.phx.gbl... > I'm using the WinUSB sdk (running XP SP3) for a custom USB device. I've > made the .inf file from the > How to Use WinUSB to Communicate with a USB Device > documentation, and modified appropriately. > > SetupDiGetClassDevs(&InterfaceGuid, NULL, NULL, DIGCF_PRESENT); works, > and returns the appropriate list. > SetupDiEnumDeviceInfo(hdevClassInfo, 0, &devinfo); works as well, and > returns info about the device. > However, > SetupDiEnumDeviceInterfaces(hdevClassInfo, &devinfo, &InterfaceGuid, 0, > &DeviceData); fails with ERROR_NO_MORE_ITEMS. As far as I can tell, > everything is correct. The InterfaceGuid is set to > 8D1C7D90-41A8-11DF-9879-001CC0A3A714, which is the class guid in my .inf > file. I also tried the GUID GUID_DEVINTERFACE_USB_DEVICE, and that > failed as well. Passing in a NULL instead of &devinfo also fails, so > the devinfo structure is not the problem. > > Attached is the .inf file I am using. It almost seems like the device > interface isn't registered properly, but I'm unable to figure out why or > how. > > Please help, > Thanks >
From: Drew Hohmann on 7 Apr 2010 13:13 It looks like the .inf is installing a device interface GUID [Dev_AddReg] HKR,,DeviceInterfaceGUIDs,0x10000,"{8D1C7D91-41A8-11df-9879-001CC0A3A714}" According to the documentation, Obtain a Handle to the Device and Initialize WinUSB 1. Use the device interface GUID to obtain the device path. The correct GUID is the one that you specified in the INF that was used to install WinUsb.sys. I've tried all 4 combinations of GUID (the class guid and the device interface guid) for SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces, and every combination fails. SetupDiGetClassDevs takes either a device setup guid or a device interface guid (and both guids do work with SetupDiGetClassDevs) SetupDiEnumDeviceInterfaces is listed as only taking device interface guid. I even tried changing the device interface GUID back to the GUID provided in the sample, and that failed as well. Drew On 4/7/2010 12:04 PM, Scott Noone wrote: >> SetupDiEnumDeviceInterfaces(hdevClassInfo, &devinfo, &InterfaceGuid, 0, >> &DeviceData); fails with ERROR_NO_MORE_ITEMS. As far as I can tell, >> everything is correct. The InterfaceGuid is set to >> 8D1C7D90-41A8-11DF-9879-001CC0A3A714, which is the class guid in my .inf >> file. > > Class install GUIDs and device interface GUIDs are different beasts. > Class install GUIDs control the class that your device appears under in > Device Manager. Device interface GUIDs indicate the interfaces that your > device supports. > > As a bad example, I could install my custom whiz bang mouse device under > a custom install class in Device Manager so that I could name it what I > wanted and provide my own icon. But, in my driver I could then register > and enable the mouse device interface GUID so that people looking for > mouse devices would find it and talk to it like a mouse. > > Device interfaces are optional for drivers. I'm not entirely positive, > but I don't believe that the WinUSB driver actually registers a device > interface GUID for the devices that it creates (maybe someone that has > actually written a WinUSB driver can confirm). > > -scott >
From: Doron Holan [MSFT] on 7 Apr 2010 14:23 if you want the device interface, specify SetupDiGetClassDevs(&DeviceInterfaceGuid, NULL, NULL, DIGCF_PRESENT| DIGCF_DEVICEINTERFACE); d -- This posting is provided "AS IS" with no warranties, and confers no rights. "Drew Hohmann" <drew(a)med-associates.com> wrote in message news:e$2epWn1KHA.348(a)TK2MSFTNGP02.phx.gbl... > It looks like the .inf is installing a device interface GUID > [Dev_AddReg] > HKR,,DeviceInterfaceGUIDs,0x10000,"{8D1C7D91-41A8-11df-9879-001CC0A3A714}" > > According to the documentation, > > Obtain a Handle to the Device and Initialize WinUSB > 1. Use the device interface GUID to obtain the device path. The correct > GUID is the one that you specified in the INF that was used to install > WinUsb.sys. > > I've tried all 4 combinations of GUID (the class guid and the device > interface guid) for SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces, > and every combination fails. SetupDiGetClassDevs takes either a device > setup guid or a device interface guid (and both guids do work with > SetupDiGetClassDevs) > SetupDiEnumDeviceInterfaces is listed as only taking device interface > guid. I even tried changing the device interface GUID back to the GUID > provided in the sample, and that failed as well. > Drew > > > On 4/7/2010 12:04 PM, Scott Noone wrote: >>> SetupDiEnumDeviceInterfaces(hdevClassInfo, &devinfo, &InterfaceGuid, 0, >>> &DeviceData); fails with ERROR_NO_MORE_ITEMS. As far as I can tell, >>> everything is correct. The InterfaceGuid is set to >>> 8D1C7D90-41A8-11DF-9879-001CC0A3A714, which is the class guid in my .inf >>> file. >> >> Class install GUIDs and device interface GUIDs are different beasts. >> Class install GUIDs control the class that your device appears under in >> Device Manager. Device interface GUIDs indicate the interfaces that your >> device supports. >> >> As a bad example, I could install my custom whiz bang mouse device under >> a custom install class in Device Manager so that I could name it what I >> wanted and provide my own icon. But, in my driver I could then register >> and enable the mouse device interface GUID so that people looking for >> mouse devices would find it and talk to it like a mouse. >> >> Device interfaces are optional for drivers. I'm not entirely positive, >> but I don't believe that the WinUSB driver actually registers a device >> interface GUID for the devices that it creates (maybe someone that has >> actually written a WinUSB driver can confirm). >> >> -scott >>
From: Drew Hohmann on 7 Apr 2010 14:33
Awesome - thanks for the help. That fixed it. The key was specifying DIGCF_DEVICEINTERFACE and using the device interface guid on both calls. Drew On 4/7/2010 2:23 PM, Doron Holan [MSFT] wrote: > | DIGCF_DEVICEINTERFACE |