ev_getdev(3event)


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

Synopsis

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_STRING1 and D_OTHER. These values represent classes of graphics input devices. D_REL refers to relative locator devices like mice. 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.

Return values

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.

References

ev_block(3event), ev_close(3event), ev_count(3event), ev_flush(3event), ev_getemask(3event), ev_gindev(3event), ev_init(3event), ev_open(3event), ev_pop(3event), ev_read(3event), ev_resume(3event), ev_setemask(3event), ev_suspend(3event)

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.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004