ps2.7 (2010 09)

p
ps2(7) ps2(7)
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 [EINVAL].
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 follow-
ing 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
keyboard 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.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010