Plug and Play Printer Installation

The first time Windows 95 detects a printer connected locally to the Windows 95 computer through a parallel port, Windows 95 attempts a device ID negotiation with the printer as described in the IEEE 1284 specification. If the printer is a bi-directional printer and responds appropriately, Windows 95 will install the required printer drivers as listed in the INF file for the device.

The required printer drivers are determined by finding a match between the values returned by the device and the values in an INF file containing information about the required printer support.

Benefits of Printer Plug and Play Installation

For the Windows 95 computer user, installing printer support is as easy as it gets. Windows 95 will detect a newly attached printer when Windows 95 starts up, or when the user requests Windows 95 to detect new devices, and use the INF file contents as a script for automatically installing printer support. Depending upon the INF file contents, Windows 95 may prompt the user during this process.

A user requests detection of new devices by using the Add New Hardware icon in the Windows 95 Control Panel.

Printer Plug and Play Installation Requirements

This section outlines the minimum hardware and software requirements for parallel port devices to obtain Plug and Play support under Windows 95. The term Plug and Play is defined here as the ability to attach an I/O device to a host and enable the host to determine that the device has been added, identify it, and either automatically install the necessary device drivers or prompt the user for a diskette containing them.

To offer parallel port Plug and Play capability, the host

To support Plug and Play, the device connected to the parallel port must offer capabilities in three different areas:

Device Hardware Capabilities

To participate in Windows 95 Plug and Play, a parallel port device

Device Software Capabilities

To participate in Plug and Play, a parallel port device

Device Identification Capabilities

To participate in Plug and Play, in general a parallel port device

Requirements for reporting device IDs are described in Section 6.6 of the IEEE 1284 specification. Six keys that can be returned by a device are described and these are identified in the following table:

Key

Abbreviation

Comment

MANUFACTURER

MFG

The MFG key value is used in combination with the MDL key value to generate a unique device ID for Plug and Play parallel devices for Windows 95. For more information about this, see the section "Generating Unique Plug and Play Device IDs."

COMMAND SET

CMD

This key is ignored by Windows 95 for parallel port devices.

MODEL

MDL

See the comment about the MFG key.

CLASS

CLS

PRINTER is one value this key can have in Windows 95.

DESCRIPTION

DES

The DES key value is a string, up to 128 characters long, that may be presented to the user to describe the device if an INF file cannot be found for the device.

COMPATIBLE ID

CID

The value(s) in this key effectively identifies device drivers that are compatible with the device being identified. If the device is not compatible with another device or the device manufacturer does not want to use a compatible device driver with the device, this key will be empty. For more information, see the section "Using CID Values."


Generating Unique Plug and Play Device IDs

The Windows 95 parallel port enumerator (LPTENUM) generates a unique Plug and Play device ID by combining the MANUFACTURER and MODEL key values that are always returned by the device:

1. The MANUFACTURER key value and MODEL key values are concatenated and a 4-digit checksum generated from the resulting string.

2. After the checksum is generated, the concatenated string is truncated to 20 characters if necessary.

3. The checksum is converted to a 4-character string and appended to the concatenated, and possibly truncated, string resulting in a device ID string of not more than 24 characters.

For example, if a printer MFG key value is "Hewlett-Packard" and the MDL key value is "HP LaserJet 4P" then the device ID that is generated is "Hewlett-PackardHP_La7EE2." (The algorithm used to calculate the checksum is beyond the scope of this document.)

When "LPTENUM\" is prepended to the device ID such as the one given in the example above, this is the device's Plug and Play ID value used by the Windows 95 parallel port enumerator. The example Plug and Play ID is "LPTENUM\Hewlett-PackardHP_La7EE2."

The Plug and Play ID is used to search all known device information files (INF files) on a particular host for a driver that will support the device. The order in which device IDs are listed in the INF file is important in determining which device driver named in the INF file is the best match for the device. For examples of how to order the lists of device IDs in INF files, see the section "Ordering of Device ID and Compatible Device ID Values."

Using CID Values

The value returned in the COMPATIBLE ID (CID) key by a printer may have any value listed in an INF file, as described in the section "Generating Unique Plug and Play Device IDs." Plug and Play IDs assigned to legacy parallel port devices which have driver support in Windows 95 may also be returned.

The CID values returned by a printer should be carefully chosen by printer vendors. If your device returns a CID which is an exact match for a device ID for another vendor's device, ensure you have license rights from the device driver manufacturer to install the compatible device driver. Microsoft will provide CID values for many of the printer drivers shipped with Windows 95 and vendors are encouraged to freely use those values in the CID keys returned by their printers.

The syntax of the string returned from a printer as a CID value is important and will differ slightly depending upon what the printer is reporting itself being compatible with:

For example, suppose the INF file contains the following entry:


"Sample Printer"=X.DRV,LPTENUM\Sample_Printer_CompaAAA2

This INF file entry describes a printer that displays the printer name "Sample Printer," is supported by the driver X.DRV. The procedure described in the section "Generating Unique Plug and Play Device IDs" generates the device ID "Sample_Printer_CompaAAA2." The Plug and Play device ID has the enumerator prepended to it, resulting in "LPTENUM\Sample_Printer_CompaAAA2."

For another parallel port device to report itself as compatible with the device described in this INF file entry, it must report a CID keyword value of


LPTENUM\Sample_Printer_CompaAAA2

If the INF file entry had the alternate form of


"Sample Printer"=X.DRV,LPTENUM\Sample_Printer_CompaAAA2, Sample_Printer_CompaAAA2

then the device could alternately report itself as


Sample_Printer_CompaAAA2

Note that the very first time Windows 95 is started on a computer, the way CID values are handled differs from the way they are handled for all subsequent start ups. For more information, see the section "Ordering of Device ID and Compatible Device ID Values."

A printer which is compatible with the HP LaserJet 4L, and for which the vendor has the necessary rights to use a driver provided by another vendor, returns the following CID key value:


LPTENUM\Hewlett-PackardLaserC029

In order to use this CID value, you must have legal rights to install the printer driver provided by the other vendor (in this example case, Hewlett-Packard).

A printer which is compatible with the HP LaserJet 4L and which uses the driver provided by Microsoft returns the following CID key value:


HP_LaserJet_4L

Multiple Emulation Device Requirements

It is becoming more common for printers to support multiple page description languages (for example, both HP-PCL and PostScript). Each of these page description languages require separate printer drivers. It is also possible for devices to have multiple functions, such as printer and fax or printer and SCSI drive.

In general, however, Windows 95 Plug and Play maps a single device ID for a given device to a single device driver. This section describes how a single device ID can be mapped to multiple device drivers.

Multiple Device Drivers Installed with the Printer Class Installer

The Windows 95 printer class installer provides a way for device vendors to supply their own DLLs to install multiple drivers for one device. There are two methods, each of which requires the use of a printer-specific extension in the INF file for the device.

Multiple Device Drivers Installed with the Serial Port Bus Enumerator

The serial port bus enumerator provides a way for a device to report multiple device ID values, each of which maps to a specific device driver.

The parallel port bus enumerator does not support the ability to enumerate multiple device ID values.

Ordering of Device ID and Compatible Device ID Values

As described earlier, the compatible device ID (CID) for a printer provides the IDs of the other devices with which the printer is compatible. The operating system uses this information to load compatible device drivers, if necessary. There can be several CIDs for each logical device. The order in which these CIDs are listed in an INF file may be used by the operating system as a criteria for determining which driver to search for and load first.

The ordering scheme assigns a numeric "rank" value to each CID value and a driver with lower rank-order CID is considered by the operating system to be a better match for the device than a driver with a CID of higher-rank order. A driver with a CID with rank order of 0 is considered an exact match to the printer and when the driver identified by this CID is found it is automatically installed without prompting the user.

If a rank order 0 match is not found and a higher-order rank match is found, then the user is prompted with the information that a compatible device driver is available. At this point, the user is responsible for installing the most compatible driver available. If the user has a diskette with the rank order 0 driver on it, or some other driver the user believes is more compatible than the one found on the system and identified in the user dialog, then the user can insert that diskette and specify the driver to be installed from there. If the user does not have a more compatible driver on a diskette, the user may either OK the installation of the most compatible driver the system could find or select another printer driver from a list of printer drivers found by the system.

Note that there may be an extra step in the procedure described above if the device being installed does not provide the information about what class of devices it belongs to. In that case, the user will be prompted to provide the device class and the procedure described above will occur after the user responds that a printer is being installed.

Rank ordering is determined as follows:

1. Assign "device rank orders" to the device IDs returned by the device. The device ID derived from the MFG and MDL key values returned by the device is assigned device rank order 0, the first CID returned by the device is assigned rank device order 1, the second CID returned by the device is assigned device rank order 2, and so on.

2. The contents of the INF files on the host are searched for any matches with any of the device IDs returned by the device.

3. Each time an exact match is found between a device ID in an INF file and a device ID returned by the device, an "INF rank order" is determined using the following rule: if the matching device ID in the INF file is the first one listed after the INF file Install section name, then the INF rank order is 0; if the matching device ID in the INF file is the second one listed after the Install section name, then the INF rank order is 1; and so on.

4. After all the INF files are searched and all the matches are found and each match is assigned a device ID rank order and an INF file rank order, add the values of the two rank orders for each match.

5. If this is the very first time the Windows 95 system has started up on this host, then automatically load the driver with the lowest-valued rank order sum without prompting the user. If this is not the very first time Windows 95 has started up, if one of the resulting rank order sums is 0, install that driver without prompting the user. Otherwise, prompt the user with the identity of the driver with the lowest-valued rank order sum and give the user a chance to provide a better matched driver on a diskette or select another printer from a list presented by the system. If the user does not provide a diskette, either the driver with the lowest-valued rank order is installed or the driver for the printer the user selects is installed.

For example, suppose an INF file on the host contains the following statements:


"Sample Printer 1" = X1.DRV,LPTENUM\Sample_Printer_CompaAAA2,Sample_Printer_CompaBBB2
"Sample Printer 2" = X2.DRV,LPTENUM\Sample_Printer_CompaCCC2,LPTENUM\Sample_Printer_CompaDDD2,Sample_Printer_CompaEEE2

And suppose the device returns the following Plug and Play device ID (derived from the MFG and MDL key values returned by the device as described in section "Generating Unique Plug and Play Device IDs") and CIDs:


Device ID="LPTENUM\Sample_Printer_CompaCCC2"
CID=LPTENUM\Sample_Printer_CompaAAA2,Sample_Printer_CompaBBB2

The result of applying the matching and rank ordering rules to the example above is that "Sample_Printer_2" has a device ID rank order of 0 and an INF rank order of 0, so the driver X2.DRV is automatically loaded without prompting the user.

For another example, suppose an INF file on the host contains the following statements:


"Sample Printer 1" = X1.DRV,LPTENUM\Sample_Printer_CompaAAA2,Sample_Printer_CompaBBB2
"Sample Printer 2" = X2.DRV,LPTENUM\Sample_Printer_CompaCCC2,LPTENUM\Sample_Printer_CompaDDD2,Sample_Printer_CompaEEE2
"Sample Printer 3" = X3.DRV,LPTENUM\Sample_Printer_CompaFFF2,LPTENUM\Sample_Printer_CompaGGG2,Sample_Printer_CompaHHH2

And suppose the device returns the following Plug and Play device ID (derived from the MFG and MDL key values returned by the device) and CIDs:


Device ID="LPTENUM\Sample_Printer_CompaDDD2"
CID=LPTENUM\Sample_Printer_CompaHHH2,Sample_Printer_CompaBBB2

The result of applying the matching and rank ordering rules to the example above is that there is no rank order 0 match found. "Sample_Printer_2" (X2.DRV) has a rank order sum value of 1, "Sample_Printer_1" (X1.DRV) has a rank order sum of 3, and "Sample_Printer_3" (X3.DRV) has a rank order sum of 3.

If this is the very first time Windows 95 is run on the host, then X2.DRV is automatically installed without prompting the user. Otherwise, the user is prompted that X2.DRV will be installed as the printer driver unless the user inserts a diskette with a driver better matched to the printer (this diskette will probably have been provided by the printer vendor).