The event manager uses two configuration files:
devices and ttys.
These are in the /usr/lib/event directory.
the event devices attached to the system,
and ttys associates event devices with particular
terminals or multiscreens.
In both files, blank lines and lines beginning with a ``#''
character in the first column are comments.
Entries may be continued onto subsequent lines by placing a backslash
at the end of the line.
Entries in the devices file have the following format:
key device class type [ parm=value ... ]
The fields are defined as:
unique identifier (20 characters or less)
used to refer to this entry.
The use of this key
is analogous to the single-letter identifier in
One device can be present in this file in different modes
by giving it multiple entries with unique identifiers.
The ttys file uses these identifiers to select devices.
the absolute pathname of the special device file.
For a serial device it may be the tty device or the
equivalent entry in /dev/mouse;
for a busmouse it is /dev/mouse/busmouse0 or
device class. Valid values are:
relative locator device such as a mouse or trackball.
Such devices generate events when they are moved
relative to its previous position.
The motion of the mouse generates the events,
not the final position of the mouse.
Relative loations are reported
as signed ew-bit quantities.
absolute locator device such as a bitpad or light pen.
These devices are used on a sensitive pad,
and the events are generated by the absolute position
of the pen on the pad,
not the relative motion of the pen.
Absolute locations are reported as
unsigned 32-bit quantities.
string graphic input device such as a keyboard.
Events are generated by pressing a key on the keyboard,
such as an arror key.
any event device not within the previous categories.
class may have a ``b'' appended to indicate
that the device can generate button events.
See ``Buttons'' below for more information.
The class field is used by the library routines
to determine what kind of device is present.
This information is checked
when a program opens an event queue with
Note that some devices can operate in multiple modes.
For example, some mice can function in bitpad mode
with the appropriate bitpad software.
indicates exactly what kind of device this is.
This information is passed into the driver
so that it knows how to build the events.
The keyword in this field must be present
in the event-devices table in
Supported keywords in this field include:
Microsoft serial mouse
Mouse Systems serial mouse
serial mouse mode 0
serial mouse mode 1
serial mouse mode 2
serial mouse mode 3
serial mouse mode 4
serial mouse mode 5
serial mouse mode 6
is a set of string=value pairs
that provide hardware dependent information.
The following keyword strings are recognized:
Valid only for serial devices, provides information about the
serial characteristics of the line. If there are multiple
items specified, they should be quoted by double quotes and
separated by spaces as in STTY=``CS7 1200''.
Valid only for serial devices, defines an initialization string which
is sent to the device after the serial characteristics of the line
are established. The user must be able to open the device for writing.
If the initialization string contains spaces or tabs,
it must be quoted.
Nonprinting characters may be embedded using escaped
octal notation, such as ``\033'' for the Escape character.
Serial devices having multiple modes
must have an initialization string present to put them
into the desired mode. No error will be reported if there is no
initialization string, but there is no guarantee that the device
will operate in the desired mode.
Provides a mechanism whereby locator devices with
varying sensitivities and scales can be made to behave
uniformly. The value is a hexadecimal number.
Locations are multiplied by this value
as they enter the event queue.
Then they are divided (by shifting) by 0x2000.
Using this mechanism,
a device can be made to appear twice as sensitive by
or three-fourths as sensitive
by setting SENSITIVITY=1800.
Possible ratios include:
effective ratioing achieved
Gives the device a name
that is available to the user or applications software.
It may be anything the system administrator
chooses and has no intrinsic definition.
It is not passed into the driver.
For example: NAME=``Microsoft serial mouse''
is an acceptable entry.
The ttys file lists
the terminal-to-event device associations of the system.
Entries in this file are of the form:
device key [ key ... ]
The fields are defined as:
the filename of a terminal device or console multiscreen
the key identifier of a event device described in the
Many event devices have buttons;
others do not.
the <sys/event.h> header file
defines the following constants for referring to buttons:
right button on a 2 or 3-button mouse
middle button on a 3-button mouse
or only button on a 1-button mouse
left button on a 2 or 3-button mouse
Event extracting macros
Events are timestamped as they enter the queue.
This timestamp is accurate to the extent of the clock rate.
The <sys/event.h> header file
defines macros that can be used
to extract information about a specific event
or event queue without knowing the details of its internal structures.
The parameter to these macros
is a pointer to an event.
The macros are:
time, in milliseconds, when the event entered the queue.
tag for device that generated the event.
Valid values are:
The structure of the event is a union of
the possible types of events.
The tag determines the actual structure.
T_STRING and T_OTHER events
have the same structure:
a character array to store the information,
and a byte for the count.
T_ABS_LOCATOR and T_REL_LOCATOR events
have a byte for button state (up or down),
four bytes each for X and Y coordinates,
and space for additional information