HP-UX Reference (11i v2 07/12) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

p
ps2(7) ps2(7)
(PA-RISC Systems Only)
If both file status flags
O_NDELAY and O_NONBLOCK are clear and no data is available, the read() call
blocks until data becomes available or a signal is received.
If the file status flag
O_NDELAY
is set and no data is available, the read() call returns zero instead of
blocking.
If the file status flag
O_NONBLOCK is set and no data is available, the read() call returns -1 with
errno set to [EAGAIN] (see errno(2)).
The write() system call is not supported by
ps2.
The
select() system call can be used to determine if data is currently available to be read from a
ps2
port. Using select() for write or for exception conditions always returns a false indication in the file
descriptor bit masks (see select(2)).
The ioctl() system call is used to perform special operations on PS/2 mouse and keyboard devices (see
ioctl(2)). The set of ps2 driver ioctl()
requests are divided into three groups: general requests to both
mouse and keyboard, keyboard-specific requests, and mouse-specific requests. Mouse-specific requests used
on keyboards, and keyboard-specific requests used on mice, fail, returning
-1 with errno set to [EIN-
VAL].
Any
ioctl() request (except PS2_PORTSTAT ) used on a port not connected to a PS/2 device will time
out, returning -1 with errno set to [EIO].
All ioctl() system calls use the following syntax:
int ioctl(int fildes, int request, char *arg);
All requests that require parameters or return data use a 4-byte unsigned character buffer addressed by
the arg argument.
The request codes that follow are defined in <sys/ps2io.h>
.
General ioctl() Requests for Both Keyboard and Mouse
PS2_PORTSTAT Return driver status information.
Two bytes of data are returned in the character buffer addressed by arg.
Byte 0, which indicates the type of connected device, can have four possible
values:
PS2_NONE No device is detected.
PS2_MOUSE Mouse is detected.
PS2_KEYBD Keyboard is detected.
PS2_UNKNOWN Unknown device is detected.
Byte 1 contains bit flags for various pieces of driver information. The following
bit masks for this byte are defined in the file
/usr/include/sys/ps2io.h
:
INTERFACE_HAS_ITE
If set, the interface containing this port is used
by the Internal Terminal Emulator (ITE) for
keyboard input.
PORT_HAS_FIRST_KEYBD If set, this port is connected to the first key-
board detected by the driver.
PORT_HAS_FIRST_MOUSE If set, this port is connected to the first mouse
detected by the driver.
All other bits are currently unused, and are cleared to zero.
PS2_DISABLE Disable a PS/2 device.
Further output from the device is prevented by the device itself. This request
does not use arg. Certain devices perform actions in addition to disabling
themselves.
The keyboard resets its internal state to the default state, stops scanning the
keys, and waits for further commands.
The mouse stops transmission of reports, and then disables itself.
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 113