source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/uinput.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 4.9 KB
Line 
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.2     16/10/2004 (Micah Dowty <micah@navi.cx>)
26 *              - added force feedback support
27 *             - added UI_SET_PHYS
28 *      0.1     20/06/2002
29 *              - first public version
30 */
31
32struct uinput_ff_upload {
33        int                     request_id;
34        int                     retval;
35        struct ff_effect        effect;
36};
37
38struct uinput_ff_erase {
39        int                     request_id;
40        int                     retval;
41        int                     effect_id;
42};
43
44/* ioctl */
45#define UINPUT_IOCTL_BASE       'U'
46#define UI_DEV_CREATE           _IO(UINPUT_IOCTL_BASE, 1)
47#define UI_DEV_DESTROY          _IO(UINPUT_IOCTL_BASE, 2)
48
49#define UI_SET_EVBIT            _IOW(UINPUT_IOCTL_BASE, 100, int)
50#define UI_SET_KEYBIT           _IOW(UINPUT_IOCTL_BASE, 101, int)
51#define UI_SET_RELBIT           _IOW(UINPUT_IOCTL_BASE, 102, int)
52#define UI_SET_ABSBIT           _IOW(UINPUT_IOCTL_BASE, 103, int)
53#define UI_SET_MSCBIT           _IOW(UINPUT_IOCTL_BASE, 104, int)
54#define UI_SET_LEDBIT           _IOW(UINPUT_IOCTL_BASE, 105, int)
55#define UI_SET_SNDBIT           _IOW(UINPUT_IOCTL_BASE, 106, int)
56#define UI_SET_FFBIT            _IOW(UINPUT_IOCTL_BASE, 107, int)
57#define UI_SET_PHYS             _IOW(UINPUT_IOCTL_BASE, 108, char*)
58
59#define UI_BEGIN_FF_UPLOAD      _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
60#define UI_END_FF_UPLOAD        _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
61#define UI_BEGIN_FF_ERASE       _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
62#define UI_END_FF_ERASE         _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
63
64/* To write a force-feedback-capable driver, the upload_effect
65 * and erase_effect callbacks in input_dev must be implemented.
66 * The uinput driver will generate a fake input event when one of
67 * these callbacks are invoked. The userspace code then uses
68 * ioctls to retrieve additional parameters and send the return code.
69 * The callback blocks until this return code is sent.
70 *
71 * The described callback mechanism is only used if EV_FF is set.
72 * Otherwise, default implementations of upload_effect and erase_effect
73 * are used.
74 *
75 * To implement upload_effect():
76 *   1. Wait for an event with type==EV_UINPUT and code==UI_FF_UPLOAD.
77 *      A request ID will be given in 'value'.
78 *   2. Allocate a uinput_ff_upload struct, fill in request_id with
79 *      the 'value' from the EV_UINPUT event.
80 *   3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
81 *      uinput_ff_upload struct. It will be filled in with the
82 *      ff_effect passed to upload_effect().
83 *   4. Perform the effect upload, and place the modified ff_effect
84 *      and a return code back into the uinput_ff_upload struct.
85 *   5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
86 *      uinput_ff_upload_effect struct. This will complete execution
87 *      of our upload_effect() handler.
88 *
89 * To implement erase_effect():
90 *   1. Wait for an event with type==EV_UINPUT and code==UI_FF_ERASE.
91 *      A request ID will be given in 'value'.
92 *   2. Allocate a uinput_ff_erase struct, fill in request_id with
93 *      the 'value' from the EV_UINPUT event.
94 *   3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the
95 *      uinput_ff_erase struct. It will be filled in with the
96 *      effect ID passed to erase_effect().
97 *   4. Perform the effect erasure, and place a return code back
98 *      into the uinput_ff_erase struct.
99 *      and a return code back into the uinput_ff_erase struct.
100 *   5. Issue a UI_END_FF_ERASE ioctl, also giving it the
101 *      uinput_ff_erase_effect struct. This will complete execution
102 *      of our erase_effect() handler.
103 */
104
105/* This is the new event type, used only by uinput.
106 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
107 * is the unique request ID. This number was picked
108 * arbitrarily, above EV_MAX (since the input system
109 * never sees it) but in the range of a 16-bit int.
110 */
111#define EV_UINPUT               0x0101
112#define UI_FF_UPLOAD            1
113#define UI_FF_ERASE             2
114
115#ifndef NBITS
116#define NBITS(x) ((((x)-1)/(sizeof(long)*8))+1)
117#endif  /* NBITS */
118
119#define UINPUT_MAX_NAME_SIZE    80
120struct uinput_user_dev {
121        char name[UINPUT_MAX_NAME_SIZE];
122        struct input_id id;
123        int ff_effects_max;
124        int absmax[ABS_MAX + 1];
125        int absmin[ABS_MAX + 1];
126        int absfuzz[ABS_MAX + 1];
127        int absflat[ABS_MAX + 1];
128};
129#endif  /* __UINPUT_H_ */
130
Note: See TracBrowser for help on using the repository browser.