views:

148

answers:

2

We have a usb device and the drivers (.inf, libusb.dll, libusb.sys) and can install it using Windows' Device Installation Wizard (by pointing to the .inf file). However, we need to install the drivers without using the wizard (passively, so the user doesn't need to do anything). Does anyone know how this can be achieved?

+2  A: 

You added the "installer" tag, so I'm assuming you're talking about some kind of installation package, like Windows Installer, InstallShield InstallScript, etc.

If that's the case, you should probably use Microsoft's DIFx framework.

DIFx makes it easier for you to create high-quality driver packages, customize the installation of driver packages, allow the installation of driver packages in combination with application software, and use the standard Windows APIs and installation tools. DIFx also makes it easier for end users to diagnose device and driver problems. End users can be confident that, if necessary, drivers can be uninstalled or rolled back.

I've used DIFx from both Windows Installer-based installs and InstallScript installs. Very user-friendly, easy to debug, and effective.

William Leara
That looks promising - we'll look into it and report back.
Pat
Tried to do a pre install, but, when the device was plugged in, I still had to do a manual install. I tried to do an install and was able to get it to work, but only if the device was plugged in when the install was run, which will not always be the case.
Pat
A: 

My colleague came up with an answer that is working very well. It appears that, unless you hardware/driver combination is WHQL signed, the Add New Hardware Wizard will always appear in Win XP. However, with the following method it is possible to have the "Search" button in the wizard find your driver automatically. In Windows 7, there is no prompt and the device installs just fine. You'll need to watch out on 64-bit machines, though, as they have much stricter signing enforcement.

So here is the relevant excerpt from the whole document:

Use the DIFxAPi merge module. The DIFxAPI merge module is included in the WDK in the ‘WDDK//redist\DIFx\DIFxApp\MergeModule\’ directory. The merge module can be included in an MSI package and can be set to install multiple device drivers. Here are the steps to create an MSI with the DIFxAPP merge module:

  1. In the setup folder, create a separate directory in the Application Folder for the driver package and add the driver files to the folder.
  2. Add the DIFxApp.msm to the setup project.
  3. Build the setup
  4. Use Orca to edit the MSI database table and add the INF component to the DIFxAPP merge modules table.
    1. The Orca installation is included in the Windows SDK in the ‘C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin’ directory. (The Windows SDK can be downloaded from Microsoft: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en
    2. Run Orca and select the MSI package that needs to be modified.
      • Read part v. for automation.
    3. In the ‘File’ table, locate the INF file of the driver package you would like to install and copy the Component value.
    4. Create a new row in the MsiDriverPackages table. Add the Component value into Component field. The following flags can be used: (http://msdn.microsoft.com/en-us/library/ff550834.aspx) 0 - Not set (default) 1 – Force installation of driver, even if it the currently installed drivers is a better match than the driver being installed 2 – Suppress message box telling user to plug in devices after the driver has been installed. 4 – Suppress adding an entry in Add/Remove Programs for driver.
      Driver will be uninstalled when main application is uninstalled. 8 – Install unsigned driver packages 16 – Remove driver binaries during uninstall.
    5. Save the MSI. v. In order to automate the process, the editing of the MSI database can be recorded to a Transform and then the Transform can be applied in a post build process.
    6. Open the MSI in Orca.
    7. Select Transform->New Transform
    8. Complete steps 3 and 4 in the above directions.
    9. Select Tranform->Generate transform and save the transform.
    10. Add the following line to the post build of the Setup Project MsiDb.exe -t transform.mst -d $(TargetDir)\DriverInstall.msi Note: MsiDB.exe comes with the Microsoft SDK and is located in C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin
Pat