Initial skeleton structure
[xf86-input-tuio.git] / src / tuio.c
blobd6e4724ab1f30926b6391afd805ef351a49e4593
1 /*
2 * Copyright (c) 2009 Ryan Huffman
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
22 * Authors:
23 * Ryan Huffman (ryanhuffman@gmail.com)
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #include <errno.h>
29 #include <fcntl.h>
31 #include <xorg/xf86.h>
32 #include <xorg-server.h>
33 #include <xf86Xinput.h>
34 #include <exevents.h>
35 #include <xorgVersion.h>
36 #include <X11/extensions/XIproto.h>
37 #include <X11/extensions/XInput2.h>
38 #include <xf86_OSlib.h>
40 #include "tuio.h"
42 #ifdef HAVE_CONFIG_H
43 #include "config.h"
44 #endif
46 /* Module Functions */
47 static pointer
48 TuioPlug(pointer, pointer, int *, int *);
50 static void
51 TuioUnplug(pointer);
53 /* Driver Function */
54 static InputInfoPtr
55 TuioPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
57 static XF86ModuleVersionInfo TuioVersionRec =
59 "tuio",
60 MODULEVENDORSTRING,
61 MODINFOSTRING1,
62 MODINFOSTRING2,
63 XORG_VERSION_CURRENT,
64 PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL,
65 ABI_CLASS_XINPUT,
66 ABI_XINPUT_VERSION,
67 MOD_CLASS_XINPUT,
68 {0, 0, 0, 0}
71 _X_EXPORT InputDriverRec TUIO =
74 "tuio",
75 NULL,
76 TuioPreInit,
77 TuioUnInit,
78 NULL,
82 _X_EXPORT XF86ModuleData tuioModuleData =
84 &TuioVersionRec,
85 TuioPlug,
86 TuioUnplug
89 static pointer
90 TuioPlug(pointer module,
91 pointer options,
92 int *errmaj,
93 int *errmin)
95 xf86AddInputDriver(&TUIO, module, 0);
96 return module;
99 static void
100 TuioUnplug(pointer p)
104 static void
105 TuioReadInput(InputInfoPtr pInfo)
109 static int
110 TuioControl(DeviceIntPtr device, int what)
112 return 1;
115 static InputInfoPtr
116 TuioPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
118 InputInfoPtr pInfo;
119 const char *device;
121 if (!(pInfo = xf86AllocateInput(drv, 0)))
122 return NULL;
124 return pInfo;
127 static void
128 TuioUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)