00001 #ifndef _INPUT_H
00002 #define _INPUT_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifdef __KERNEL__
00013 #include <linux/time.h>
00014 #include <linux/list.h>
00015 #else
00016 #include <sys/time.h>
00017 #include <sys/ioctl.h>
00018 #include <asm/types.h>
00019 #endif
00020
00021
00022
00023
00024
00025 struct input_event {
00026 struct timeval time;
00027 __u16 type;
00028 __u16 code;
00029 __s32 value;
00030 };
00031
00032
00033
00034
00035
00036 #define EV_VERSION 0x010000
00037
00038
00039
00040
00041
00042 struct input_id {
00043 __u16 bustype;
00044 __u16 vendor;
00045 __u16 product;
00046 __u16 version;
00047 };
00048
00049 struct input_absinfo {
00050 __s32 value;
00051 __s32 minimum;
00052 __s32 maximum;
00053 __s32 fuzz;
00054 __s32 flat;
00055 };
00056
00057 #define EVIOCGVERSION _IOR('E', 0x01, int)
00058 #define EVIOCGID _IOR('E', 0x02, struct input_id)
00059 #define EVIOCGKEYCODE _IOR('E', 0x04, int[2])
00060 #define EVIOCSKEYCODE _IOW('E', 0x04, int[2])
00061
00062 #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)
00063 #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len)
00064 #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len)
00065
00066 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len)
00067 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len)
00068 #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len)
00069 #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len)
00070
00071 #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)
00072 #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo)
00073 #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo)
00074
00075 #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))
00076 #define EVIOCRMFF _IOW('E', 0x81, int)
00077 #define EVIOCGEFFECTS _IOR('E', 0x84, int)
00078
00079 #define EVIOCGRAB _IOW('E', 0x90, int)
00080
00081
00082
00083
00084
00085 #define EV_SYN 0x00
00086 #define EV_KEY 0x01
00087 #define EV_REL 0x02
00088 #define EV_ABS 0x03
00089 #define EV_MSC 0x04
00090 #define EV_SW 0x05
00091 #define EV_LED 0x11
00092 #define EV_SND 0x12
00093 #define EV_REP 0x14
00094 #define EV_FF 0x15
00095 #define EV_PWR 0x16
00096 #define EV_FF_STATUS 0x17
00097 #define EV_MAX 0x1f
00098
00099
00100
00101
00102
00103 #define SYN_REPORT 0
00104 #define SYN_CONFIG 1
00105
00106
00107
00108
00109
00110 #define KEY_RESERVED 0
00111 #define KEY_ESC 1
00112 #define KEY_1 2
00113 #define KEY_2 3
00114 #define KEY_3 4
00115 #define KEY_4 5
00116 #define KEY_5 6
00117 #define KEY_6 7
00118 #define KEY_7 8
00119 #define KEY_8 9
00120 #define KEY_9 10
00121 #define KEY_0 11
00122 #define KEY_MINUS 12
00123 #define KEY_EQUAL 13
00124 #define KEY_BACKSPACE 14
00125 #define KEY_TAB 15
00126 #define KEY_Q 16
00127 #define KEY_W 17
00128 #define KEY_E 18
00129 #define KEY_R 19
00130 #define KEY_T 20
00131 #define KEY_Y 21
00132 #define KEY_U 22
00133 #define KEY_I 23
00134 #define KEY_O 24
00135 #define KEY_P 25
00136 #define KEY_LEFTBRACE 26
00137 #define KEY_RIGHTBRACE 27
00138 #define KEY_ENTER 28
00139 #define KEY_LEFTCTRL 29
00140 #define KEY_A 30
00141 #define KEY_S 31
00142 #define KEY_D 32
00143 #define KEY_F 33
00144 #define KEY_G 34
00145 #define KEY_H 35
00146 #define KEY_J 36
00147 #define KEY_K 37
00148 #define KEY_L 38
00149 #define KEY_SEMICOLON 39
00150 #define KEY_APOSTROPHE 40
00151 #define KEY_GRAVE 41
00152 #define KEY_LEFTSHIFT 42
00153 #define KEY_BACKSLASH 43
00154 #define KEY_Z 44
00155 #define KEY_X 45
00156 #define KEY_C 46
00157 #define KEY_V 47
00158 #define KEY_B 48
00159 #define KEY_N 49
00160 #define KEY_M 50
00161 #define KEY_COMMA 51
00162 #define KEY_DOT 52
00163 #define KEY_SLASH 53
00164 #define KEY_RIGHTSHIFT 54
00165 #define KEY_KPASTERISK 55
00166 #define KEY_LEFTALT 56
00167 #define KEY_SPACE 57
00168 #define KEY_CAPSLOCK 58
00169 #define KEY_F1 59
00170 #define KEY_F2 60
00171 #define KEY_F3 61
00172 #define KEY_F4 62
00173 #define KEY_F5 63
00174 #define KEY_F6 64
00175 #define KEY_F7 65
00176 #define KEY_F8 66
00177 #define KEY_F9 67
00178 #define KEY_F10 68
00179 #define KEY_NUMLOCK 69
00180 #define KEY_SCROLLLOCK 70
00181 #define KEY_KP7 71
00182 #define KEY_KP8 72
00183 #define KEY_KP9 73
00184 #define KEY_KPMINUS 74
00185 #define KEY_KP4 75
00186 #define KEY_KP5 76
00187 #define KEY_KP6 77
00188 #define KEY_KPPLUS 78
00189 #define KEY_KP1 79
00190 #define KEY_KP2 80
00191 #define KEY_KP3 81
00192 #define KEY_KP0 82
00193 #define KEY_KPDOT 83
00194
00195 #define KEY_ZENKAKUHANKAKU 85
00196 #define KEY_102ND 86
00197 #define KEY_F11 87
00198 #define KEY_F12 88
00199 #define KEY_RO 89
00200 #define KEY_KATAKANA 90
00201 #define KEY_HIRAGANA 91
00202 #define KEY_HENKAN 92
00203 #define KEY_KATAKANAHIRAGANA 93
00204 #define KEY_MUHENKAN 94
00205 #define KEY_KPJPCOMMA 95
00206 #define KEY_KPENTER 96
00207 #define KEY_RIGHTCTRL 97
00208 #define KEY_KPSLASH 98
00209 #define KEY_SYSRQ 99
00210 #define KEY_RIGHTALT 100
00211 #define KEY_LINEFEED 101
00212 #define KEY_HOME 102
00213 #define KEY_UP 103
00214 #define KEY_PAGEUP 104
00215 #define KEY_LEFT 105
00216 #define KEY_RIGHT 106
00217 #define KEY_END 107
00218 #define KEY_DOWN 108
00219 #define KEY_PAGEDOWN 109
00220 #define KEY_INSERT 110
00221 #define KEY_DELETE 111
00222 #define KEY_MACRO 112
00223 #define KEY_MUTE 113
00224 #define KEY_VOLUMEDOWN 114
00225 #define KEY_VOLUMEUP 115
00226 #define KEY_POWER 116
00227 #define KEY_KPEQUAL 117
00228 #define KEY_KPPLUSMINUS 118
00229 #define KEY_PAUSE 119
00230
00231 #define KEY_KPCOMMA 121
00232 #define KEY_HANGUEL 122
00233 #define KEY_HANJA 123
00234 #define KEY_YEN 124
00235 #define KEY_LEFTMETA 125
00236 #define KEY_RIGHTMETA 126
00237 #define KEY_COMPOSE 127
00238
00239 #define KEY_STOP 128
00240 #define KEY_AGAIN 129
00241 #define KEY_PROPS 130
00242 #define KEY_UNDO 131
00243 #define KEY_FRONT 132
00244 #define KEY_COPY 133
00245 #define KEY_OPEN 134
00246 #define KEY_PASTE 135
00247 #define KEY_FIND 136
00248 #define KEY_CUT 137
00249 #define KEY_HELP 138
00250 #define KEY_MENU 139
00251 #define KEY_CALC 140
00252 #define KEY_SETUP 141
00253 #define KEY_SLEEP 142
00254 #define KEY_WAKEUP 143
00255 #define KEY_FILE 144
00256 #define KEY_SENDFILE 145
00257 #define KEY_DELETEFILE 146
00258 #define KEY_XFER 147
00259 #define KEY_PROG1 148
00260 #define KEY_PROG2 149
00261 #define KEY_WWW 150
00262 #define KEY_MSDOS 151
00263 #define KEY_COFFEE 152
00264 #define KEY_DIRECTION 153
00265 #define KEY_CYCLEWINDOWS 154
00266 #define KEY_MAIL 155
00267 #define KEY_BOOKMARKS 156
00268 #define KEY_COMPUTER 157
00269 #define KEY_BACK 158
00270 #define KEY_FORWARD 159
00271 #define KEY_CLOSECD 160
00272 #define KEY_EJECTCD 161
00273 #define KEY_EJECTCLOSECD 162
00274 #define KEY_NEXTSONG 163
00275 #define KEY_PLAYPAUSE 164
00276 #define KEY_PREVIOUSSONG 165
00277 #define KEY_STOPCD 166
00278 #define KEY_RECORD 167
00279 #define KEY_REWIND 168
00280 #define KEY_PHONE 169
00281 #define KEY_ISO 170
00282 #define KEY_CONFIG 171
00283 #define KEY_HOMEPAGE 172
00284 #define KEY_REFRESH 173
00285 #define KEY_EXIT 174
00286 #define KEY_MOVE 175
00287 #define KEY_EDIT 176
00288 #define KEY_SCROLLUP 177
00289 #define KEY_SCROLLDOWN 178
00290 #define KEY_KPLEFTPAREN 179
00291 #define KEY_KPRIGHTPAREN 180
00292
00293 #define KEY_F13 183
00294 #define KEY_F14 184
00295 #define KEY_F15 185
00296 #define KEY_F16 186
00297 #define KEY_F17 187
00298 #define KEY_F18 188
00299 #define KEY_F19 189
00300 #define KEY_F20 190
00301 #define KEY_F21 191
00302 #define KEY_F22 192
00303 #define KEY_F23 193
00304 #define KEY_F24 194
00305
00306 #define KEY_PLAYCD 200
00307 #define KEY_PAUSECD 201
00308 #define KEY_PROG3 202
00309 #define KEY_PROG4 203
00310 #define KEY_SUSPEND 205
00311 #define KEY_CLOSE 206
00312 #define KEY_PLAY 207
00313 #define KEY_FASTFORWARD 208
00314 #define KEY_BASSBOOST 209
00315 #define KEY_PRINT 210
00316 #define KEY_HP 211
00317 #define KEY_CAMERA 212
00318 #define KEY_SOUND 213
00319 #define KEY_QUESTION 214
00320 #define KEY_EMAIL 215
00321 #define KEY_CHAT 216
00322 #define KEY_SEARCH 217
00323 #define KEY_CONNECT 218
00324 #define KEY_FINANCE 219
00325 #define KEY_SPORT 220
00326 #define KEY_SHOP 221
00327 #define KEY_ALTERASE 222
00328 #define KEY_CANCEL 223
00329 #define KEY_BRIGHTNESSDOWN 224
00330 #define KEY_BRIGHTNESSUP 225
00331 #define KEY_MEDIA 226
00332
00333 #define KEY_UNKNOWN 240
00334
00335 #define BTN_MISC 0x100
00336 #define BTN_0 0x100
00337 #define BTN_1 0x101
00338 #define BTN_2 0x102
00339 #define BTN_3 0x103
00340 #define BTN_4 0x104
00341 #define BTN_5 0x105
00342 #define BTN_6 0x106
00343 #define BTN_7 0x107
00344 #define BTN_8 0x108
00345 #define BTN_9 0x109
00346
00347 #define BTN_MOUSE 0x110
00348 #define BTN_LEFT 0x110
00349 #define BTN_RIGHT 0x111
00350 #define BTN_MIDDLE 0x112
00351 #define BTN_SIDE 0x113
00352 #define BTN_EXTRA 0x114
00353 #define BTN_FORWARD 0x115
00354 #define BTN_BACK 0x116
00355 #define BTN_TASK 0x117
00356
00357 #define BTN_JOYSTICK 0x120
00358 #define BTN_TRIGGER 0x120
00359 #define BTN_THUMB 0x121
00360 #define BTN_THUMB2 0x122
00361 #define BTN_TOP 0x123
00362 #define BTN_TOP2 0x124
00363 #define BTN_PINKIE 0x125
00364 #define BTN_BASE 0x126
00365 #define BTN_BASE2 0x127
00366 #define BTN_BASE3 0x128
00367 #define BTN_BASE4 0x129
00368 #define BTN_BASE5 0x12a
00369 #define BTN_BASE6 0x12b
00370 #define BTN_DEAD 0x12f
00371
00372 #define BTN_GAMEPAD 0x130
00373 #define BTN_A 0x130
00374 #define BTN_B 0x131
00375 #define BTN_C 0x132
00376 #define BTN_X 0x133
00377 #define BTN_Y 0x134
00378 #define BTN_Z 0x135
00379 #define BTN_TL 0x136
00380 #define BTN_TR 0x137
00381 #define BTN_TL2 0x138
00382 #define BTN_TR2 0x139
00383 #define BTN_SELECT 0x13a
00384 #define BTN_START 0x13b
00385 #define BTN_MODE 0x13c
00386 #define BTN_THUMBL 0x13d
00387 #define BTN_THUMBR 0x13e
00388
00389 #define BTN_DIGI 0x140
00390 #define BTN_TOOL_PEN 0x140
00391 #define BTN_TOOL_RUBBER 0x141
00392 #define BTN_TOOL_BRUSH 0x142
00393 #define BTN_TOOL_PENCIL 0x143
00394 #define BTN_TOOL_AIRBRUSH 0x144
00395 #define BTN_TOOL_FINGER 0x145
00396 #define BTN_TOOL_MOUSE 0x146
00397 #define BTN_TOOL_LENS 0x147
00398 #define BTN_TOUCH 0x14a
00399 #define BTN_STYLUS 0x14b
00400 #define BTN_STYLUS2 0x14c
00401 #define BTN_TOOL_DOUBLETAP 0x14d
00402 #define BTN_TOOL_TRIPLETAP 0x14e
00403
00404 #define BTN_WHEEL 0x150
00405 #define BTN_GEAR_DOWN 0x150
00406 #define BTN_GEAR_UP 0x151
00407
00408 #define KEY_OK 0x160
00409 #define KEY_SELECT 0x161
00410 #define KEY_GOTO 0x162
00411 #define KEY_CLEAR 0x163
00412 #define KEY_POWER2 0x164
00413 #define KEY_OPTION 0x165
00414 #define KEY_INFO 0x166
00415 #define KEY_TIME 0x167
00416 #define KEY_VENDOR 0x168
00417 #define KEY_ARCHIVE 0x169
00418 #define KEY_PROGRAM 0x16a
00419 #define KEY_CHANNEL 0x16b
00420 #define KEY_FAVORITES 0x16c
00421 #define KEY_EPG 0x16d
00422 #define KEY_PVR 0x16e
00423 #define KEY_MHP 0x16f
00424 #define KEY_LANGUAGE 0x170
00425 #define KEY_TITLE 0x171
00426 #define KEY_SUBTITLE 0x172
00427 #define KEY_ANGLE 0x173
00428 #define KEY_ZOOM 0x174
00429 #define KEY_MODE 0x175
00430 #define KEY_KEYBOARD 0x176
00431 #define KEY_SCREEN 0x177
00432 #define KEY_PC 0x178
00433 #define KEY_TV 0x179
00434 #define KEY_TV2 0x17a
00435 #define KEY_VCR 0x17b
00436 #define KEY_VCR2 0x17c
00437 #define KEY_SAT 0x17d
00438 #define KEY_SAT2 0x17e
00439 #define KEY_CD 0x17f
00440 #define KEY_TAPE 0x180
00441 #define KEY_RADIO 0x181
00442 #define KEY_TUNER 0x182
00443 #define KEY_PLAYER 0x183
00444 #define KEY_TEXT 0x184
00445 #define KEY_DVD 0x185
00446 #define KEY_AUX 0x186
00447 #define KEY_MP3 0x187
00448 #define KEY_AUDIO 0x188
00449 #define KEY_VIDEO 0x189
00450 #define KEY_DIRECTORY 0x18a
00451 #define KEY_LIST 0x18b
00452 #define KEY_MEMO 0x18c
00453 #define KEY_CALENDAR 0x18d
00454 #define KEY_RED 0x18e
00455 #define KEY_GREEN 0x18f
00456 #define KEY_YELLOW 0x190
00457 #define KEY_BLUE 0x191
00458 #define KEY_CHANNELUP 0x192
00459 #define KEY_CHANNELDOWN 0x193
00460 #define KEY_FIRST 0x194
00461 #define KEY_LAST 0x195
00462 #define KEY_AB 0x196
00463 #define KEY_NEXT 0x197
00464 #define KEY_RESTART 0x198
00465 #define KEY_SLOW 0x199
00466 #define KEY_SHUFFLE 0x19a
00467 #define KEY_BREAK 0x19b
00468 #define KEY_PREVIOUS 0x19c
00469 #define KEY_DIGITS 0x19d
00470 #define KEY_TEEN 0x19e
00471 #define KEY_TWEN 0x19f
00472
00473 #define KEY_DEL_EOL 0x1c0
00474 #define KEY_DEL_EOS 0x1c1
00475 #define KEY_INS_LINE 0x1c2
00476 #define KEY_DEL_LINE 0x1c3
00477
00478 #define KEY_MAX 0x1ff
00479
00480
00481
00482
00483
00484 #define REL_X 0x00
00485 #define REL_Y 0x01
00486 #define REL_Z 0x02
00487 #define REL_HWHEEL 0x06
00488 #define REL_DIAL 0x07
00489 #define REL_WHEEL 0x08
00490 #define REL_MISC 0x09
00491 #define REL_MAX 0x0f
00492
00493
00494
00495
00496
00497 #define ABS_X 0x00
00498 #define ABS_Y 0x01
00499 #define ABS_Z 0x02
00500 #define ABS_RX 0x03
00501 #define ABS_RY 0x04
00502 #define ABS_RZ 0x05
00503 #define ABS_THROTTLE 0x06
00504 #define ABS_RUDDER 0x07
00505 #define ABS_WHEEL 0x08
00506 #define ABS_GAS 0x09
00507 #define ABS_BRAKE 0x0a
00508 #define ABS_HAT0X 0x10
00509 #define ABS_HAT0Y 0x11
00510 #define ABS_HAT1X 0x12
00511 #define ABS_HAT1Y 0x13
00512 #define ABS_HAT2X 0x14
00513 #define ABS_HAT2Y 0x15
00514 #define ABS_HAT3X 0x16
00515 #define ABS_HAT3Y 0x17
00516 #define ABS_PRESSURE 0x18
00517 #define ABS_DISTANCE 0x19
00518 #define ABS_TILT_X 0x1a
00519 #define ABS_TILT_Y 0x1b
00520 #define ABS_TOOL_WIDTH 0x1c
00521 #define ABS_VOLUME 0x20
00522 #define ABS_MISC 0x28
00523 #define ABS_MAX 0x3f
00524
00525
00526
00527
00528
00529 #define SW_0 0x00
00530 #define SW_1 0x01
00531 #define SW_2 0x02
00532 #define SW_3 0x03
00533 #define SW_4 0x04
00534 #define SW_5 0x05
00535 #define SW_6 0x06
00536 #define SW_7 0x07
00537 #define SW_MAX 0x0f
00538
00539
00540
00541
00542
00543 #define MSC_SERIAL 0x00
00544 #define MSC_PULSELED 0x01
00545 #define MSC_GESTURE 0x02
00546 #define MSC_MAX 0x07
00547
00548
00549
00550
00551
00552 #define LED_NUML 0x00
00553 #define LED_CAPSL 0x01
00554 #define LED_SCROLLL 0x02
00555 #define LED_COMPOSE 0x03
00556 #define LED_KANA 0x04
00557 #define LED_SLEEP 0x05
00558 #define LED_SUSPEND 0x06
00559 #define LED_MUTE 0x07
00560 #define LED_MISC 0x08
00561 #define LED_MAX 0x0f
00562
00563
00564
00565
00566
00567 #define REP_DELAY 0x00
00568 #define REP_PERIOD 0x01
00569 #define REP_MAX 0x01
00570
00571
00572
00573
00574
00575 #define SND_CLICK 0x00
00576 #define SND_BELL 0x01
00577 #define SND_TONE 0x02
00578 #define SND_MAX 0x07
00579
00580
00581
00582
00583
00584 #define ID_BUS 0
00585 #define ID_VENDOR 1
00586 #define ID_PRODUCT 2
00587 #define ID_VERSION 3
00588
00589 #define BUS_PCI 0x01
00590 #define BUS_ISAPNP 0x02
00591 #define BUS_USB 0x03
00592 #define BUS_HIL 0x04
00593 #define BUS_BLUETOOTH 0x05
00594
00595 #define BUS_ISA 0x10
00596 #define BUS_I8042 0x11
00597 #define BUS_XTKBD 0x12
00598 #define BUS_RS232 0x13
00599 #define BUS_GAMEPORT 0x14
00600 #define BUS_PARPORT 0x15
00601 #define BUS_AMIGA 0x16
00602 #define BUS_ADB 0x17
00603 #define BUS_I2C 0x18
00604 #define BUS_HOST 0x19
00605
00606
00607
00608
00609 #define FF_STATUS_STOPPED 0x00
00610 #define FF_STATUS_PLAYING 0x01
00611 #define FF_STATUS_MAX 0x01
00612
00613
00614
00615
00616
00617
00618
00619 struct ff_replay {
00620 __u16 length;
00621 __u16 delay;
00622 };
00623
00624 struct ff_trigger {
00625 __u16 button;
00626 __u16 interval;
00627 };
00628
00629 struct ff_envelope {
00630 __u16 attack_length;
00631 __u16 attack_level;
00632 __u16 fade_length;
00633 __u16 fade_level;
00634 };
00635
00636
00637 struct ff_constant_effect {
00638 __s16 level;
00639 struct ff_envelope envelope;
00640 };
00641
00642
00643 struct ff_ramp_effect {
00644 __s16 start_level;
00645 __s16 end_level;
00646 struct ff_envelope envelope;
00647 };
00648
00649
00650 struct ff_condition_effect {
00651 __u16 right_saturation;
00652 __u16 left_saturation;
00653
00654 __s16 right_coeff;
00655
00656 __s16 left_coeff;
00657
00658 __u16 deadband;
00659 __s16 center;
00660
00661 };
00662
00663
00664 struct ff_periodic_effect {
00665 __u16 waveform;
00666 __u16 period;
00667 __s16 magnitude;
00668 __s16 offset;
00669 __u16 phase;
00670
00671 struct ff_envelope envelope;
00672
00673
00674 __u32 custom_len;
00675 __s16 *custom_data;
00676
00677
00678 };
00679
00680
00681
00682
00683
00684
00685 struct ff_rumble_effect {
00686 __u16 strong_magnitude;
00687 __u16 weak_magnitude;
00688 };
00689
00690
00691
00692
00693 struct ff_effect {
00694 __u16 type;
00695
00696
00697
00698
00699 __s16 id;
00700
00701 __u16 direction;
00702
00703
00704
00705
00706
00707 struct ff_trigger trigger;
00708 struct ff_replay replay;
00709
00710 union {
00711 struct ff_constant_effect constant;
00712 struct ff_ramp_effect ramp;
00713 struct ff_periodic_effect periodic;
00714 struct ff_condition_effect condition[2];
00715 struct ff_rumble_effect rumble;
00716 } u;
00717 };
00718
00719
00720
00721
00722
00723 #define FF_RUMBLE 0x50
00724 #define FF_PERIODIC 0x51
00725 #define FF_CONSTANT 0x52
00726 #define FF_SPRING 0x53
00727 #define FF_FRICTION 0x54
00728 #define FF_DAMPER 0x55
00729 #define FF_INERTIA 0x56
00730 #define FF_RAMP 0x57
00731
00732
00733
00734
00735
00736 #define FF_SQUARE 0x58
00737 #define FF_TRIANGLE 0x59
00738 #define FF_SINE 0x5a
00739 #define FF_SAW_UP 0x5b
00740 #define FF_SAW_DOWN 0x5c
00741 #define FF_CUSTOM 0x5d
00742
00743
00744
00745
00746
00747 #define FF_GAIN 0x60
00748 #define FF_AUTOCENTER 0x61
00749
00750 #define FF_MAX 0x7f
00751
00752 #ifdef __KERNEL__
00753
00754
00755
00756
00757
00758 #include <linux/fs.h>
00759 #include <linux/timer.h>
00760
00761 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
00762 #define BIT(x) (1UL<<((x)%BITS_PER_LONG))
00763 #define LONG(x) ((x)/BITS_PER_LONG)
00764
00765 #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
00766 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
00767
00768 #define SET_INPUT_KEYCODE(dev, scancode, val) \
00769 ({ unsigned __old; \
00770 switch (dev->keycodesize) { \
00771 case 1: { \
00772 u8 *k = (u8 *)dev->keycode; \
00773 __old = k[scancode]; \
00774 k[scancode] = val; \
00775 break; \
00776 } \
00777 case 2: { \
00778 u16 *k = (u16 *)dev->keycode; \
00779 __old = k[scancode]; \
00780 k[scancode] = val; \
00781 break; \
00782 } \
00783 default: { \
00784 u32 *k = (u32 *)dev->keycode; \
00785 __old = k[scancode]; \
00786 k[scancode] = val; \
00787 break; \
00788 } \
00789 } \
00790 __old; })
00791
00792 struct input_dev {
00793
00794 void *private;
00795
00796 char *name;
00797 char *phys;
00798 char *uniq;
00799 struct input_id id;
00800
00801 unsigned long evbit[NBITS(EV_MAX)];
00802 unsigned long keybit[NBITS(KEY_MAX)];
00803 unsigned long relbit[NBITS(REL_MAX)];
00804 unsigned long absbit[NBITS(ABS_MAX)];
00805 unsigned long mscbit[NBITS(MSC_MAX)];
00806 unsigned long ledbit[NBITS(LED_MAX)];
00807 unsigned long sndbit[NBITS(SND_MAX)];
00808 unsigned long ffbit[NBITS(FF_MAX)];
00809 unsigned long swbit[NBITS(SW_MAX)];
00810 int ff_effects_max;
00811
00812 unsigned int keycodemax;
00813 unsigned int keycodesize;
00814 void *keycode;
00815
00816 unsigned int repeat_key;
00817 struct timer_list timer;
00818
00819 struct pm_dev *pm_dev;
00820 struct pt_regs *regs;
00821 int state;
00822
00823 int sync;
00824
00825 int abs[ABS_MAX + 1];
00826 int rep[REP_MAX + 1];
00827
00828 unsigned long key[NBITS(KEY_MAX)];
00829 unsigned long led[NBITS(LED_MAX)];
00830 unsigned long snd[NBITS(SND_MAX)];
00831 unsigned long sw[NBITS(SW_MAX)];
00832
00833 int absmax[ABS_MAX + 1];
00834 int absmin[ABS_MAX + 1];
00835 int absfuzz[ABS_MAX + 1];
00836 int absflat[ABS_MAX + 1];
00837
00838 int (*open)(struct input_dev *dev);
00839 void (*close)(struct input_dev *dev);
00840 int (*accept)(struct input_dev *dev, struct file *file);
00841 int (*flush)(struct input_dev *dev, struct file *file);
00842 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
00843 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
00844 int (*erase_effect)(struct input_dev *dev, int effect_id);
00845
00846 struct input_handle *grab;
00847 struct device *dev;
00848
00849 struct list_head h_list;
00850 struct list_head node;
00851 };
00852
00853
00854
00855
00856
00857 #define INPUT_DEVICE_ID_MATCH_BUS 1
00858 #define INPUT_DEVICE_ID_MATCH_VENDOR 2
00859 #define INPUT_DEVICE_ID_MATCH_PRODUCT 4
00860 #define INPUT_DEVICE_ID_MATCH_VERSION 8
00861
00862 #define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
00863 #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
00864 #define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
00865 #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
00866 #define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
00867 #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
00868 #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
00869 #define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
00870 #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
00871
00872 #define INPUT_DEVICE_ID_MATCH_DEVICE\
00873 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
00874 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
00875 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
00876
00877 struct input_device_id {
00878
00879 unsigned long flags;
00880
00881 struct input_id id;
00882
00883 unsigned long evbit[NBITS(EV_MAX)];
00884 unsigned long keybit[NBITS(KEY_MAX)];
00885 unsigned long relbit[NBITS(REL_MAX)];
00886 unsigned long absbit[NBITS(ABS_MAX)];
00887 unsigned long mscbit[NBITS(MSC_MAX)];
00888 unsigned long ledbit[NBITS(LED_MAX)];
00889 unsigned long sndbit[NBITS(SND_MAX)];
00890 unsigned long ffbit[NBITS(FF_MAX)];
00891 unsigned long swbit[NBITS(SW_MAX)];
00892
00893 unsigned long driver_info;
00894 };
00895
00896 struct input_handle;
00897
00898 struct input_handler {
00899
00900 void *private;
00901
00902 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
00903 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
00904 void (*disconnect)(struct input_handle *handle);
00905
00906 struct file_operations *fops;
00907 int minor;
00908 char *name;
00909
00910 struct input_device_id *id_table;
00911 struct input_device_id *blacklist;
00912
00913 struct list_head h_list;
00914 struct list_head node;
00915 };
00916
00917 struct input_handle {
00918
00919 void *private;
00920
00921 int open;
00922 char *name;
00923
00924 struct input_dev *dev;
00925 struct input_handler *handler;
00926
00927 struct list_head d_node;
00928 struct list_head h_node;
00929 };
00930
00931 #define to_dev(n) container_of(n,struct input_dev,node)
00932 #define to_handler(n) container_of(n,struct input_handler,node);
00933 #define to_handle(n) container_of(n,struct input_handle,d_node)
00934 #define to_handle_h(n) container_of(n,struct input_handle,h_node)
00935
00936 static inline void init_input_dev(struct input_dev *dev)
00937 {
00938 INIT_LIST_HEAD(&dev->h_list);
00939 INIT_LIST_HEAD(&dev->node);
00940 }
00941
00942 void input_register_device(struct input_dev *);
00943 void input_unregister_device(struct input_dev *);
00944
00945 void input_register_handler(struct input_handler *);
00946 void input_unregister_handler(struct input_handler *);
00947
00948 int input_grab_device(struct input_handle *);
00949 void input_release_device(struct input_handle *);
00950
00951 int input_open_device(struct input_handle *);
00952 void input_close_device(struct input_handle *);
00953
00954 int input_accept_process(struct input_handle *handle, struct file *file);
00955 int input_flush_device(struct input_handle* handle, struct file* file);
00956
00957 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
00958
00959 static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
00960 {
00961 input_event(dev, EV_KEY, code, !!value);
00962 }
00963
00964 static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
00965 {
00966 input_event(dev, EV_REL, code, value);
00967 }
00968
00969 static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
00970 {
00971 input_event(dev, EV_ABS, code, value);
00972 }
00973
00974 static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value)
00975 {
00976 input_event(dev, EV_FF, code, value);
00977 }
00978
00979 static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
00980 {
00981 input_event(dev, EV_FF_STATUS, code, value);
00982 }
00983
00984 static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
00985 {
00986 input_event(dev, EV_SW, code, !!value);
00987 }
00988
00989 static inline void input_regs(struct input_dev *dev, struct pt_regs *regs)
00990 {
00991 dev->regs = regs;
00992 }
00993
00994 static inline void input_sync(struct input_dev *dev)
00995 {
00996 input_event(dev, EV_SYN, SYN_REPORT, 0);
00997 dev->regs = NULL;
00998 }
00999
01000 static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
01001 {
01002 dev->absmin[axis] = min;
01003 dev->absmax[axis] = max;
01004 dev->absfuzz[axis] = fuzz;
01005 dev->absflat[axis] = flat;
01006
01007 dev->absbit[LONG(axis)] |= BIT(axis);
01008 }
01009
01010 extern struct class_simple *input_class;
01011
01012 #endif
01013 #endif