ps2.7 (2010 09)

p
ps2(7) ps2(7)
NAME
ps2, ps2kbd, ps2mouse - PS/2 keyboard/mouse device driver and files
SYNOPSIS
#include <sys/ps2io.h>
DESCRIPTION
The ps2 driver allows the use of IBM Personal System/2 (PS/2) compatible keyboards and mouse devices
on Hewlett-Packard workstations equipped with PS/2 interface hardware.
On systems with a single interface, PS/2 device file names use the following format:
/dev/ps2_n
where n represents the interface port number, ranging from 0 to 15. For example, the device file
/dev/ps2_1 is used to access port one.
On systems with more than one interface, PS/2 device file names use the following format:
/dev/ps2_m.n
where m represents the interface number, and n represents the port number. For example, the device file
/dev/ps2_1.2 is used to access port two on interface one.
At boot time, the
ps2 driver scans all interface ports from port zero to the maximum number of ports
implemented and attempts to identify attached PS/2 devices. The /dev/ps2mouse
device file accesses
the first mouse detected by
ps2. The /dev/ps2kbd device file accesses the first keyboard detected by
ps2.
PS/2 devices are classified as "slow" devices. This means that system calls to
ps2 can be interrupted by
caught signals (see signal (5)).
The mouse may be placed in one of two output modes. In stream mode, the mouse generates a three-byte
report packet in response to mouse movement and/or button presses. These reports can be obtained with
the
read() system call (see read (2)). In prompt mode, an ioctl() request polls the mouse, returning
a three-byte report packet in a buffer whose address is passed as an argument to the
ioctl() call.
PS/2 keyboards return keycodes that represent key-press and key-release events. Use the Internal Ter-
minal Emulator (ITE) to read ASCII characters from PS/2 keyboards. The ASCII terminal interface used
by the ITE is described in termio (7).
The
ps2 driver provides a low-level programming interface to PS/2 keyboards and mice. To access these
devices in a hardware independent way, use the X Window programming environment.
System Calls
The
open() system call gives exclusive access to the specified PS/2 device (see open(2)). If a port is
open, all
open() calls made on that port will fail with errno set to [EBUSY] (see errno(2)).
If an open is attempted on a nonexistent port, the
open() call fails with errno set to [ENXIO].
If no keyboard is detected at system boot and an
open() is attempted on /dev/ps2kbd, or if no mouse
is detected at system boot and an open() is attempted on /dev/ps2mouse, the open() call fails with
errno set to [ENXIO].
Attempts to open an existing
ps2 port with no device connected will succeed.
Upon a successful open, any previously queued input from the device is discarded. Keystrokes are routed
to the ITE by default. While a keyboard is open, ITE does not receive keystrokes from that keyboard;
until the keyboard device is closed, it has exclusive access to keyboard input.
The file status flags
O_NDELAY and O_NONBLOCK can be set to enable nonblocking reads (see open(2)).
read() returns bytes from a PS/2 device. HP-UX maintains a 512-byte buffer for each port. When this
buffer is full, additional bytes received from the device are discarded.
If enough buffered data is available to satisfy the entire number of bytes requested, the
read() call com-
pletes successfully, having read all of the data requested and returning the number of bytes read.
If there is not enough buffered data available to satisfy the entire request, but at least one byte is avail-
able, the
read() call completes successfully, having read all available data and returning the number of
bytes actually read.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (8 pages)