Hey guys,
I want to use devcon to allow us to unload/load drivers on our machines in the field once we have sent over and installed the latest drivers. We will send an MSI installer ahead of time down to the machine, and execute it, installing the files in the same directory where they were located when the devices were install initially. I then want to use devcon to update the devices with the latest files. I don’t expect the INF file to change (other than the driver version build date).
I have two drivers with the following Vendor/Device Ids (notic one has DEV_0001, and the other has DEV_0002):
- TS_II_BUS driver (PCI\VEN_1015&DEV_0001&REV_01)
- TS_II_Encoder driver (PCI\VEN_1015&DEV_0002&REV_01)
I would like to be able to uninstall/disable/enable/reinstall both drivers separately. I’ve been playing around with devcon, and when I go (for instance) to disable the Encoder driver, I use the following command:
devcon disable PCI\VEN_1015&DEV_0002
But what I see are that both drivers are disabled…It’s like devcon doesn’t care about the DEV_0002, and just looks at the Vendor Id (VEN_1015).
Devcon Output:
C:\Documents and Settings\I2Admin>devcon disable *VEN_1015&DEV_0002
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Disabled
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Disabled
2 device(s) disabled.
‘DEV_0002’ is not recognized as an internal or external command,
operable program or batch file.
Is there a way to distinguish between the two devices based on the Device Id? Am I specifying the device Id incorrectly?
Also, to cleanly uninstall the driver files (including oem*.inf files) and device from the system, should I peform the following sequence?
// Remove TS_II_BUS device:
- devcon remove PCI\VEN_1015&DEV_0001
- devcon dp_delete PCI_VEN_1015&DEV_0001
- devcon dp_add
4. devcon rescan
Or, am I missing something here as well?
Thanks guys!
Jason
Ahh hahh! If I use this device string:
*VEN_1015*DEV_0002
then I’m able to enable/disable the proper device, and both devices aren’t picked up:
C:\Documents and Settings\I2Admin>devcon disable *VEN_1015*DEV_0002
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Disabled
1 device(s) disabled.
C:\Documents and Settings\I2Admin>devcon enable *VEN_1015*DEV_0002
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Enabled
1 device(s) are enabled.
C:\Documents and Settings\I2Admin>devcon disable *VEN_1015*DEV_0001
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Disabled
1 device(s) disabled.
C:\Documents and Settings\I2Admin>devcon enable *VEN_1015*DEV_0001
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Enabled
1 device(s) are enabled.
I would still like clarification on the uninstall/install sequence! 
Best Regards,
Jason
Have you tried using quotes around the PCI\VEN_1015&DEV_0002 string? I bet the DOS CLI is interpreting the DEV_0002 as a sedonc command. That would explain the error about DEV_0002 not being a recognized command and everything with vendor 1015 is disabled.
Greg
— xxxxx@gmail.com wrote:
From: xxxxx@gmail.com
To: “Windows System Software Devs Interest List”
Subject: [ntdev] Devcon operation and Vendor/Device Ids
Date: Wed, 28 Apr 2010 13:45:30 -0400 (EDT)
Hey guys,
I want to use devcon to allow us to unload/load drivers on our machines in the field once we have sent over and installed the latest drivers. We will send an MSI installer ahead of time down to the machine, and execute it, installing the files in the same directory where they were located when the devices were install initially. I then want to use devcon to update the devices with the latest files. I don’t expect the INF file to change (other than the driver version build date).
I have two drivers with the following Vendor/Device Ids (notic one has DEV_0001, and the other has DEV_0002):
- TS_II_BUS driver (PCI\VEN_1015&DEV_0001&REV_01)
- TS_II_Encoder driver (PCI\VEN_1015&DEV_0002&REV_01)
I would like to be able to uninstall/disable/enable/reinstall both drivers separately. I’ve been playing around with devcon, and when I go (for instance) to disable the Encoder driver, I use the following command:
>devcon disable PCI\VEN_1015&DEV_0002
But what I see are that both drivers are disabled…It’s like devcon doesn’t care about the DEV_0002, and just looks at the Vendor Id (VEN_1015).
Devcon Output:
==========
C:\Documents and Settings\I2Admin>devcon disable VEN_1015&DEV_0002
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Disabled
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Disabled
2 device(s) disabled.
‘DEV_0002’ is not recognized as an internal or external command,
operable program or batch file.
Is there a way to distinguish between the two devices based on the Device Id? Am I specifying the device Id incorrectly?
Also, to cleanly uninstall the driver files (including oem.inf files) and device from the system, should I peform the following sequence?
// Remove TS_II_BUS device:
1. devcon remove PCI\VEN_1015&DEV_0001
2. devcon dp_delete PCI_VEN_1015&DEV_0001
3. devcon dp_add
4. devcon rescan
Or, am I missing something here as well?
Thanks guys!
Jason
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Okay, i just went for it, and tested out my uninstall/install sequence, and it looks like it works, except that I don’t need point 2 (devcon dp_delete PCI_VEN1015*DEV_0001).
Step 1:
C:\Documents and Settings\I2Admin>devcon dp_delete PCI\VEN_1015*DEV_0002
Deleting the specified driver package from the machine failed.
devcon failed.
Step 2:
C:\Documents and Settings\I2Admin>devcon dp_add “C:\Program Files\TWC\TSII_Drive
r_Installer\tsii_encoder.inf”
Driver package ‘oem14.inf’ added.
Step 3:
C:\Documents and Settings\I2Admin>devcon rescan
Scanning for new hardware.
Scanning completed.
The device shows back up with the update driver files, and operates properly.
Well, I hope this helps out someone else down the line. Please feel free to offer any suggestions for pitfalls that I might be missing! Thanks for everyone’s replies!
Jason
> But what I see are that both drivers are disabled…It’s like devcon doesn’t care about the DEV_0002,
and just looks at the Vendor Id (VEN_1015).
Devcon Output:
C:\Documents and Settings\I2Admin>devcon disable *VEN_1015&DEV_0002
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Disabled
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Disabled
2 device(s) disabled.
There cannot be any mysteries in DEVCON - its source is provided.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
xxxxx@gmail.com wrote:
I would like to be able to uninstall/disable/enable/reinstall both drivers separately. I’ve been playing around with devcon, and when I go (for instance) to disable the Encoder driver, I use the following command:
> devcon disable PCI\VEN_1015&DEV_0002
>
But what I see are that both drivers are disabled…It’s like devcon doesn’t care about the DEV_0002, and just looks at the Vendor Id (VEN_1015).
Devcon Output:
C:\Documents and Settings\I2Admin>devcon disable *VEN_1015&DEV_0002
PCI\VEN_1015&DEV_0001&SUBSYS_00011015&REV_01\4&19E73414&0&0038: Disabled
PCI\VEN_1015&DEV_0002&SUBSYS_00021015&REV_01\4&31E3ABFC&0&0048: Disabled
2 device(s) disabled.
‘DEV_0002’ is not recognized as an internal or external command,
operable program or batch file.
Is there a way to distinguish between the two devices based on the Device Id? Am I specifying the device Id incorrectly?
Yes, you are, and you SHOULD have been able to catch a clue from the
error message that follows.
“&” is a command separator in Windows command shells, similar to the “;”
in Unix shells. So, I can say:
dir \users & dir \windows\system32 & type \boot.ini
and run three commands at once. So, when you type this:
devcon disable PCI\VEN_1015&DEV_0002
that’s seen as two commands:
devcon disable PCI\VEN_1015
DEV_0002
You need to escape the &, in one of two ways:
devcon disable PCI\VEN_1015^&DEV_0002
or
devcon disable “PCI\VEN_1015&DEV_0002”
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
I totally forgot that I had the source code to devcon…I installed it on my dev box ~1 year ago. 
I case you guys didn’t see my 2nd/3rd posts, I got the uninstall/resintall of those two drivers working w/ devcon.
So, I didn’t mention this before to keep the discussion simple, but my the TS_II_BUS driver actually creates a PDO, which I install my TSII_NDIS mp driver to (a third driver). I’m having difficulty using devcon to install that device driver.
The Device Instance Id is {9cf7c715-2e6b-48b6-8495-4f1418782ab4}\TSIINDIS, which is based on a GUID that I defined, and use when I created the PDO from within the bus driver.
Here’s what I’m doing:
C:\Program Files\TWC\TSII_Driver_Installer>devcon update tsii_ndis.inf “{9cf7c71
5-2e6b-48b6-8495-4f1418782ab4}\TSIINDIS”
Updating drivers for {9cf7c715-2e6b-48b6-8495-4f1418782ab4}\TSIINDIS from C:\Pro
gram Files\TWC\TSII_Driver_Installer\tsii_ndis.inf.
devcon failed.
Devcon acts like it starts to work (waits about a second), and then fails. Before I delve into the source code, is there any reason that this wouldn’t work? I’ve tried several permutations of the string with/without quotes, asterisks, etc.
Best Regards!
Jason
So, I went through the devcon source, and added some debugging info to help me sort this out. It turns out that I had an error in my miniport INF file. The description section had an incorrect hardware Id. Thus, when devcon went to update it, it couldn’t find the appropriate match, and failed. 
So, now I can successfully update my minport driver using devcon update. However, I see that once the update completes successfully, the status of the driver in the Device Manager is:
“Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38) You need to restart your computer before the changes you made to this device will take affect.”
Am I getting this because I’m not cleaning up something in the miniport driver? If I reboot, the driver works fine, but I’d like to be able to update all 3 drivers without a reboot.
Any ideas here?
Best Regards!
Jason
Hmm…since my bus driver is creating a PDO for the mp driver, I’m guessing that I’m not cleaning up the references once the mp driver is unloaded, and the old driver is being left in memory…
It sounds like this error happens where there’s a ref to the device object left around.