DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

ev_getdev(S)


ev_getdev -- gets a list of devices feeding an event queue

Syntax

cc . . . -levent

#include  <sys/types.h>
#include  <sys/param.h>
#include  <sys/sysmacros.h>
#include  <sys/page.h>
#include  <sys/event.h>
#include  <mouse.h>

struct devinfo * ev_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 and ev_open. 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_STRING1 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 */
   	short	buttons;
   };

An application can examine this information and decide whether or not to use the device. The ev_gindev routine allows a program to exclude or later re-include a device. The pointer returned by ev_getdev is passed in to ev_gindev.

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

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 does not generate normal stdin input until the event queue is closed.

Standards conformance

ev_getdev is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003