#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;
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.