aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/uinput.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/uinput.h')
-rw-r--r--include/linux/uinput.h114
1 files changed, 6 insertions, 108 deletions
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 2aa2881b0df..0a4487d3fb1 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -1,5 +1,3 @@
1#ifndef __UINPUT_H_
2#define __UINPUT_H_
3/* 1/*
4 * User level driver support for input subsystem 2 * User level driver support for input subsystem
5 * 3 *
@@ -31,12 +29,11 @@
31 * 0.1 20/06/2002 29 * 0.1 20/06/2002
32 * - first public version 30 * - first public version
33 */ 31 */
32#ifndef __UINPUT_H_
33#define __UINPUT_H_
34 34
35#include <linux/input.h> 35#include <uapi/linux/uinput.h>
36
37#define UINPUT_VERSION 3
38 36
39#ifdef __KERNEL__
40#define UINPUT_NAME "uinput" 37#define UINPUT_NAME "uinput"
41#define UINPUT_BUFFER_SIZE 16 38#define UINPUT_BUFFER_SIZE 16
42#define UINPUT_NUM_REQUESTS 16 39#define UINPUT_NUM_REQUESTS 16
@@ -44,14 +41,14 @@
44enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED }; 41enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
45 42
46struct uinput_request { 43struct uinput_request {
47 int id; 44 unsigned int id;
48 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ 45 unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
49 46
50 int retval; 47 int retval;
51 struct completion done; 48 struct completion done;
52 49
53 union { 50 union {
54 int effect_id; 51 unsigned int effect_id;
55 struct { 52 struct {
56 struct ff_effect *effect; 53 struct ff_effect *effect;
57 struct ff_effect *old; 54 struct ff_effect *old;
@@ -74,103 +71,4 @@ struct uinput_device {
74 wait_queue_head_t requests_waitq; 71 wait_queue_head_t requests_waitq;
75 spinlock_t requests_lock; 72 spinlock_t requests_lock;
76}; 73};
77#endif /* __KERNEL__ */
78
79struct uinput_ff_upload {
80 int request_id;
81 int retval;
82 struct ff_effect effect;
83 struct ff_effect old;
84};
85
86struct uinput_ff_erase {
87 int request_id;
88 int retval;
89 int effect_id;
90};
91
92/* ioctl */
93#define UINPUT_IOCTL_BASE 'U'
94#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
95#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
96
97#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
98#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
99#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
100#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int)
101#define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int)
102#define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int)
103#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int)
104#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
105#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
106#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
107#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
108
109#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
110#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
111#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
112#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
113
114/*
115 * To write a force-feedback-capable driver, the upload_effect
116 * and erase_effect callbacks in input_dev must be implemented.
117 * The uinput driver will generate a fake input event when one of
118 * these callbacks are invoked. The userspace code then uses
119 * ioctls to retrieve additional parameters and send the return code.
120 * The callback blocks until this return code is sent.
121 *
122 * The described callback mechanism is only used if ff_effects_max
123 * is set.
124 *
125 * To implement upload_effect():
126 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD.
127 * A request ID will be given in 'value'.
128 * 2. Allocate a uinput_ff_upload struct, fill in request_id with
129 * the 'value' from the EV_UINPUT event.
130 * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
131 * uinput_ff_upload struct. It will be filled in with the
132 * ff_effects passed to upload_effect().
133 * 4. Perform the effect upload, and place a return code back into
134 the uinput_ff_upload struct.
135 * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
136 * uinput_ff_upload_effect struct. This will complete execution
137 * of our upload_effect() handler.
138 *
139 * To implement erase_effect():
140 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE.
141 * A request ID will be given in 'value'.
142 * 2. Allocate a uinput_ff_erase struct, fill in request_id with
143 * the 'value' from the EV_UINPUT event.
144 * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the
145 * uinput_ff_erase struct. It will be filled in with the
146 * effect ID passed to erase_effect().
147 * 4. Perform the effect erasure, and place a return code back
148 * into the uinput_ff_erase struct.
149 * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the
150 * uinput_ff_erase_effect struct. This will complete execution
151 * of our erase_effect() handler.
152 */
153
154/*
155 * This is the new event type, used only by uinput.
156 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
157 * is the unique request ID. This number was picked
158 * arbitrarily, above EV_MAX (since the input system
159 * never sees it) but in the range of a 16-bit int.
160 */
161#define EV_UINPUT 0x0101
162#define UI_FF_UPLOAD 1
163#define UI_FF_ERASE 2
164
165#define UINPUT_MAX_NAME_SIZE 80
166struct uinput_user_dev {
167 char name[UINPUT_MAX_NAME_SIZE];
168 struct input_id id;
169 int ff_effects_max;
170 int absmax[ABS_CNT];
171 int absmin[ABS_CNT];
172 int absfuzz[ABS_CNT];
173 int absflat[ABS_CNT];
174};
175#endif /* __UINPUT_H_ */ 74#endif /* __UINPUT_H_ */
176