diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-10-30 03:20:56 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-10-30 03:20:56 -0400 |
| commit | 53279f36dccffc26ff536003fd6bb97cc21c3b82 (patch) | |
| tree | 9d16e497c0e4158c7c054c479bd0e9ff0388d7bb /include/linux/uinput.h | |
| parent | a6e8c0a25377e27958b11b20e1927885ae7c9857 (diff) | |
| parent | 8f0d8163b50e01f398b14bcd4dc039ac5ab18d64 (diff) | |
Merge tag 'v3.7-rc3' into next to sync up with recent USB and MFD changes
Diffstat (limited to 'include/linux/uinput.h')
| -rw-r--r-- | include/linux/uinput.h | 109 |
1 files changed, 3 insertions, 106 deletions
diff --git a/include/linux/uinput.h b/include/linux/uinput.h index c454bbe39ee7..0a4487d3fb1e 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,13 +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/types.h> | 35 | #include <uapi/linux/uinput.h> |
| 36 | #include <linux/input.h> | ||
| 37 | |||
| 38 | #define UINPUT_VERSION 3 | ||
| 39 | 36 | ||
| 40 | #ifdef __KERNEL__ | ||
| 41 | #define UINPUT_NAME "uinput" | 37 | #define UINPUT_NAME "uinput" |
| 42 | #define UINPUT_BUFFER_SIZE 16 | 38 | #define UINPUT_BUFFER_SIZE 16 |
| 43 | #define UINPUT_NUM_REQUESTS 16 | 39 | #define UINPUT_NUM_REQUESTS 16 |
| @@ -75,103 +71,4 @@ struct uinput_device { | |||
| 75 | wait_queue_head_t requests_waitq; | 71 | wait_queue_head_t requests_waitq; |
| 76 | spinlock_t requests_lock; | 72 | spinlock_t requests_lock; |
| 77 | }; | 73 | }; |
| 78 | #endif /* __KERNEL__ */ | ||
| 79 | |||
| 80 | struct uinput_ff_upload { | ||
| 81 | __u32 request_id; | ||
| 82 | __s32 retval; | ||
| 83 | struct ff_effect effect; | ||
| 84 | struct ff_effect old; | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct uinput_ff_erase { | ||
| 88 | __u32 request_id; | ||
| 89 | __s32 retval; | ||
| 90 | __u32 effect_id; | ||
| 91 | }; | ||
| 92 | |||
| 93 | /* ioctl */ | ||
| 94 | #define UINPUT_IOCTL_BASE 'U' | ||
| 95 | #define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1) | ||
| 96 | #define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2) | ||
| 97 | |||
| 98 | #define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int) | ||
| 99 | #define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int) | ||
| 100 | #define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int) | ||
| 101 | #define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int) | ||
| 102 | #define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int) | ||
| 103 | #define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int) | ||
| 104 | #define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) | ||
| 105 | #define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) | ||
| 106 | #define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) | ||
| 107 | #define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) | ||
| 108 | #define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int) | ||
| 109 | |||
| 110 | #define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) | ||
| 111 | #define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) | ||
| 112 | #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) | ||
| 113 | #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) | ||
| 114 | |||
| 115 | /* | ||
| 116 | * To write a force-feedback-capable driver, the upload_effect | ||
| 117 | * and erase_effect callbacks in input_dev must be implemented. | ||
| 118 | * The uinput driver will generate a fake input event when one of | ||
| 119 | * these callbacks are invoked. The userspace code then uses | ||
| 120 | * ioctls to retrieve additional parameters and send the return code. | ||
| 121 | * The callback blocks until this return code is sent. | ||
| 122 | * | ||
| 123 | * The described callback mechanism is only used if ff_effects_max | ||
| 124 | * is set. | ||
| 125 | * | ||
| 126 | * To implement upload_effect(): | ||
| 127 | * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD. | ||
| 128 | * A request ID will be given in 'value'. | ||
| 129 | * 2. Allocate a uinput_ff_upload struct, fill in request_id with | ||
| 130 | * the 'value' from the EV_UINPUT event. | ||
| 131 | * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the | ||
| 132 | * uinput_ff_upload struct. It will be filled in with the | ||
| 133 | * ff_effects passed to upload_effect(). | ||
| 134 | * 4. Perform the effect upload, and place a return code back into | ||
| 135 | the uinput_ff_upload struct. | ||
| 136 | * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the | ||
| 137 | * uinput_ff_upload_effect struct. This will complete execution | ||
| 138 | * of our upload_effect() handler. | ||
| 139 | * | ||
| 140 | * To implement erase_effect(): | ||
| 141 | * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE. | ||
| 142 | * A request ID will be given in 'value'. | ||
| 143 | * 2. Allocate a uinput_ff_erase struct, fill in request_id with | ||
| 144 | * the 'value' from the EV_UINPUT event. | ||
| 145 | * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the | ||
| 146 | * uinput_ff_erase struct. It will be filled in with the | ||
| 147 | * effect ID passed to erase_effect(). | ||
| 148 | * 4. Perform the effect erasure, and place a return code back | ||
| 149 | * into the uinput_ff_erase struct. | ||
| 150 | * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the | ||
| 151 | * uinput_ff_erase_effect struct. This will complete execution | ||
| 152 | * of our erase_effect() handler. | ||
| 153 | */ | ||
| 154 | |||
| 155 | /* | ||
| 156 | * This is the new event type, used only by uinput. | ||
| 157 | * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value' | ||
| 158 | * is the unique request ID. This number was picked | ||
| 159 | * arbitrarily, above EV_MAX (since the input system | ||
| 160 | * never sees it) but in the range of a 16-bit int. | ||
| 161 | */ | ||
| 162 | #define EV_UINPUT 0x0101 | ||
| 163 | #define UI_FF_UPLOAD 1 | ||
| 164 | #define UI_FF_ERASE 2 | ||
| 165 | |||
| 166 | #define UINPUT_MAX_NAME_SIZE 80 | ||
| 167 | struct uinput_user_dev { | ||
| 168 | char name[UINPUT_MAX_NAME_SIZE]; | ||
| 169 | struct input_id id; | ||
| 170 | __u32 ff_effects_max; | ||
| 171 | __s32 absmax[ABS_CNT]; | ||
| 172 | __s32 absmin[ABS_CNT]; | ||
| 173 | __s32 absfuzz[ABS_CNT]; | ||
| 174 | __s32 absflat[ABS_CNT]; | ||
| 175 | }; | ||
| 176 | #endif /* __UINPUT_H_ */ | 74 | #endif /* __UINPUT_H_ */ |
| 177 | |||
