windows-nt/Source/XPSP1/NT/base/pnp/tools/devcon/bin/devcon.htm
2020-09-26 16:20:57 +08:00

123 lines
7.7 KiB
HTML

<HTML>
<HEAD>
<TITLE>Text-mode Device Console</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
</HEAD>
<BODY link=#0000ff><FONT face=Verdana size=5>
<H2>DevCon Tool</H2></FONT><FONT face=Verdana size=2>
<P><SPAN style="COLOR: #ff0000; FONT-FAMILY: Arial; FONT-SIZE: 10pt">[This is
preliminary documentation and subject to change.]</SPAN></P>
<H3>SUMMARY</H3>
This document accompanies the &quot;DevCon&quot; tool which is a text-mode device
console. The instructions herein apply to the Windows XP operating
system. DevCon has been designed for use on Windows 2000 and Windows XP. It will
not work on Windows 95, Windows 98 or Windows ME.<p>The &quot;DevCon&quot; tool described in this article is a command line
utility that acts as an alternative to Device Manager. It allows individual
devices or groups of devices to be enabled, disabled, restarted, updated, removed and queried. Devcon provides information that is relevant to the developer and thus not
available in Device Manager.<p>DevCon may not be redistributed, but
is available as a debugging and development tool.</FONT> <font face="Verdana" size="2">The
source code for Devcon can be found at src\setup\devcon along with
documentation and may be freely modified for private use.
<H3>USING DEVCON</H3>
<p>Devcon can be found along with this documentation at tools\devcon. Devcon has
built in help that is displayed by typing &quot;devcon help&quot;. Examples on
how to use devcon are described here.<p>Devcon accepts optional switches (-r for
reboot, -m to specify remote machine), a command and arguments related to that
command. Example DevCon commands are:<p><b>devcon find pci\*</b><p>Find and list
all known PCI devices on the local machine (assuming that a device is PCI if it has
a hardware ID that is prefixed by &quot;PCI\&quot;).<p><b>devcon -m:\\foobar
find pci\*</b><p>Find and list all known PCI devices on the machine &quot;foobar&quot; (-m
allows target machine to be specified. IPC access to machine is required).<p><b>devcon
classes</b><p>List all known setup classes. The output contains the short
non-localized name (e.g. &quot;USB&quot;) and the descriptive name (e.g.
&quot;Universal Serial Bus controllers&quot;).<p><b>devcon listclass usb 1394</b><p>List
all present devices for each class named (in this case USB and 1394).<p><b>devcon find =ports *pnp*</b><p>List
present devices that are a member of the &quot;ports&quot; setup class and
contain &quot;PNP&quot; in their hardware ID.<p><b>devcon find =ports @root\*</b><p>List
present devices that are a member of the &quot;ports&quot; setup class and live
in the &quot;root&quot; branch of the enum tree (i.e., the instance ID is
prefixed by &quot;root\&quot;). Note that programmatically, no assumption should
be made about how an instance ID is formatted, and root devices can be
determined by checking device status bits. However this feature has been
provided in devcon to aid in debugging.<p><b>devcon findall =ports</b><p>Lists
non-present devices along with present devices for the ports class. This will
include devices that have been removed, devices that have been moved from one
slot to another, or, in some cases, devices that have been enumerated
differently due to a BIOS change.<p><b>devcon status @pci\*</b><p>Lists the
status of each present device who's instance ID begins with &quot;pci\&quot;.<p><b>devcon status @ACPI\PNP0501\1</b><p>Lists the status of
a specific device instance, in this case an ACPI enumerated serial port.<p><b>devcon resources =ports</b><p>Lists the resources used by
all devices in the ports setup class.<p><b>devcon driverfiles =ports</b><p>Lists
files that are associated with each device in the ports setup class.<p><b>devcon
stack =ports</b><p>Lists the expected driver stack for the device, including
device and class upper/lower filters as well as the controlling service.<p><b>devcon drivernodes
@ROOT\PCI_HAL\PNP0A03</b><p>Lists all compatible drivers for the device
&quot;ROOT\PCI_HAL\PNP0A03&quot;. This can be used to determine why an in-box INF was
chosen in preference to a third party INF.<p><b>devcon remove @usb\*</b><p>Remove all USB
devices. Devices removed will be listed along with removal status.<p><b>devcon
rescan</b><p>Rescan for new Plug&amp;Play devices.<p><b>devcon update mydev.inf
*pnp0501</b><p>Update all devices that match (exactly) the hardware ID *pnp0501
to use the best driver in mydev.inf associated with the hardware ID *pnp0501.
Note that this will force all devices to use the driver in mydev.inf even if
there is a better match already on the system. This is useful for installing
new versions of drivers during development prior to obtaining a signature. It only
affects
the devices that match the specified hardware ID and not child devices. If the
specified INF is unsigned, Windows may display UI appear confirming that the driver should be
installed. If a reboot is required, it will be reported and devcon will return
with errorlevel of 1. Specifying &quot;-r&quot; will cause a reboot to occur
automatically if one is required.<p><b>devcon -r install %windir%\inf\netloop.inf
*MSLOOP</b><p>Install a new instance of the Microsoft loopback adaptor. Install
will allow a &quot;virtual device&quot; such as the loopback adaptor to be
installed by creating a new root-enumerated device node. Reboot the machine
silently if a reboot is required.<p><b>devcon disable *MSLOOP</b><p>Disable all
devices who's hardware ID ends with &quot;MSLOOP&quot; (including *MSLOOP).<p><b>devcon
enable '*MSLOOP</b><p>Enable all devices who's hardware ID <i>is</i> &quot;*MSLOOP&quot;.
The single quote indicates that the hardware ID must be taken literally.<p><b>devcon
restart =net @'ROOT\*MSLOOP\0000</b><p>Restart the loopback adaptor &quot;ROOT\*MSLOOP\0000&quot;.
The single quote indicates that the instance ID must be taken literally.<h4>Notes</h4>
<ul>
<li>Devcon will return an errorlevel for use in scripts. 0 indicates success.
1 indicates that a reboot is required. 2 indicates a failure. 3 indicates a
syntax error.</li>
<li>If &quot;-r&quot; is specified and a reboot is required, the reboot will
occur without warning once all devices have been processed.</li>
<li>If &quot;-m:\\machine&quot; is specified and the command will not work for
a remote machine, an error will be reported.</li>
<li>Devcon allows wildcards in instance ID's for interactive convenience. No
assumption should be made about the format of an instance ID from machine to
machine and from OS version to OS version.</li>
</ul>
<H3>CODE TOUR</H3>
<H4>File Manifest</H4>
</font><FONT face="Courier" size="3">
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=0 width="916">
<TR><TD width="151" valign="top"><U>File</u></TD><TD width="755"><u>Description<u></TD></TR>
<TR><TD width="151" valign="top"><i>DevCon.htm</i></TD><TD width="755">Sample tour documentation for this binary (this file).</TD></TR>
<tr>
<TD width="151" valign="top"><i>ia64\DevCon.exe</i></TD><TD width="755">64-bit DevCon tool
binary.</TD>
</tr>
<tr>
<TD width="151" valign="top"><i>i386\DevCon.exe</i></TD><TD width="755">32-bit
DevCon tool binary. This will not function completely on 64-bit Windows.</TD>
</tr>
</TABLE>
<H3>FEEDBACK</H3>
<P>We welcome your comments, problem reports and wish-list requests. Please
submit them by pointing your Internet browser to <A href="http://www.microsoft.com/ddk">http://www.microsoft.com/ddk</A>.
</FONT></P>
<P align=center><FONT face=Verdana size=2><A href="#top">Top of page</A></P></FONT>
<TABLE border=0" cellSpacing="0" width="624">
<TR>
<TD bgColor="#00ffff" height="2" vAlign="middle"></TD></TR></TABLE>
<FONT face="MS Sans Serif" size=1>
<P>&copy; Microsoft Corporation 2001</FONT><FONT face=Verdana size=2>
</P></FONT>
</BODY>