## Pen for OS/2 Device Driver Reference

[prev][next][parent][TOC]

### Calibration Program

The Pen for OS/2 component of IBM Developer Connection Device Driver Kit for OS/2 provides a sample calibration program to supply alignment adjustments for the position of the digitizer in relation to the display panel. The program aligns the location of the pointer seen on the display to be the same as where the actual pen device touches the display.

     [Artwork not shown]

The program provides the following functions:

OK Accept new alignment.

Align Collect alignment data and calculate adjustments used by the pen driver.

Defaults Reset the alignment adjustment to those shipped in the driver.

Test Test alignment using a target for the mouse pointer.

Cancel Restore alignment to the alignment when the program started.

Alignment data is collected by instructing the user to place the locator in the center of a target at each corner of the screen as shown in the preceding figure. The target moves to the next corner of the screen after the program has collected enough samples to get a valid position.

The program consists of two threads: a PM thread and an alignment thread. The PM thread executes in a standard PM window procedure and handles routine PM messages and messages from the alignment thread. The alignment thread processes three commands from the PM thread: (1) align; (2) cancel an alignment; and (3) terminate. The alignment thread controls the screen by sending messages to the PM thread to paint a target in a rectangle. Points in the rectangle are ignored by the PM thread but are collected by the alignment thread. Points outside the rectangle are ignored by the alignment thread but used by the PM thread to control the selection of operations through the button controls.

The calibration program can be invoked from the device object associated with it or from the command line in the following form:

    --------------------------------------------------------------------------

    cal driver_name device_name

    --------------------------------------------------------------------------

where:

driver_name is the name of the hardware; for example, "IBM Color Workpad".

device_name is the name of the device; for example, pen.

Note: The input parameters must be put in quotes if spaces occur in the names.

When making changes to the calibration program, a debug mechanism is available. If a file named pencal.log exists, debug information is written to it. This is helpful for determining what data is being collected and used to do the calibration. Libraries and headers from Pen for OS/2 Developer's Toolkit are required to build this program.