ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / uinput.h
1 #ifndef __UINPUT_H_
2 #define __UINPUT_H_
3 /*
4  *  User level driver support for input subsystem
5  *
6  * Heavily based on evdev.c by Vojtech Pavlik
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
23  * 
24  * Changes/Revisions:
25  *      0.1     20/06/2002
26  *              - first public version
27  */
28 #ifdef __KERNEL__
29 #define UINPUT_MINOR            223
30 #define UINPUT_NAME             "uinput"
31 #define UINPUT_BUFFER_SIZE      16
32
33 /* state flags => bit index for {set|clear|test}_bit ops */
34 #define UIST_CREATED            0
35
36 struct uinput_device {
37         struct input_dev        *dev;
38         unsigned long           state;
39         wait_queue_head_t       waitq;
40         unsigned char           ready,
41                                 head,
42                                 tail;
43         struct input_event      buff[UINPUT_BUFFER_SIZE];
44 };
45 #endif  /* __KERNEL__ */
46
47 /* ioctl */
48 #define UINPUT_IOCTL_BASE       'U'
49 #define UI_DEV_CREATE           _IO(UINPUT_IOCTL_BASE, 1)
50 #define UI_DEV_DESTROY          _IO(UINPUT_IOCTL_BASE, 2)
51 #define UI_SET_EVBIT            _IOW(UINPUT_IOCTL_BASE, 100, int)
52 #define UI_SET_KEYBIT           _IOW(UINPUT_IOCTL_BASE, 101, int)
53 #define UI_SET_RELBIT           _IOW(UINPUT_IOCTL_BASE, 102, int)
54 #define UI_SET_ABSBIT           _IOW(UINPUT_IOCTL_BASE, 103, int)
55 #define UI_SET_MSCBIT           _IOW(UINPUT_IOCTL_BASE, 104, int)
56 #define UI_SET_LEDBIT           _IOW(UINPUT_IOCTL_BASE, 105, int)
57 #define UI_SET_SNDBIT           _IOW(UINPUT_IOCTL_BASE, 106, int)
58 #define UI_SET_FFBIT            _IOW(UINPUT_IOCTL_BASE, 107, int)
59
60 #ifndef NBITS
61 #define NBITS(x) ((((x)-1)/(sizeof(long)*8))+1)
62 #endif  /* NBITS */
63
64 #define UINPUT_MAX_NAME_SIZE    80
65 struct uinput_user_dev {
66         char name[UINPUT_MAX_NAME_SIZE];
67         struct input_id id;
68         int ff_effects_max;
69         int absmax[ABS_MAX + 1];
70         int absmin[ABS_MAX + 1];
71         int absfuzz[ABS_MAX + 1];
72         int absflat[ABS_MAX + 1];
73 };
74 #endif  /* __UINPUT_H_ */
75