#ifndef XFree86LOADER
#include <unistd.h>
#include <errno.h>
#endif
#include <misc.h>
#include <xf86.h>
#define NEED_XF86_TYPES
#if !defined(DGUX)
#include <xf86_ansic.h>
#include <xisb.h>
#endif
#include <xf86_OSproc.h>
#include <xf86Xinput.h>
#include <exevents.h>
#include <keysym.h>
#include <mipointer.h>
#ifdef XFree86LOADER
#include <xf86Module.h>
#endif
#define MAXBUTTONS 3
static KeySym void_map[] =
{
NoSymbol,
NoSymbol,
NoSymbol,
NoSymbol,
NoSymbol,
NoSymbol,
NoSymbol,
NoSymbol
};
static KeySymsRec void_keysyms = {
void_map, 8, 8, 1
};
static const char *DEFAULTS[] = {
NULL
};
static int
xf86VoidControlProc(DeviceIntPtr device, int what)
{
InputInfoPtr pInfo;
unsigned char map[MAXBUTTONS + 1];
int i;
pInfo = device->public.devicePrivate;
switch (what)
{
case DEVICE_INIT:
device->public.on = FALSE;
for (i = 0; i < MAXBUTTONS; i++) {
map[i + 1] = i + 1;
}
if (InitButtonClassDeviceStruct(device,
MAXBUTTONS,
map) == FALSE) {
ErrorF("unable to allocate Button class device\n");
return !Success;
}
if (InitFocusClassDeviceStruct(device) == FALSE) {
ErrorF("unable to init Focus class device\n");
return !Success;
}
if (InitKeyClassDeviceStruct(device, &void_keysyms, NULL) == FALSE) {
ErrorF("unable to init key class device\n");
return !Success;
}
if (InitValuatorClassDeviceStruct(device,
2,
xf86GetMotionEvents,
0,
Absolute) == FALSE) {
InitValuatorAxisStruct(device,
0,
0, 1,
1,
0,
1);
InitValuatorAxisStruct(device,
1,
0, 1,
1,
0,
1);
ErrorF("unable to allocate Valuator class device\n");
return !Success;
}
else {
xf86MotionHistoryAllocate(pInfo);
}
break;
case DEVICE_ON:
device->public.on = TRUE;
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
device->public.on = FALSE;
break;
}
return Success;
}
static void
xf86VoidUninit(InputDriverPtr drv,
InputInfoPtr pInfo,
int flags)
{
xf86VoidControlProc(pInfo->dev, DEVICE_OFF);
}
static InputInfoPtr
xf86VoidInit(InputDriverPtr drv,
IDevPtr dev,
int flags)
{
InputInfoPtr pInfo;
if (!(pInfo = xf86AllocateInput(drv, 0)))
return NULL;
pInfo->name = dev->identifier;
pInfo->type_name = "Void";
pInfo->flags = XI86_KEYBOARD_CAPABLE | XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
pInfo->device_control = xf86VoidControlProc;
pInfo->read_input = NULL;
pInfo->motion_history_proc = xf86GetMotionEvents;
pInfo->history_size = 0;
pInfo->control_proc = NULL;
pInfo->close_proc = NULL;
pInfo->switch_mode = NULL;
pInfo->conversion_proc = NULL;
pInfo->reverse_conversion_proc = NULL;
pInfo->fd = -1;
pInfo->dev = NULL;
pInfo->private_flags = 0;
pInfo->always_core_feedback = 0;
pInfo->conf_idev = dev;
xf86CollectInputOptions(pInfo, DEFAULTS, NULL);
xf86ProcessCommonOptions(pInfo, pInfo->options);
pInfo->flags |= XI86_CONFIGURED;
return (pInfo);
}
#ifdef XFree86LOADER
static
#endif
InputDriverRec VOID = {
1,
"void",
NULL,
xf86VoidInit,
xf86VoidUninit,
NULL,
0
};
#ifdef XFree86LOADER
static void
xf86VoidUnplug(pointer p)
{
}
static pointer
xf86VoidPlug(pointer module,
pointer options,
int *errmaj,
int *errmin)
{
xf86AddInputDriver(&VOID, module, 0);
return module;
}
static XF86ModuleVersionInfo xf86VoidVersionRec =
{
"void",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XF86_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_XINPUT,
ABI_XINPUT_VERSION,
MOD_CLASS_XINPUT,
{0, 0, 0, 0}
};
XF86ModuleData voidModuleData = {&xf86VoidVersionRec,
xf86VoidPlug,
xf86VoidUnplug};
#endif