共用方式為


Selecting and Deselecting an IEEE 1284 Device Attached to a Parallel Port

A client can select and deselect an IEEE 1284.3 device attached to a parallel port by using the following internal device control requests:

IOCTL_INTERNAL_SELECT_DEVICE

IOCTL_INTERNAL_DESELECT_DEVICE

A kernel-mode driver can also use the system-supplied parallel device callback routines that are obtained by using an IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO request. This request returns a PARALLEL_PNP_INFORMATION structure that includes the following pointers to system-supplied callbacks:

  • The TrySelectDevice member is a pointer to a PPARALLEL_TRY_SELECT_ROUTINE callback, which deselects an IEEE 1284.3 daisy chain device or an IEEE 1284 end-of-chain device that is attached to a parallel port.

  • The DeselectDevice member is a pointer to a PPARALLEL_DESELECT_ROUTINE callback, which selects an IEEE 1284.3 daisy chain device or an IEEE 1284 end-of-chain device that is attached to a parallel port.

The select requests require the least handling by the client because the system-supplied function driver for parallel ports queues the select request for the client if the parallel port is allocated by another client. After the parallel port function driver dequeues the select request, it attempts to allocate the port and to select the IEEE 1284.3 device. The client can cancel a select request at any time because of an acceptable time-out delay or some other device-specific condition.

Note   If a client uses only the PPARALLEL_TRY_SELECT_ROUTINE callback to attempt to select a parallel device, and other clients are contending for the parallel port, the system-supplied function driver for parallel ports might never allocate the port to the client. To ensure success, a client must use an IOCTL_INTERNAL_SELECT_DEVICE request. (The parallel port function driver queues, and subsequently processes, port allocate requests and device select requests in the order in which select device requests are received.)

 

After the parallel port function driver selects an IEEE 1284.3 device for a client, the client has exclusive access to the port and the selected IEEE 1284.3 device. The client must call the PPARALLEL_DESELECT_ROUTINE callback to free the port and deselect the IEEE 1284.3 device. After a client frees the port, the parallel port function driver dequeues a pending request, if any, and processes the request.

Microsoft Windows 2000 supports four daisy chain devices per port; however, Microsoft recommends using at most two daisy chain devices per port. Windows XP supports at most two daisy chain devices per port.

 

 

Send comments about this topic to Microsoft