DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

event(FP)


event -- event manager configuration files

Syntax

#include <sys/event.h>
#include <mouse.h>

Description

The event manager uses two configuration files: devices and ttys. These are in the /usr/lib/event directory. devices defines 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.

devices file

Entries in the devices file have the following format:
   key   device   class   type   [ parm=value ... ]
The fields are defined as:

key
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 gettydefs(F).

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.


device
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 /dev/mouse/busmouse1.

class
device class. Valid values are:

D_REL
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.

D_ABS
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.

D_STRING
string graphic input device such as a keyboard. Events are generated by pressing a key on the keyboard, such as an arror key.

D_OTHER
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 ev_open(S). Note that some devices can operate in multiple modes. For example, some mice can function in bitpad mode with the appropriate bitpad software.


type
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 /etc/conf/cf.d/mevent. Supported keywords in this field include:

Keyword Device
keyboard the keyboard
mousems Microsoft serial mouse
busmouse Any busmouse
mousepc Mouse Systems serial mouse
mousel0 serial mouse mode 0
mousel1 serial mouse mode 1
mousel2 serial mouse mode 2
mousel3 serial mouse mode 3
mousel4 serial mouse mode 4
mousel5 serial mouse mode 5
mousel6 serial mouse mode 6

 Keyword    Device
 keyboard   the keyboard
 mousems    Microsoft serial mouse
 busmouse   Any busmouse
 mousepc    Mouse Systems serial mouse
 mousel0    serial mouse mode 0
 mousel1    serial mouse mode 1
 mousel2    serial mouse mode 2
 mousel3    serial mouse mode 3
 mousel4    serial mouse mode 4
 mousel5    serial mouse mode 5
 mousel6    serial mouse mode 6

parm
is a set of string=value pairs that provide hardware dependent information. The following keyword strings are recognized:

STTY=
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''.

INIT
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.


SENSITIVITY
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 setting SENSITIVITY=4000 or three-fourths as sensitive by setting SENSITIVITY=1800. Possible ratios include:

SENSITIVITY(hex) effective ratioing achieved
800 1/4
1000 1/2
1800 3/4
2000 1
2800 5/4
3000 3/2
3800 7/4
4000 2
6000 3
8000 4

 SENSITIVITY(hex)   effective ratioing achieved
 800                1/4
 1000               1/2
 1800               3/4
 2000               1
 2800               5/4
 3000               3/2
 3800               7/4
 4000               2
 6000               3
 8000               4

NAME
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.

ttys file

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:

device
the filename of a terminal device or console multiscreen

key
the key identifier of a event device described in the devices file.

Buttons

Many event devices have buttons; others do not. the <sys/event.h> header file defines the following constants for referring to buttons:

BUTTON1 RT_BUTTON right button on a 2 or 3-button mouse
BUTTON2 MD_BUTTON middle button on a 3-button mouse or only button on a 1-button mouse
BUTTON3 LT_BUTTON left button on a 2 or 3-button mouse

 BUTTON1   RT_BUTTON   right button on a 2
                       or 3-button mouse
 BUTTON2   MD_BUTTON   middle button on a
                       3-button mouse or
                       only button on a
                       1-button mouse
 BUTTON3   LT_BUTTON   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:


EV_TIME
time, in milliseconds, when the event entered the queue.

EV_TAG
tag for device that generated the event. Valid values are:

T_OTHER

T_BUTTON

T_STRING

T_ABS_LOCATOR

T_REL_LOCATOR

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 (currently unused).


EV_BUFCNT
number of bytes in the buffer

EV_BUTTONS

EV_BUF
pointer to buffer

EV_DX
relative X coordinate

EV_DY
relative Y coordinate

EV_X
absolute X coordinate

EV_Y
absolute Y coordinate

Files

/usr/lib/event/devices
/usr/lib/event/ttys

See also

ev_block(S), ev_close(S), ev_count(S), ev_flush(S), ev_getdev(S), ev_getemask(S), ev_gindev(S), ev_init(S), ev_open(S), ev_pop(S), ev_read(S), ev_resume(S), ev_setemask(S), ev_suspend(S).

``Using the event manager API'' in Developer's Topics.


© 2005 File Formats for Programming (FP)
SCO OpenServer Release 6.0.0 -- 02 June 2005