EV_GETDEV(S) UNIX System V EV_GETDEV(S)
Name
ev_getdev - gets a list of devices feeding an event queue
Syntax
#include <types.h>
#include <param.h>
#include <sysmacros.h>
#include <page.h>
#include <event.h>
#include <mouse.h>
struct devinfo * getdev(dev_mask, devinfop)
dmask_t dev_mask;
struct devinfo *devinfop;
Description
ev_getdev allows a program to examine the devices that are
attached to its event queue. An open event queue must have
been previously obtained with ev_init(S) and ev_open(S).
This routine takes two arguments, a bitmask of device
classes and a pointer to a device_info structure. The device
mask indicates the classes of devices in which the program
is interested. The device pointer is used to cycle through
the devices attached to the queue.
The device mask is made by OR'ing together a subset of
D_REL, D_ABS, D_STRING and D_OTHER. These values represent
classes of graphics input devices. D_REL refers to relative
locator devices like mice. D_ABS refers to absolute locator
devices like bitpads and lightpens. D_STRING refers to
character stream devices like the keyboard.
The device pointer parameter is NULL for the first call.
Each call returns a pointer which should be passed in in
subsequent calls. When the routine has iterated through all
the devices attached to the queue, it returns NULL.
The device information pointer points to a structure which
looks like this:
struct devinfo {
short handle; /* not used by application */
short class; /* REL, ABS, STRING or OTHER */
short type; /* The type of hardware */
char *name; /* Device name, from data files */
char *key; /* Device key, from data files */
};
An application can examine this information and decide
whether or not to use the device. The ev_gindev(S) routine
allows a program to exclude or later re-include a device.
The pointer returned by ev_getdev is passed in to
ev_gindev(S).
When a queue is opened, a bitmask specifying what kinds of
devices to attach is supplied. All devices of a class which
is masked in are attached to the queue. This routine is used
to examine those devices.
Diagnostics
This routine returns -1 to a program which does not have an
open event queue. It returns -2 if no devices of any class
which is masked in are found. Normally it returns zero.
See Also
ev_block(S), ev_close(S), ev_count(S), ev_flush(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)
Notes
This routine must be linked in with the -levent linker
option.
The keyboard is attached to an event queue whenever devices
of class D_STRING are requested. If the keyboard is
attached to an event queue, then the keyboard will not
generate normal stdin input, until the event queue is
closed.
(printed 6/20/89)