Wednesday, September 19, 2007

Repair: USB Device Refuses to Initialize

The past few days have been PC hell for me. Some strange behavior has cropped up my my system that has earned it the right to be re-formatted. Since I am traveling however, I don’t have access to my backup drives or my install CD’s for my new system. So in the meantime, I needed to work around the issues I was having.

A few months ago I wrote about Hacking my Motorola Razr to use as a broadband modem while I travel. This has been working great for the past few months, up until about 3 days ago. Now my system has been behaving odd for the past few days. Things like the “Safely remove this Device” icon disappearing. To resolve that I had to go under Device Manager, right-mouse click on any of the USB disks I had (in my case it was my IPod), go to Policies, and manually click on the Safetly Remove Hardware link in the description text. Ever since that issue has not appeared.

However, the issue that has been driving me nuts is the fact that my Razr stopped working. Everytime I would connect it to my machine, I would get the New Hardware Found wizard and an error stating “An error occured during the installation of this device Fatal Error during installation…”. Now I searched and searched for a few days and found nothing but garbage advice. Things like totally remove all USB devices under Device Manager did not resolve this problem (nor do I think they are the correct solution). I cleared every USB device entry under the registry to reinitialize the know USB device catalog (not something I recommend, and even if you do, backup backup backup). This also didn’t fix the issue. I reinstalled the drivers, updated the drivers, yet nothing would get this device to work. I could plug it into another machine and it would work fine. I could even plug it in running VMWare and set VMWare to use it, with VMWare recognizing the device and it working correctly. So that narrows it down to something software related.

So how did I fix the problem? Well, I went back to good old fasion detective work to figure it out, and worked on blind faith and a prayer. I did a search for any files modified within the past day hoping that some sort of log was laying around. What I came across was 2 log files, setupapi.log and setupact.log (information about these files can be found here). When I opened the file I came across the following entry in the setupapi.log:

#-019 Searching for hardware ID(s): usb\vid_22b8&pid_2a62&rev_0001,usb\vid_22b8&pid_2a62
#-018 Searching for compatible ID(s): usb\class_02&subclass_02&prot_01,usb\class_02&subclass_02,usb\class_02
#-198 Command line processed: C:\WINDOWS\system32\services.exe
#I022 Found "USB\VID_22B8&PID_2A62" in C:\WINDOWS\inf\oem44.inf; Device: "Motorola USB Modem"; Driver: "Motorola USB Modem"; Provider: "Motorola"; Mfg: "Motorola"; Section name: "USB1XCDMA".
#I023 Actual install section: [USB1XCDMA.NT]. Rank: 0x00000001. Effective driver date: 06/18/2007.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [USB1XCDMA] in "c:\windows\inf\oem44.inf".
#I320 Class GUID of device remains: {4D36E96D-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 "USB\VID_22B8&PID_2A62\5&B4DCBF&0&2".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [USB1XCDMA.NT.Interfaces] from "c:\windows\inf\oem44.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#E151 Coinstaller 3 of 3 failed. Error 1603: Fatal error during installation.

Huh… what is the CoInstaller? I checked the next file hoping to find another clue:

WdfCoInstaller: [09/18/2007 16:38.06.531] Update process returned error code :error(1603) Fatal error during installation.
. Possible causes are running free version of coinstaller on checked version of OS or vice versa. Look at the Kmdf documentation as to what steps need to be followed to install the correct versionof the coinstaller

What is this? Another clue. So there is definitely a problem with this WdfCoInstaller. A nother search on my system turned up the final clue, a log file called Wdf01005Inst.log. I took a look inside of that:

0.047: 2007/09/18 16:38:06.312 (local)
0.047: c:\6cdccf09bac8c0c517fbc0e694\update\update.exe (version 6.3.4.0)
0.047: Hotfix started with following command line: /quiet
0.047: In Function GetBuildType, line 1170, RegQueryValueEx failed with error 0x2
0.047: C:\WINDOWS\system32\DRIVERS\wdf01000.sys is Present
0.047: FileVersion of C:\WINDOWS\system32\DRIVERS\wdf01000.sys is Greater Than 1.5.5600.0
0.047: Condition Check for Line 1 of PreRequisite returned FALSE
0.047: ReadStringFromInf: UpdSpGetLineText failed: 0xe0000102
0.047: Wdf01005 Setup encountered an error: Setup cannot continue because one or more prerequisites required to install Wdf01005 failed. For More details check the Log File c:\windows\Wdf01005Inst.log
0.062: ReadStringFromInf: UpdSpGetLineText failed: 0xe0000102
0.062: Setup cannot continue because one or more prerequisites required to install Wdf01005 failed. For More details check the Log File c:\windows\Wdf01005Inst.log
0.062: Update.exe extended error code = 0xf0f4
0.062: Update.exe return code was masked to 0x643 for MSI custom action compliance.


This solidifies it, I had tracked down the problem. I made a backup copy of the C:\Windows\system32\Drivers\wdf01000.sys and deleted it. When I re-ran the install, it worked fine. Thanks to logs I was able to track down the issue, not the fall back street level tech resolution of reformat and reinstall OS.

Although I fixed my issues, I am still going to reformat my system. I haven’t installed anything or changed anything that would cause this previously working setup to change, especially something that relies on Kernel Mode drivers. So without any relevant changes to my system, with yet changing behavior, it would leave me to believe something else is afoot. So better safe than sorry. time, unfortunately, is not something I have the luxury of having at the moment to track down issues.