Debugging USB Device Installation on Windows

Recently, I ran into a problem trying to install a USB keyboard on Windows XP at work. Given that HID devices always just work with Windows, I wasn’t quite sure how to go about troubleshooting such a ridiculous problem.

My first step was to investigate the problem, repeating the process to see what went wrong. When I plugged in the keyboard, it would show up as Unknown Device. Searching for drivers would fail. I already had another USB keyboard installed, and this one worked fine. So I tried installing a third keyboard, this time a fancy multimedia keyboard, and it also exhibited the same behavior.

It turned out that my keyboard was not just a Human Interface Device, despite its appearance. It was actually a USB composite device and hub. I spent half a day trying to figure out what was wrong, and ended up learning a lot more about Windows USB driver installation.

Microsoft provides several MSKB articles on troubleshooting USB driver installation, most of which are useless. However, KB314464 contains the key to the problem:  setupapi.log. This log file records installations of drivers and the process Windows went through to determine how to match a driver to newly discovered device. Once I opened this file and watched the install fail for the keyboard, it became obvious that it was searching for a USB composite device driver, but not finding one. It turned out my usb.inf was missing. I don’t know how it got deleted, but it did. Once I copied over a replacement from another PC, the keyboard installed perfectly.

Device Tree for Logitech Illuminated Keyboard (Windows 7)

Here’s what happened with the when I plugged in the keyboard:

[2010/01/04 10:11:28 1276.7 Driver Install]
#-019 Searching for hardware ID(s): usb\vid_046d&pid_c318&rev_5501,usb\vid_046d&pid_c318
#-018 Searching for compatible ID(s): usb\devclass_00&subclass_00&prot_00,usb\devclass_00&subclass_00,usb\devclass_00,usb\composite
#-198 Command line processed: C:\WINNT\system32\services.exe
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#W059 Selecting best compatible driver failed. Error 0xe0000228: There are no compatible drivers for this device.
#W157 Default installer failed. Error 0xe0000228: There are no compatible drivers for this device.

Windows failed to find an exact driver for the vid/pid combination and tried to find a compatible driver based on the device class. The device is a usb\composite device, which should map to a standard Windows driver, but it instead reported that the search failed. At this point, I should have looked for an inf file with this hwid string: usb\composite. If I had, I would have discovered it missing in my directory, but present in another machine where I could install a keyboard, in usb.inf.

The Generic Models section of usb.inf includes the hwid:

; =================== Generic ==================================

[Generic.Section]
%USB\COMPOSITE.DeviceDesc%=Composite.Dev,USB\COMPOSITE
%USB\UNKNOWN.DeviceDesc%=BADDEVICE.Dev,USB\UNKNOWN

This directs to DDInstall sections Composite.Dev.*:

[Composite.Dev]
AddReg=CommonClassParent.AddReg
CopyFiles=CommonClassParent.CopyFiles

; For Windows NT...

[Composite.Dev.NT]
CopyFiles=CommonClassParent.CopyFiles
DelReg=Composite.DelReg.NT

[Composite.DelReg.NT]
HKR,,EnumPropPages32

[Composite.Dev.NT.Services]
AddService = usbccgp, 0x00000002, CommonClassParent.AddService

The Composite.Dev section is actually for Windows 2000 and the decorator .NT on Composite.Dev.NT specifies a generic driver for Windows XP and later.

Once I placed the usb.inf file back into the %SYSTEMDIR%\inf directory, installation of the USB Composite Device magically worked:

[2010/01/04 13:10:39 1264.3 Driver Install]
#-019 Searching for hardware ID(s): usb\vid_046d&pid_c318&rev_5501,usb\vid_046d&pid_c318
#-018 Searching for compatible ID(s): usb\devclass_00&subclass_00&prot_00,usb\devclass_00&subclass_00,usb\devclass_00,usb\composite
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "USB\COMPOSITE" in C:\WINNT\inf\usb.inf; Device: "USB Composite Device"; Driver: "USB Composite Device"; Provider: "Microsoft"; Mfg: "(Standard USB Host Controller)"; Section name: "Composite.Dev".
#I023 Actual install section: [Composite.Dev.NT]. Rank: 0x00002003. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [Composite.Dev] in "c:\winnt\inf\usb.inf".
#I320 Class GUID of device remains: {36FC9E60-C465-11CF-8056-444553540000}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "USB\VID_046D&PID_C318\5&1AF8ED3F&0&1".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [Composite.Dev.NT.Interfaces] from "c:\winnt\inf\usb.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "USB\VID_046D&PID_C318\5&1AF8ED3F&0&1".
#I121 Device install of "USB\VID_046D&PID_C318\5&1AF8ED3F&0&1" finished successfully.

After that, the remaining the remaining device tree hierarchy installed successfully and the keyboard was enabled:

[2010/01/04 13:10:43 1264.7 Driver Install]
#-019 Searching for hardware ID(s): usb\vid_046d&pid_c318&rev_5501&mi_00,usb\vid_046d&pid_c318&mi_00
#-018 Searching for compatible ID(s): usb\class_03&subclass_01&prot_01,usb\class_03&subclass_01,usb\class_03
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "USB\Class_03&SubClass_01" in C:\WINNT\inf\input.inf; Device: "USB Human Interface Device"; Driver: "USB Human Interface Device"; Provider: "Microsoft"; Mfg: "(Standard system devices)"; Section name: "HID_Inst".
#I023 Actual install section: [HID_Inst.NT]. Rank: 0x00003101. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [HID_Inst] in "c:\winnt\inf\input.inf".
#I320 Class GUID of device remains: {745A17A0-74D3-11D0-B6FE-00A0C90F57DA}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "USB\VID_046D&PID_C318&MI_00\6&7451BA8&0&0000".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [HID_Inst.NT.Interfaces] from "c:\winnt\inf\input.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "USB\VID_046D&PID_C318&MI_00\6&7451BA8&0&0000".
#I121 Device install of "USB\VID_046D&PID_C318&MI_00\6&7451BA8&0&0000" finished successfully.
[2010/01/04 13:10:47 1264.11 Driver Install]
#-019 Searching for hardware ID(s): usb\vid_046d&pid_c318&rev_5501&mi_01,usb\vid_046d&pid_c318&mi_01
#-018 Searching for compatible ID(s): usb\class_03&subclass_00&prot_02,usb\class_03&subclass_00,usb\class_03
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "USB\Class_03" in C:\WINNT\inf\input.inf; Device: "USB Human Interface Device"; Driver: "USB Human Interface Device"; Provider: "Microsoft"; Mfg: "(Standard system devices)"; Section name: "HID_Inst".
#I023 Actual install section: [HID_Inst.NT]. Rank: 0x00003202. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [HID_Inst] in "c:\winnt\inf\input.inf".
#I320 Class GUID of device remains: {745A17A0-74D3-11D0-B6FE-00A0C90F57DA}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "USB\VID_046D&PID_C318&MI_01\6&7451BA8&0&0001".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [HID_Inst.NT.Interfaces] from "c:\winnt\inf\input.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "USB\VID_046D&PID_C318&MI_01\6&7451BA8&0&0001".
#I121 Device install of "USB\VID_046D&PID_C318&MI_01\6&7451BA8&0&0001" finished successfully.
[2010/01/04 13:10:51 1264.15 Driver Install]
#-019 Searching for hardware ID(s): hid\vid_046d&pid_c318&rev_5501&mi_00,hid\vid_046d&pid_c318&mi_00,hid_device_system_keyboard,hid_device_up:0001_u:0006,hid_device
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "HID_DEVICE_SYSTEM_KEYBOARD" in C:\WINNT\inf\keyboard.inf; Device: "HID Keyboard Device"; Driver: "HID Keyboard Device"; Provider: "Microsoft"; Mfg: "(Standard keyboards)"; Section name: "HID_Keyboard_Inst".
#I023 Actual install section: [HID_Keyboard_Inst.NT]. Rank: 0x00001002. Effective driver date: 07/01/2001.
#I022 Found "HID\VID_046D&PID_C318&Mi_00" in C:\WINNT\inf\oem52.inf; Device: "Logitech HID-Compliant Keyboard"; Driver: "Logitech HID-Compliant Keyboard"; Provider: "Logitech"; Mfg: "Logitech"; Section name: "HIDFiltInstWakeEnbl".
#I023 Actual install section: [HIDFiltInstWakeEnbl.NT]. Rank: 0x00000001. Effective driver date: 06/17/2009.
#I022 Found "HID\VID_046D&PID_C318&Mi_00" in C:\WINNT\inf\oem52.inf; Device: "Logicool HID-Compliant Keyboard (106 keys)"; Driver: "Logicool HID-Compliant Keyboard (106 keys)"; Provider: "Logitech"; Mfg: "Logicool"; Section name: "HIDFiltInstWakeEnblJ".
#I023 Actual install section: [HIDFiltInstWakeEnblJ.NT]. Rank: 0x00000001. Effective driver date: 06/17/2009.
#I022 Found "HID_DEVICE" in C:\WINNT\inf\input.inf; Device: "HID-compliant device"; Driver: "HID-compliant device"; Provider: "Microsoft"; Mfg: "(Standard system devices)"; Section name: "HID_Raw_Inst".
#I023 Actual install section: [HID_Raw_Inst.NT]. Rank: 0x00001004. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [HIDFiltInstWakeEnbl] in "c:\winnt\inf\oem52.inf".
#I320 Class GUID of device remains: {4D36E96B-E325-11CE-BFC1-08002BE10318}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#I063 Selected driver installs from section [HIDFiltInstWakeEnbl] in "c:\winnt\inf\oem52.inf".
#I320 Class GUID of device remains: {4D36E96B-E325-11CE-BFC1-08002BE10318}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "HID\VID_046D&PID_C318&MI_00\7&2C4789AA&0&0000".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [HIDFiltInstWakeEnbl.NT.Interfaces] from "c:\winnt\inf\oem52.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "HID\VID_046D&PID_C318&MI_00\7&2C4789AA&0&0000".
#I121 Device install of "HID\VID_046D&PID_C318&MI_00\7&2C4789AA&0&0000" finished successfully.
[2010/01/04 13:10:56 1264.19 Driver Install]
#-019 Searching for hardware ID(s): hid\vid_046d&pid_c318&rev_5501&mi_01&col01,hid\vid_046d&pid_c318&mi_01&col01,hid_device_system_consumer,hid_device_up:000c_u:0001,hid_device
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "HID_DEVICE_UP:000C_U:0001" in C:\WINNT\inf\hidserv.inf; Device: "HID-compliant consumer control device"; Driver: "HID-compliant consumer control device"; Provider: "Microsoft"; Mfg: "Microsoft"; Section name: "HIDSystemConsumer".
#I023 Actual install section: [HIDSystemConsumer]. Rank: 0x00001003. Effective driver date: 07/01/2001.
#I022 Found "HID_DEVICE" in C:\WINNT\inf\input.inf; Device: "HID-compliant device"; Driver: "HID-compliant device"; Provider: "Microsoft"; Mfg: "(Standard system devices)"; Section name: "HID_Raw_Inst".
#I023 Actual install section: [HID_Raw_Inst.NT]. Rank: 0x00001004. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [HIDSystemConsumer] in "c:\winnt\inf\hidserv.inf".
#I320 Class GUID of device remains: {745A17A0-74D3-11D0-B6FE-00A0C90F57DA}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "HID\VID_046D&PID_C318&MI_01&COL01\7&3DCDBE1&0&0000".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [HIDSystemConsumer.Interfaces] from "c:\winnt\inf\hidserv.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "HID\VID_046D&PID_C318&MI_01&COL01\7&3DCDBE1&0&0000".
#I121 Device install of "HID\VID_046D&PID_C318&MI_01&COL01\7&3DCDBE1&0&0000" finished successfully.
[2010/01/04 13:10:58 1264.23 Driver Install]
#-019 Searching for hardware ID(s): hid\vid_046d&pid_c318&rev_5501&mi_01&col02,hid\vid_046d&pid_c318&mi_01&col02,hid_device_up:ff00_u:0001,hid_device
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "HID_DEVICE" in C:\WINNT\inf\input.inf; Device: "HID-compliant device"; Driver: "HID-compliant device"; Provider: "Microsoft"; Mfg: "(Standard system devices)"; Section name: "HID_Raw_Inst".
#I023 Actual install section: [HID_Raw_Inst.NT]. Rank: 0x00001003. Effective driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [HID_Raw_Inst] in "c:\winnt\inf\input.inf".
#I320 Class GUID of device remains: {745A17A0-74D3-11D0-B6FE-00A0C90F57DA}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "HID\VID_046D&PID_C318&MI_01&COL02\7&3DCDBE1&0&0001".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [HID_Raw_Inst.NT.Interfaces] from "c:\winnt\inf\input.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "HID\VID_046D&PID_C318&MI_01&COL02\7&3DCDBE1&0&0001".
#I121 Device install of "HID\VID_046D&PID_C318&MI_01&COL02\7&3DCDBE1&0&0001" finished successfully.
[2010/01/04 13:10:59 1264.29]
#-198 Command line processed: C:\WINNT\system32\services.exe
#I140 Installing device class: "DriverInterface" {D41DD63A-1395-4419-AE14-A534F5F2AD29}.
#I141 Class install completed with no errors.
[2010/01/04 13:10:59 1264.27 Driver Install]
#-019 Searching for hardware ID(s): logitech_raw_pdo
#-198 Command line processed: C:\WINNT\system32\services.exe
#I022 Found "LOGITECH_RAW_PDO" in C:\WINNT\inf\oem53.inf; Device: "Logitech Driver Interface"; Driver: "Logitech Driver Interface"; Provider: "Logitech"; Mfg: "Logitech"; Section name: "NullInst".
#I023 Actual install section: [NullInst.NT]. Rank: 0x00000000. Effective driver date: 06/17/2009.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [NullInst] in "c:\winnt\inf\oem53.inf".
#I320 Class GUID of device remains: {D41DD63A-1395-4419-AE14-A534F5F2AD29}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of "{C1FCC185-55B3-4E00-814B-C588A13525E1}\VID_046D&PID_C318&REV_5501&MI_00&HIDFILT\8&AEA4138&0&00".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [NullInst.NT.Interfaces] from "c:\winnt\inf\oem53.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of "{C1FCC185-55B3-4E00-814B-C588A13525E1}\VID_046D&PID_C318&REV_5501&MI_00&HIDFILT\8&AEA4138&0&00".
#I121 Device install of "{C1FCC185-55B3-4E00-814B-C588A13525E1}\VID_046D&PID_C318&REV_5501&MI_00&HIDFILT\8&AEA4138&0&00" finished successfully.

USB Driver Installation Troubleshooting Steps for Windows XP / Server 2003

  1. Look in device manager to determine the device that failed to install (with a yellow exclamation mark )
  2. View the properties to determine its hardware and compatible ids
  3. Search setupapi.log for the device installation and examine the output
  4. If no driver was found, search the %SystemRoot%\Inf directory for the vid/pid or compatible id.

In a future article, I will cover the differences for newer versions of Windows (Vista, Server 2008, 7).

  • Share/Bookmark
This entry was posted in troubleshooting and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. mabra
    Posted July 25, 2010 at 7:56 pm | Permalink

    Hi !

    After 12 hours of searching, your post was the absolute hit!!!!
    Much, much thanks!! After copying over a usb.inf my problem was solved!

    br++mabra

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>