PDRREF:Port Drivers

Port drivers are dynamic link libraries (DLLs) that contain a set of 32-bit functions, which provide helper functions for the spooler and Workplace Shell. The file type of a port driver is ".PDR".

There are two types of port drivers-the "old-style" port drivers written to run under OS/2 Version 2.x, and the "new-style" port drivers that will run only on versions of OS/2 that contain the bidirectional print spooler (OS/2 Warp, Version 3 and higher). See the "Bidirectional Communications" chapter in the Printer Device Driver Reference for Os/2 for a description of the bidirectional spooler and its new interfaces.

The OS/2 2.x port driver DLLs required a physical port device driver (.SYS file) installed in the CONFIG.SYS file. These port drivers were only called at the beginning (SplPdInitPort) and at the end (SplPdTermPort) of each print job being sent to the port.

The OS/2 Warp, Version 3 port driver interface passes all print job data to the port driver and allows the port driver to return information returned by the printer. SplPdInitPort and SplPdTermPort are no longer necessary. Applications and print drivers can use the new PrtQuery API to get information about the printer. This API is useful for the printer driver when displaying its printer properties. See PrtQuery in Device Support Function Reference for a description of the API, its format and syntax. The file type of a port driver is .PDR.

The operating system, by default, provides two port drivers; SERIAL.PDR supports COM1 - 4, and PARALLEL.PDR supports LPT1 - 3. For any other port, the supplier of the physical port software is responsible for providing a Presentation Manager port driver if it is necessary.

The functions exported from a port driver are:


 * SplPdEnumPort
 * SplPdGetPortIcon
 * SplPdInitPort
 * SplPdInstallPort
 * SplPdQueryPort
 * SplPdRemovePort
 * SplPdSetPort
 * SplPdTermPort

OS/2 Warp, Version 3 port drivers must export the following APIs to replace SplPdInitPort and SplPdTermPort:


 * SplPdOpen
 * SplPdWrite
 * SplPdClose
 * SplPdAbortDoc
 * SplPdNewPage
 * SplPdQuery
 * SplPdSet

OS/2 Warp, Version 3 port drivers can export the following optional APIs:
 * SplPdResetAbort
 * SplPdSendCmd
 * SplPdRemoteSetPort

OS2SYS.INI File Structure
The contents of the INI file section for ports is as follows:


 * Port driver PDR installation:

appname: PM_PORT_DRIVER keyname:  value:

For example:

PM_PORT_DRIVER, SERIAL,   C:\OS2\DLL\SERIAL.PDR PARALLEL, C:\OS2\DLL\PARALLEL.PDR EXTLPT,   C:\OS2\DLL\EXTLPT.PDR

This is written by the Workplace Shell during installation.

appname: PM_ keyname: DESCRIPTION   value: keyname: INITIALIZATION value: keyname: TERMINATION   value: keyname: PORTDRIVER    value: keyname: TIMEOUT       value:
 * Ports known to the system:

For example:

PM_COM1, DESCRIPTION,       Serial Port COM1; PM_COM1, INITIALIZATION,    9600;0;W;8;1; PM_COM1, TERMINATION,       ; PM_COM1, PORTDRIVER,        SERIAL; PM_COM1, TIMEOUT,           45;

For compatibility, the existing port structure is also supported by all port drivers.

appname: PM_SPOOLER_PORT keyname: value: 

For example: PM_SPOOLER_PORT, LPT1,   ; COM1,   9600;0;W;8;1;

The port driver is expected to maintain its own sections in the OS2SYS.INI file. The format of the values stored under the keynames INITIALIZATION and TERMINATION is port-driver specific. Also, the port driver might need to hold extra data under the PM_ appname.

For a complete description of each of the functions listed in this chapter, see Device Support Function Reference. The functions are listed alphabetically in the index table for that chapter.