uinput 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d86f92cb1a855196f799ac0938acbdfb8671b91c
4
+ data.tar.gz: 2c8bf18dbb3c406580aeef1cc3c74d0b4007cd2f
5
+ SHA512:
6
+ metadata.gz: cd33968fd9e73ae027bf36a4fe3e6f458b93386af54514f0e92a4047cf2da3f2eb08fc4acc09c6b170ae5ccd745dad0232cd1e7e8216ff4b89ef53a53e3a72dc
7
+ data.tar.gz: 6304b381dd56f0828dc628aa4a62b55b5f5cc1cf9013312e5a53ee94b10f05d321f14caf41df7fcdba077d1dec28529eded54e62cda0555957c00fd3859d1040
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build uinput-1.0.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeGroup description="" fullCmd="" taksId="ffi"><RakeTask description="Generate ffi interface" fullCmd="ffi:generate" taksId="generate" /></RakeGroup><RakeTask description="Build and install uinput-1.0.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v1.0.0 and build and push uinput-1.0.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Uinput
2
+
3
+ Structs and Constants of input, ioctrl and uinput to use uinput with ruby.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'uinput'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install uinput
20
+
21
+ ## (Re-)Compiling the binding
22
+
23
+ ```
24
+ $ rake ffi:generate
25
+ ```
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir[File.expand_path("tasks/*.rake", File.dirname(__FILE__))].each { |ext| load ext }
4
+
@@ -0,0 +1,837 @@
1
+ class InputEvent < FFI::Struct
2
+ layout(
3
+ :time, Timeval,
4
+ :type, :ushort,
5
+ :code, :ushort,
6
+ :value, :int
7
+ )
8
+ end
9
+ EV_VERSION = 0x010001
10
+ class InputId < FFI::Struct
11
+ layout(
12
+ :bustype, :ushort,
13
+ :vendor, :ushort,
14
+ :product, :ushort,
15
+ :version, :ushort
16
+ )
17
+ end
18
+ class InputAbsinfo < FFI::Struct
19
+ layout(
20
+ :value, :int,
21
+ :minimum, :int,
22
+ :maximum, :int,
23
+ :fuzz, :int,
24
+ :flat, :int,
25
+ :resolution, :int
26
+ )
27
+ end
28
+ INPUT_KEYMAP_BY_INDEX = (1 << 0)
29
+ class InputKeymapEntry < FFI::Struct
30
+ layout(
31
+ :flags, :uchar,
32
+ :len, :uchar,
33
+ :index, :ushort,
34
+ :keycode, :uint,
35
+ :scancode, [:uchar, 32]
36
+ )
37
+ end
38
+ INPUT_PROP_POINTER = 0x00
39
+ INPUT_PROP_DIRECT = 0x01
40
+ INPUT_PROP_BUTTONPAD = 0x02
41
+ INPUT_PROP_SEMI_MT = 0x03
42
+ INPUT_PROP_TOPBUTTONPAD = 0x04
43
+ INPUT_PROP_POINTING_STICK = 0x05
44
+ INPUT_PROP_MAX = 0x1f
45
+ INPUT_PROP_CNT = (0x1f+1)
46
+ EV_SYN = 0x00
47
+ EV_KEY = 0x01
48
+ EV_REL = 0x02
49
+ EV_ABS = 0x03
50
+ EV_MSC = 0x04
51
+ EV_SW = 0x05
52
+ EV_LED = 0x11
53
+ EV_SND = 0x12
54
+ EV_REP = 0x14
55
+ EV_FF = 0x15
56
+ EV_PWR = 0x16
57
+ EV_FF_STATUS = 0x17
58
+ EV_MAX = 0x1f
59
+ EV_CNT = (0x1f+1)
60
+ SYN_REPORT = 0
61
+ SYN_CONFIG = 1
62
+ SYN_MT_REPORT = 2
63
+ SYN_DROPPED = 3
64
+ SYN_MAX = 0xf
65
+ SYN_CNT = (0xf+1)
66
+ KEY_RESERVED = 0
67
+ KEY_ESC = 1
68
+ KEY_1 = 2
69
+ KEY_2 = 3
70
+ KEY_3 = 4
71
+ KEY_4 = 5
72
+ KEY_5 = 6
73
+ KEY_6 = 7
74
+ KEY_7 = 8
75
+ KEY_8 = 9
76
+ KEY_9 = 10
77
+ KEY_0 = 11
78
+ KEY_MINUS = 12
79
+ KEY_EQUAL = 13
80
+ KEY_BACKSPACE = 14
81
+ KEY_TAB = 15
82
+ KEY_Q = 16
83
+ KEY_W = 17
84
+ KEY_E = 18
85
+ KEY_R = 19
86
+ KEY_T = 20
87
+ KEY_Y = 21
88
+ KEY_U = 22
89
+ KEY_I = 23
90
+ KEY_O = 24
91
+ KEY_P = 25
92
+ KEY_LEFTBRACE = 26
93
+ KEY_RIGHTBRACE = 27
94
+ KEY_ENTER = 28
95
+ KEY_LEFTCTRL = 29
96
+ KEY_A = 30
97
+ KEY_S = 31
98
+ KEY_D = 32
99
+ KEY_F = 33
100
+ KEY_G = 34
101
+ KEY_H = 35
102
+ KEY_J = 36
103
+ KEY_K = 37
104
+ KEY_L = 38
105
+ KEY_SEMICOLON = 39
106
+ KEY_APOSTROPHE = 40
107
+ KEY_GRAVE = 41
108
+ KEY_LEFTSHIFT = 42
109
+ KEY_BACKSLASH = 43
110
+ KEY_Z = 44
111
+ KEY_X = 45
112
+ KEY_C = 46
113
+ KEY_V = 47
114
+ KEY_B = 48
115
+ KEY_N = 49
116
+ KEY_M = 50
117
+ KEY_COMMA = 51
118
+ KEY_DOT = 52
119
+ KEY_SLASH = 53
120
+ KEY_RIGHTSHIFT = 54
121
+ KEY_KPASTERISK = 55
122
+ KEY_LEFTALT = 56
123
+ KEY_SPACE = 57
124
+ KEY_CAPSLOCK = 58
125
+ KEY_F1 = 59
126
+ KEY_F2 = 60
127
+ KEY_F3 = 61
128
+ KEY_F4 = 62
129
+ KEY_F5 = 63
130
+ KEY_F6 = 64
131
+ KEY_F7 = 65
132
+ KEY_F8 = 66
133
+ KEY_F9 = 67
134
+ KEY_F10 = 68
135
+ KEY_NUMLOCK = 69
136
+ KEY_SCROLLLOCK = 70
137
+ KEY_KP7 = 71
138
+ KEY_KP8 = 72
139
+ KEY_KP9 = 73
140
+ KEY_KPMINUS = 74
141
+ KEY_KP4 = 75
142
+ KEY_KP5 = 76
143
+ KEY_KP6 = 77
144
+ KEY_KPPLUS = 78
145
+ KEY_KP1 = 79
146
+ KEY_KP2 = 80
147
+ KEY_KP3 = 81
148
+ KEY_KP0 = 82
149
+ KEY_KPDOT = 83
150
+ KEY_ZENKAKUHANKAKU = 85
151
+ KEY_102ND = 86
152
+ KEY_F11 = 87
153
+ KEY_F12 = 88
154
+ KEY_RO = 89
155
+ KEY_KATAKANA = 90
156
+ KEY_HIRAGANA = 91
157
+ KEY_HENKAN = 92
158
+ KEY_KATAKANAHIRAGANA = 93
159
+ KEY_MUHENKAN = 94
160
+ KEY_KPJPCOMMA = 95
161
+ KEY_KPENTER = 96
162
+ KEY_RIGHTCTRL = 97
163
+ KEY_KPSLASH = 98
164
+ KEY_SYSRQ = 99
165
+ KEY_RIGHTALT = 100
166
+ KEY_LINEFEED = 101
167
+ KEY_HOME = 102
168
+ KEY_UP = 103
169
+ KEY_PAGEUP = 104
170
+ KEY_LEFT = 105
171
+ KEY_RIGHT = 106
172
+ KEY_END = 107
173
+ KEY_DOWN = 108
174
+ KEY_PAGEDOWN = 109
175
+ KEY_INSERT = 110
176
+ KEY_DELETE = 111
177
+ KEY_MACRO = 112
178
+ KEY_MUTE = 113
179
+ KEY_VOLUMEDOWN = 114
180
+ KEY_VOLUMEUP = 115
181
+ KEY_POWER = 116
182
+ KEY_KPEQUAL = 117
183
+ KEY_KPPLUSMINUS = 118
184
+ KEY_PAUSE = 119
185
+ KEY_SCALE = 120
186
+ KEY_KPCOMMA = 121
187
+ KEY_HANGEUL = 122
188
+ KEY_HANGUEL = 122
189
+ KEY_HANJA = 123
190
+ KEY_YEN = 124
191
+ KEY_LEFTMETA = 125
192
+ KEY_RIGHTMETA = 126
193
+ KEY_COMPOSE = 127
194
+ KEY_STOP = 128
195
+ KEY_AGAIN = 129
196
+ KEY_PROPS = 130
197
+ KEY_UNDO = 131
198
+ KEY_FRONT = 132
199
+ KEY_COPY = 133
200
+ KEY_OPEN = 134
201
+ KEY_PASTE = 135
202
+ KEY_FIND = 136
203
+ KEY_CUT = 137
204
+ KEY_HELP = 138
205
+ KEY_MENU = 139
206
+ KEY_CALC = 140
207
+ KEY_SETUP = 141
208
+ KEY_SLEEP = 142
209
+ KEY_WAKEUP = 143
210
+ KEY_FILE = 144
211
+ KEY_SENDFILE = 145
212
+ KEY_DELETEFILE = 146
213
+ KEY_XFER = 147
214
+ KEY_PROG1 = 148
215
+ KEY_PROG2 = 149
216
+ KEY_WWW = 150
217
+ KEY_MSDOS = 151
218
+ KEY_COFFEE = 152
219
+ KEY_SCREENLOCK = 152
220
+ KEY_DIRECTION = 153
221
+ KEY_CYCLEWINDOWS = 154
222
+ KEY_MAIL = 155
223
+ KEY_BOOKMARKS = 156
224
+ KEY_COMPUTER = 157
225
+ KEY_BACK = 158
226
+ KEY_FORWARD = 159
227
+ KEY_CLOSECD = 160
228
+ KEY_EJECTCD = 161
229
+ KEY_EJECTCLOSECD = 162
230
+ KEY_NEXTSONG = 163
231
+ KEY_PLAYPAUSE = 164
232
+ KEY_PREVIOUSSONG = 165
233
+ KEY_STOPCD = 166
234
+ KEY_RECORD = 167
235
+ KEY_REWIND = 168
236
+ KEY_PHONE = 169
237
+ KEY_ISO = 170
238
+ KEY_CONFIG = 171
239
+ KEY_HOMEPAGE = 172
240
+ KEY_REFRESH = 173
241
+ KEY_EXIT = 174
242
+ KEY_MOVE = 175
243
+ KEY_EDIT = 176
244
+ KEY_SCROLLUP = 177
245
+ KEY_SCROLLDOWN = 178
246
+ KEY_KPLEFTPAREN = 179
247
+ KEY_KPRIGHTPAREN = 180
248
+ KEY_NEW = 181
249
+ KEY_REDO = 182
250
+ KEY_F13 = 183
251
+ KEY_F14 = 184
252
+ KEY_F15 = 185
253
+ KEY_F16 = 186
254
+ KEY_F17 = 187
255
+ KEY_F18 = 188
256
+ KEY_F19 = 189
257
+ KEY_F20 = 190
258
+ KEY_F21 = 191
259
+ KEY_F22 = 192
260
+ KEY_F23 = 193
261
+ KEY_F24 = 194
262
+ KEY_PLAYCD = 200
263
+ KEY_PAUSECD = 201
264
+ KEY_PROG3 = 202
265
+ KEY_PROG4 = 203
266
+ KEY_DASHBOARD = 204
267
+ KEY_SUSPEND = 205
268
+ KEY_CLOSE = 206
269
+ KEY_PLAY = 207
270
+ KEY_FASTFORWARD = 208
271
+ KEY_BASSBOOST = 209
272
+ KEY_PRINT = 210
273
+ KEY_HP = 211
274
+ KEY_CAMERA = 212
275
+ KEY_SOUND = 213
276
+ KEY_QUESTION = 214
277
+ KEY_EMAIL = 215
278
+ KEY_CHAT = 216
279
+ KEY_SEARCH = 217
280
+ KEY_CONNECT = 218
281
+ KEY_FINANCE = 219
282
+ KEY_SPORT = 220
283
+ KEY_SHOP = 221
284
+ KEY_ALTERASE = 222
285
+ KEY_CANCEL = 223
286
+ KEY_BRIGHTNESSDOWN = 224
287
+ KEY_BRIGHTNESSUP = 225
288
+ KEY_MEDIA = 226
289
+ KEY_SWITCHVIDEOMODE = 227
290
+ KEY_KBDILLUMTOGGLE = 228
291
+ KEY_KBDILLUMDOWN = 229
292
+ KEY_KBDILLUMUP = 230
293
+ KEY_SEND = 231
294
+ KEY_REPLY = 232
295
+ KEY_FORWARDMAIL = 233
296
+ KEY_SAVE = 234
297
+ KEY_DOCUMENTS = 235
298
+ KEY_BATTERY = 236
299
+ KEY_BLUETOOTH = 237
300
+ KEY_WLAN = 238
301
+ KEY_UWB = 239
302
+ KEY_UNKNOWN = 240
303
+ KEY_VIDEO_NEXT = 241
304
+ KEY_VIDEO_PREV = 242
305
+ KEY_BRIGHTNESS_CYCLE = 243
306
+ KEY_BRIGHTNESS_AUTO = 244
307
+ KEY_BRIGHTNESS_ZERO = 244
308
+ KEY_DISPLAY_OFF = 245
309
+ KEY_WWAN = 246
310
+ KEY_WIMAX = 246
311
+ KEY_RFKILL = 247
312
+ KEY_MICMUTE = 248
313
+ BTN_MISC = 0x100
314
+ BTN_0 = 0x100
315
+ BTN_1 = 0x101
316
+ BTN_2 = 0x102
317
+ BTN_3 = 0x103
318
+ BTN_4 = 0x104
319
+ BTN_5 = 0x105
320
+ BTN_6 = 0x106
321
+ BTN_7 = 0x107
322
+ BTN_8 = 0x108
323
+ BTN_9 = 0x109
324
+ BTN_MOUSE = 0x110
325
+ BTN_LEFT = 0x110
326
+ BTN_RIGHT = 0x111
327
+ BTN_MIDDLE = 0x112
328
+ BTN_SIDE = 0x113
329
+ BTN_EXTRA = 0x114
330
+ BTN_FORWARD = 0x115
331
+ BTN_BACK = 0x116
332
+ BTN_TASK = 0x117
333
+ BTN_JOYSTICK = 0x120
334
+ BTN_TRIGGER = 0x120
335
+ BTN_THUMB = 0x121
336
+ BTN_THUMB2 = 0x122
337
+ BTN_TOP = 0x123
338
+ BTN_TOP2 = 0x124
339
+ BTN_PINKIE = 0x125
340
+ BTN_BASE = 0x126
341
+ BTN_BASE2 = 0x127
342
+ BTN_BASE3 = 0x128
343
+ BTN_BASE4 = 0x129
344
+ BTN_BASE5 = 0x12a
345
+ BTN_BASE6 = 0x12b
346
+ BTN_DEAD = 0x12f
347
+ BTN_GAMEPAD = 0x130
348
+ BTN_SOUTH = 0x130
349
+ BTN_A = 0x130
350
+ BTN_EAST = 0x131
351
+ BTN_B = 0x131
352
+ BTN_C = 0x132
353
+ BTN_NORTH = 0x133
354
+ BTN_X = 0x133
355
+ BTN_WEST = 0x134
356
+ BTN_Y = 0x134
357
+ BTN_Z = 0x135
358
+ BTN_TL = 0x136
359
+ BTN_TR = 0x137
360
+ BTN_TL2 = 0x138
361
+ BTN_TR2 = 0x139
362
+ BTN_SELECT = 0x13a
363
+ BTN_START = 0x13b
364
+ BTN_MODE = 0x13c
365
+ BTN_THUMBL = 0x13d
366
+ BTN_THUMBR = 0x13e
367
+ BTN_DIGI = 0x140
368
+ BTN_TOOL_PEN = 0x140
369
+ BTN_TOOL_RUBBER = 0x141
370
+ BTN_TOOL_BRUSH = 0x142
371
+ BTN_TOOL_PENCIL = 0x143
372
+ BTN_TOOL_AIRBRUSH = 0x144
373
+ BTN_TOOL_FINGER = 0x145
374
+ BTN_TOOL_MOUSE = 0x146
375
+ BTN_TOOL_LENS = 0x147
376
+ BTN_TOOL_QUINTTAP = 0x148
377
+ BTN_TOUCH = 0x14a
378
+ BTN_STYLUS = 0x14b
379
+ BTN_STYLUS2 = 0x14c
380
+ BTN_TOOL_DOUBLETAP = 0x14d
381
+ BTN_TOOL_TRIPLETAP = 0x14e
382
+ BTN_TOOL_QUADTAP = 0x14f
383
+ BTN_WHEEL = 0x150
384
+ BTN_GEAR_DOWN = 0x150
385
+ BTN_GEAR_UP = 0x151
386
+ KEY_OK = 0x160
387
+ KEY_SELECT = 0x161
388
+ KEY_GOTO = 0x162
389
+ KEY_CLEAR = 0x163
390
+ KEY_POWER2 = 0x164
391
+ KEY_OPTION = 0x165
392
+ KEY_INFO = 0x166
393
+ KEY_TIME = 0x167
394
+ KEY_VENDOR = 0x168
395
+ KEY_ARCHIVE = 0x169
396
+ KEY_PROGRAM = 0x16a
397
+ KEY_CHANNEL = 0x16b
398
+ KEY_FAVORITES = 0x16c
399
+ KEY_EPG = 0x16d
400
+ KEY_PVR = 0x16e
401
+ KEY_MHP = 0x16f
402
+ KEY_LANGUAGE = 0x170
403
+ KEY_TITLE = 0x171
404
+ KEY_SUBTITLE = 0x172
405
+ KEY_ANGLE = 0x173
406
+ KEY_ZOOM = 0x174
407
+ KEY_MODE = 0x175
408
+ KEY_KEYBOARD = 0x176
409
+ KEY_SCREEN = 0x177
410
+ KEY_PC = 0x178
411
+ KEY_TV = 0x179
412
+ KEY_TV2 = 0x17a
413
+ KEY_VCR = 0x17b
414
+ KEY_VCR2 = 0x17c
415
+ KEY_SAT = 0x17d
416
+ KEY_SAT2 = 0x17e
417
+ KEY_CD = 0x17f
418
+ KEY_TAPE = 0x180
419
+ KEY_RADIO = 0x181
420
+ KEY_TUNER = 0x182
421
+ KEY_PLAYER = 0x183
422
+ KEY_TEXT = 0x184
423
+ KEY_DVD = 0x185
424
+ KEY_AUX = 0x186
425
+ KEY_MP3 = 0x187
426
+ KEY_AUDIO = 0x188
427
+ KEY_VIDEO = 0x189
428
+ KEY_DIRECTORY = 0x18a
429
+ KEY_LIST = 0x18b
430
+ KEY_MEMO = 0x18c
431
+ KEY_CALENDAR = 0x18d
432
+ KEY_RED = 0x18e
433
+ KEY_GREEN = 0x18f
434
+ KEY_YELLOW = 0x190
435
+ KEY_BLUE = 0x191
436
+ KEY_CHANNELUP = 0x192
437
+ KEY_CHANNELDOWN = 0x193
438
+ KEY_FIRST = 0x194
439
+ KEY_LAST = 0x195
440
+ KEY_AB = 0x196
441
+ KEY_NEXT = 0x197
442
+ KEY_RESTART = 0x198
443
+ KEY_SLOW = 0x199
444
+ KEY_SHUFFLE = 0x19a
445
+ KEY_BREAK = 0x19b
446
+ KEY_PREVIOUS = 0x19c
447
+ KEY_DIGITS = 0x19d
448
+ KEY_TEEN = 0x19e
449
+ KEY_TWEN = 0x19f
450
+ KEY_VIDEOPHONE = 0x1a0
451
+ KEY_GAMES = 0x1a1
452
+ KEY_ZOOMIN = 0x1a2
453
+ KEY_ZOOMOUT = 0x1a3
454
+ KEY_ZOOMRESET = 0x1a4
455
+ KEY_WORDPROCESSOR = 0x1a5
456
+ KEY_EDITOR = 0x1a6
457
+ KEY_SPREADSHEET = 0x1a7
458
+ KEY_GRAPHICSEDITOR = 0x1a8
459
+ KEY_PRESENTATION = 0x1a9
460
+ KEY_DATABASE = 0x1aa
461
+ KEY_NEWS = 0x1ab
462
+ KEY_VOICEMAIL = 0x1ac
463
+ KEY_ADDRESSBOOK = 0x1ad
464
+ KEY_MESSENGER = 0x1ae
465
+ KEY_DISPLAYTOGGLE = 0x1af
466
+ KEY_BRIGHTNESS_TOGGLE = 0x1af
467
+ KEY_SPELLCHECK = 0x1b0
468
+ KEY_LOGOFF = 0x1b1
469
+ KEY_DOLLAR = 0x1b2
470
+ KEY_EURO = 0x1b3
471
+ KEY_FRAMEBACK = 0x1b4
472
+ KEY_FRAMEFORWARD = 0x1b5
473
+ KEY_CONTEXT_MENU = 0x1b6
474
+ KEY_MEDIA_REPEAT = 0x1b7
475
+ KEY_10CHANNELSUP = 0x1b8
476
+ KEY_10CHANNELSDOWN = 0x1b9
477
+ KEY_IMAGES = 0x1ba
478
+ KEY_DEL_EOL = 0x1c0
479
+ KEY_DEL_EOS = 0x1c1
480
+ KEY_INS_LINE = 0x1c2
481
+ KEY_DEL_LINE = 0x1c3
482
+ KEY_FN = 0x1d0
483
+ KEY_FN_ESC = 0x1d1
484
+ KEY_FN_F1 = 0x1d2
485
+ KEY_FN_F2 = 0x1d3
486
+ KEY_FN_F3 = 0x1d4
487
+ KEY_FN_F4 = 0x1d5
488
+ KEY_FN_F5 = 0x1d6
489
+ KEY_FN_F6 = 0x1d7
490
+ KEY_FN_F7 = 0x1d8
491
+ KEY_FN_F8 = 0x1d9
492
+ KEY_FN_F9 = 0x1da
493
+ KEY_FN_F10 = 0x1db
494
+ KEY_FN_F11 = 0x1dc
495
+ KEY_FN_F12 = 0x1dd
496
+ KEY_FN_1 = 0x1de
497
+ KEY_FN_2 = 0x1df
498
+ KEY_FN_D = 0x1e0
499
+ KEY_FN_E = 0x1e1
500
+ KEY_FN_F = 0x1e2
501
+ KEY_FN_S = 0x1e3
502
+ KEY_FN_B = 0x1e4
503
+ KEY_BRL_DOT1 = 0x1f1
504
+ KEY_BRL_DOT2 = 0x1f2
505
+ KEY_BRL_DOT3 = 0x1f3
506
+ KEY_BRL_DOT4 = 0x1f4
507
+ KEY_BRL_DOT5 = 0x1f5
508
+ KEY_BRL_DOT6 = 0x1f6
509
+ KEY_BRL_DOT7 = 0x1f7
510
+ KEY_BRL_DOT8 = 0x1f8
511
+ KEY_BRL_DOT9 = 0x1f9
512
+ KEY_BRL_DOT10 = 0x1fa
513
+ KEY_NUMERIC_0 = 0x200
514
+ KEY_NUMERIC_1 = 0x201
515
+ KEY_NUMERIC_2 = 0x202
516
+ KEY_NUMERIC_3 = 0x203
517
+ KEY_NUMERIC_4 = 0x204
518
+ KEY_NUMERIC_5 = 0x205
519
+ KEY_NUMERIC_6 = 0x206
520
+ KEY_NUMERIC_7 = 0x207
521
+ KEY_NUMERIC_8 = 0x208
522
+ KEY_NUMERIC_9 = 0x209
523
+ KEY_NUMERIC_STAR = 0x20a
524
+ KEY_NUMERIC_POUND = 0x20b
525
+ KEY_CAMERA_FOCUS = 0x210
526
+ KEY_WPS_BUTTON = 0x211
527
+ KEY_TOUCHPAD_TOGGLE = 0x212
528
+ KEY_TOUCHPAD_ON = 0x213
529
+ KEY_TOUCHPAD_OFF = 0x214
530
+ KEY_CAMERA_ZOOMIN = 0x215
531
+ KEY_CAMERA_ZOOMOUT = 0x216
532
+ KEY_CAMERA_UP = 0x217
533
+ KEY_CAMERA_DOWN = 0x218
534
+ KEY_CAMERA_LEFT = 0x219
535
+ KEY_CAMERA_RIGHT = 0x21a
536
+ KEY_ATTENDANT_ON = 0x21b
537
+ KEY_ATTENDANT_OFF = 0x21c
538
+ KEY_ATTENDANT_TOGGLE = 0x21d
539
+ KEY_LIGHTS_TOGGLE = 0x21e
540
+ BTN_DPAD_UP = 0x220
541
+ BTN_DPAD_DOWN = 0x221
542
+ BTN_DPAD_LEFT = 0x222
543
+ BTN_DPAD_RIGHT = 0x223
544
+ KEY_ALS_TOGGLE = 0x230
545
+ KEY_BUTTONCONFIG = 0x240
546
+ KEY_TASKMANAGER = 0x241
547
+ KEY_JOURNAL = 0x242
548
+ KEY_CONTROLPANEL = 0x243
549
+ KEY_APPSELECT = 0x244
550
+ KEY_SCREENSAVER = 0x245
551
+ KEY_VOICECOMMAND = 0x246
552
+ KEY_BRIGHTNESS_MIN = 0x250
553
+ KEY_BRIGHTNESS_MAX = 0x251
554
+ KEY_KBDINPUTASSIST_PREV = 0x260
555
+ KEY_KBDINPUTASSIST_NEXT = 0x261
556
+ KEY_KBDINPUTASSIST_PREVGROUP = 0x262
557
+ KEY_KBDINPUTASSIST_NEXTGROUP = 0x263
558
+ KEY_KBDINPUTASSIST_ACCEPT = 0x264
559
+ KEY_KBDINPUTASSIST_CANCEL = 0x265
560
+ BTN_TRIGGER_HAPPY = 0x2c0
561
+ BTN_TRIGGER_HAPPY1 = 0x2c0
562
+ BTN_TRIGGER_HAPPY2 = 0x2c1
563
+ BTN_TRIGGER_HAPPY3 = 0x2c2
564
+ BTN_TRIGGER_HAPPY4 = 0x2c3
565
+ BTN_TRIGGER_HAPPY5 = 0x2c4
566
+ BTN_TRIGGER_HAPPY6 = 0x2c5
567
+ BTN_TRIGGER_HAPPY7 = 0x2c6
568
+ BTN_TRIGGER_HAPPY8 = 0x2c7
569
+ BTN_TRIGGER_HAPPY9 = 0x2c8
570
+ BTN_TRIGGER_HAPPY10 = 0x2c9
571
+ BTN_TRIGGER_HAPPY11 = 0x2ca
572
+ BTN_TRIGGER_HAPPY12 = 0x2cb
573
+ BTN_TRIGGER_HAPPY13 = 0x2cc
574
+ BTN_TRIGGER_HAPPY14 = 0x2cd
575
+ BTN_TRIGGER_HAPPY15 = 0x2ce
576
+ BTN_TRIGGER_HAPPY16 = 0x2cf
577
+ BTN_TRIGGER_HAPPY17 = 0x2d0
578
+ BTN_TRIGGER_HAPPY18 = 0x2d1
579
+ BTN_TRIGGER_HAPPY19 = 0x2d2
580
+ BTN_TRIGGER_HAPPY20 = 0x2d3
581
+ BTN_TRIGGER_HAPPY21 = 0x2d4
582
+ BTN_TRIGGER_HAPPY22 = 0x2d5
583
+ BTN_TRIGGER_HAPPY23 = 0x2d6
584
+ BTN_TRIGGER_HAPPY24 = 0x2d7
585
+ BTN_TRIGGER_HAPPY25 = 0x2d8
586
+ BTN_TRIGGER_HAPPY26 = 0x2d9
587
+ BTN_TRIGGER_HAPPY27 = 0x2da
588
+ BTN_TRIGGER_HAPPY28 = 0x2db
589
+ BTN_TRIGGER_HAPPY29 = 0x2dc
590
+ BTN_TRIGGER_HAPPY30 = 0x2dd
591
+ BTN_TRIGGER_HAPPY31 = 0x2de
592
+ BTN_TRIGGER_HAPPY32 = 0x2df
593
+ BTN_TRIGGER_HAPPY33 = 0x2e0
594
+ BTN_TRIGGER_HAPPY34 = 0x2e1
595
+ BTN_TRIGGER_HAPPY35 = 0x2e2
596
+ BTN_TRIGGER_HAPPY36 = 0x2e3
597
+ BTN_TRIGGER_HAPPY37 = 0x2e4
598
+ BTN_TRIGGER_HAPPY38 = 0x2e5
599
+ BTN_TRIGGER_HAPPY39 = 0x2e6
600
+ BTN_TRIGGER_HAPPY40 = 0x2e7
601
+ KEY_MIN_INTERESTING = 113
602
+ KEY_MAX = 0x2ff
603
+ KEY_CNT = (0x2ff+1)
604
+ REL_X = 0x00
605
+ REL_Y = 0x01
606
+ REL_Z = 0x02
607
+ REL_RX = 0x03
608
+ REL_RY = 0x04
609
+ REL_RZ = 0x05
610
+ REL_HWHEEL = 0x06
611
+ REL_DIAL = 0x07
612
+ REL_WHEEL = 0x08
613
+ REL_MISC = 0x09
614
+ REL_MAX = 0x0f
615
+ REL_CNT = (0x0f+1)
616
+ ABS_X = 0x00
617
+ ABS_Y = 0x01
618
+ ABS_Z = 0x02
619
+ ABS_RX = 0x03
620
+ ABS_RY = 0x04
621
+ ABS_RZ = 0x05
622
+ ABS_THROTTLE = 0x06
623
+ ABS_RUDDER = 0x07
624
+ ABS_WHEEL = 0x08
625
+ ABS_GAS = 0x09
626
+ ABS_BRAKE = 0x0a
627
+ ABS_HAT0X = 0x10
628
+ ABS_HAT0Y = 0x11
629
+ ABS_HAT1X = 0x12
630
+ ABS_HAT1Y = 0x13
631
+ ABS_HAT2X = 0x14
632
+ ABS_HAT2Y = 0x15
633
+ ABS_HAT3X = 0x16
634
+ ABS_HAT3Y = 0x17
635
+ ABS_PRESSURE = 0x18
636
+ ABS_DISTANCE = 0x19
637
+ ABS_TILT_X = 0x1a
638
+ ABS_TILT_Y = 0x1b
639
+ ABS_TOOL_WIDTH = 0x1c
640
+ ABS_VOLUME = 0x20
641
+ ABS_MISC = 0x28
642
+ ABS_MT_SLOT = 0x2f
643
+ ABS_MT_TOUCH_MAJOR = 0x30
644
+ ABS_MT_TOUCH_MINOR = 0x31
645
+ ABS_MT_WIDTH_MAJOR = 0x32
646
+ ABS_MT_WIDTH_MINOR = 0x33
647
+ ABS_MT_ORIENTATION = 0x34
648
+ ABS_MT_POSITION_X = 0x35
649
+ ABS_MT_POSITION_Y = 0x36
650
+ ABS_MT_TOOL_TYPE = 0x37
651
+ ABS_MT_BLOB_ID = 0x38
652
+ ABS_MT_TRACKING_ID = 0x39
653
+ ABS_MT_PRESSURE = 0x3a
654
+ ABS_MT_DISTANCE = 0x3b
655
+ ABS_MT_TOOL_X = 0x3c
656
+ ABS_MT_TOOL_Y = 0x3d
657
+ ABS_MAX = 0x3f
658
+ ABS_CNT = (0x3f+1)
659
+ SW_LID = 0x00
660
+ SW_TABLET_MODE = 0x01
661
+ SW_HEADPHONE_INSERT = 0x02
662
+ SW_RFKILL_ALL = 0x03
663
+ SW_RADIO = 0x03
664
+ SW_MICROPHONE_INSERT = 0x04
665
+ SW_DOCK = 0x05
666
+ SW_LINEOUT_INSERT = 0x06
667
+ SW_JACK_PHYSICAL_INSERT = 0x07
668
+ SW_VIDEOOUT_INSERT = 0x08
669
+ SW_CAMERA_LENS_COVER = 0x09
670
+ SW_KEYPAD_SLIDE = 0x0a
671
+ SW_FRONT_PROXIMITY = 0x0b
672
+ SW_ROTATE_LOCK = 0x0c
673
+ SW_LINEIN_INSERT = 0x0d
674
+ SW_MUTE_DEVICE = 0x0e
675
+ SW_MAX = 0x0f
676
+ SW_CNT = (0x0f+1)
677
+ MSC_SERIAL = 0x00
678
+ MSC_PULSELED = 0x01
679
+ MSC_GESTURE = 0x02
680
+ MSC_RAW = 0x03
681
+ MSC_SCAN = 0x04
682
+ MSC_TIMESTAMP = 0x05
683
+ MSC_MAX = 0x07
684
+ MSC_CNT = (0x07+1)
685
+ LED_NUML = 0x00
686
+ LED_CAPSL = 0x01
687
+ LED_SCROLLL = 0x02
688
+ LED_COMPOSE = 0x03
689
+ LED_KANA = 0x04
690
+ LED_SLEEP = 0x05
691
+ LED_SUSPEND = 0x06
692
+ LED_MUTE = 0x07
693
+ LED_MISC = 0x08
694
+ LED_MAIL = 0x09
695
+ LED_CHARGING = 0x0a
696
+ LED_MAX = 0x0f
697
+ LED_CNT = (0x0f+1)
698
+ REP_DELAY = 0x00
699
+ REP_PERIOD = 0x01
700
+ REP_MAX = 0x01
701
+ REP_CNT = (0x01+1)
702
+ SND_CLICK = 0x00
703
+ SND_BELL = 0x01
704
+ SND_TONE = 0x02
705
+ SND_MAX = 0x07
706
+ SND_CNT = (0x07+1)
707
+ ID_BUS = 0
708
+ ID_VENDOR = 1
709
+ ID_PRODUCT = 2
710
+ ID_VERSION = 3
711
+ BUS_PCI = 0x01
712
+ BUS_ISAPNP = 0x02
713
+ BUS_USB = 0x03
714
+ BUS_HIL = 0x04
715
+ BUS_BLUETOOTH = 0x05
716
+ BUS_VIRTUAL = 0x06
717
+ BUS_ISA = 0x10
718
+ BUS_I8042 = 0x11
719
+ BUS_XTKBD = 0x12
720
+ BUS_RS232 = 0x13
721
+ BUS_GAMEPORT = 0x14
722
+ BUS_PARPORT = 0x15
723
+ BUS_AMIGA = 0x16
724
+ BUS_ADB = 0x17
725
+ BUS_I2C = 0x18
726
+ BUS_HOST = 0x19
727
+ BUS_GSC = 0x1A
728
+ BUS_ATARI = 0x1B
729
+ BUS_SPI = 0x1C
730
+ MT_TOOL_FINGER = 0
731
+ MT_TOOL_PEN = 1
732
+ MT_TOOL_MAX = 1
733
+ FF_STATUS_STOPPED = 0x00
734
+ FF_STATUS_PLAYING = 0x01
735
+ FF_STATUS_MAX = 0x01
736
+ class FfReplay < FFI::Struct
737
+ layout(
738
+ :length, :ushort,
739
+ :delay, :ushort
740
+ )
741
+ end
742
+ class FfTrigger < FFI::Struct
743
+ layout(
744
+ :button, :ushort,
745
+ :interval, :ushort
746
+ )
747
+ end
748
+ class FfEnvelope < FFI::Struct
749
+ layout(
750
+ :attack_length, :ushort,
751
+ :attack_level, :ushort,
752
+ :fade_length, :ushort,
753
+ :fade_level, :ushort
754
+ )
755
+ end
756
+ class FfConstantEffect < FFI::Struct
757
+ layout(
758
+ :level, :short,
759
+ :envelope, FfEnvelope
760
+ )
761
+ end
762
+ class FfRampEffect < FFI::Struct
763
+ layout(
764
+ :start_level, :short,
765
+ :end_level, :short,
766
+ :envelope, FfEnvelope
767
+ )
768
+ end
769
+ class FfConditionEffect < FFI::Struct
770
+ layout(
771
+ :right_saturation, :ushort,
772
+ :left_saturation, :ushort,
773
+ :right_coeff, :short,
774
+ :left_coeff, :short,
775
+ :deadband, :ushort,
776
+ :center, :short
777
+ )
778
+ end
779
+ class FfPeriodicEffect < FFI::Struct
780
+ layout(
781
+ :waveform, :ushort,
782
+ :period, :ushort,
783
+ :magnitude, :short,
784
+ :offset, :short,
785
+ :phase, :ushort,
786
+ :envelope, FfEnvelope,
787
+ :custom_len, :uint,
788
+ :custom_data, :pointer
789
+ )
790
+ end
791
+ class FfRumbleEffect < FFI::Struct
792
+ layout(
793
+ :strong_magnitude, :ushort,
794
+ :weak_magnitude, :ushort
795
+ )
796
+ end
797
+ class FfEffectU < FFI::Union
798
+ layout(
799
+ :constant, FfConstantEffect,
800
+ :ramp, FfRampEffect,
801
+ :periodic, FfPeriodicEffect,
802
+ :condition, [FfConditionEffect, 2],
803
+ :rumble, FfRumbleEffect
804
+ )
805
+ end
806
+ class FfEffect < FFI::Struct
807
+ layout(
808
+ :type, :ushort,
809
+ :id, :short,
810
+ :direction, :ushort,
811
+ :trigger, FfTrigger,
812
+ :replay, FfReplay,
813
+ :u, FfEffectU
814
+ )
815
+ end
816
+ FF_RUMBLE = 0x50
817
+ FF_PERIODIC = 0x51
818
+ FF_CONSTANT = 0x52
819
+ FF_SPRING = 0x53
820
+ FF_FRICTION = 0x54
821
+ FF_DAMPER = 0x55
822
+ FF_INERTIA = 0x56
823
+ FF_RAMP = 0x57
824
+ FF_EFFECT_MIN = 0x50
825
+ FF_EFFECT_MAX = 0x57
826
+ FF_SQUARE = 0x58
827
+ FF_TRIANGLE = 0x59
828
+ FF_SINE = 0x5a
829
+ FF_SAW_UP = 0x5b
830
+ FF_SAW_DOWN = 0x5c
831
+ FF_CUSTOM = 0x5d
832
+ FF_WAVEFORM_MIN = 0x58
833
+ FF_WAVEFORM_MAX = 0x5d
834
+ FF_GAIN = 0x60
835
+ FF_AUTOCENTER = 0x61
836
+ FF_MAX = 0x7f
837
+ FF_CNT = (0x7f+1)
@@ -0,0 +1,20 @@
1
+ IOC_NRBITS = 8
2
+ IOC_TYPEBITS = 8
3
+ IOC_SIZEBITS = 14
4
+ IOC_DIRBITS = 2
5
+ IOC_NRMASK = ((1 << 8) -1)
6
+ IOC_TYPEMASK = ((1 << 8) -1)
7
+ IOC_SIZEMASK = ((1 << 14) -1)
8
+ IOC_DIRMASK = ((1 << 2) -1)
9
+ IOC_NRSHIFT = 0
10
+ IOC_TYPESHIFT = (0+8)
11
+ IOC_SIZESHIFT = ((0+8) +8)
12
+ IOC_DIRSHIFT = (((0+8) +8) +14)
13
+ IOC_NONE = 0
14
+ IOC_WRITE = 1
15
+ IOC_READ = 2
16
+ IOC_IN = (1 << (((0+8) +8) +14))
17
+ IOC_OUT = (2 << (((0+8) +8) +14))
18
+ IOC_INOUT = ((1|2) << (((0+8) +8) +14))
19
+ IOCSIZE_MASK = (((1 << 14) -1) << ((0+8) +8))
20
+ IOCSIZE_SHIFT = (((0+8) +8))
@@ -0,0 +1,32 @@
1
+ UINPUT_VERSION = 4
2
+ class UinputFfUpload < FFI::Struct
3
+ layout(
4
+ :request_id, :uint,
5
+ :retval, :int,
6
+ :effect, FfEffect,
7
+ :old, FfEffect
8
+ )
9
+ end
10
+ class UinputFfErase < FFI::Struct
11
+ layout(
12
+ :request_id, :uint,
13
+ :retval, :int,
14
+ :effect_id, :uint
15
+ )
16
+ end
17
+ UINPUT_IOCTL_BASE = ?U.ord
18
+ EV_UINPUT = 0x0101
19
+ UI_FF_UPLOAD = 1
20
+ UI_FF_ERASE = 2
21
+ UINPUT_MAX_NAME_SIZE = 80
22
+ class UinputUserDev < FFI::Struct
23
+ layout(
24
+ :name, [:char, 80],
25
+ :id, InputId,
26
+ :ff_effects_max, :uint,
27
+ :absmax, [:int, ABS_CNT],
28
+ :absmin, [:int, ABS_CNT],
29
+ :absfuzz, [:int, ABS_CNT],
30
+ :absflat, [:int, ABS_CNT]
31
+ )
32
+ end
@@ -0,0 +1,43 @@
1
+ class Timeval < FFI::Struct
2
+ layout(
3
+ :tv_sec, :__time_t,
4
+ :tv_usec, :__suseconds_t
5
+ )
6
+ end
7
+
8
+ module Uinput
9
+ class_eval File.read(File.join(File.dirname(__FILE__), 'generated/input.rb'))
10
+
11
+ INPUT_IOCTL_BASE = ?E.ord
12
+
13
+ EVIOCGVERSION = Ioctl.IOR(INPUT_IOCTL_BASE, 0x01, :int)
14
+ EVIOCGID = Ioctl.IOR(INPUT_IOCTL_BASE, 0x02, InputId.by_value)
15
+ EVIOCGREP = Ioctl.IOR(INPUT_IOCTL_BASE, 0x03, :pointer)
16
+ EVIOCSREP = Ioctl.IOW(INPUT_IOCTL_BASE, 0x03, :pointer)
17
+ EVIOCGKEYCODE = Ioctl.IOR(INPUT_IOCTL_BASE, 0x04, :pointer)
18
+ EVIOCGKEYCODE_V2 = Ioctl.IOR(INPUT_IOCTL_BASE, 0x04, InputKeymapEntry.by_value)
19
+ EVIOCSKEYCODE = Ioctl.IOW(INPUT_IOCTL_BASE, 0x04, :pointer)
20
+ EVIOCSKEYCODE_V2 = Ioctl.IOW(INPUT_IOCTL_BASE, 0x04, InputKeymapEntry.by_value)
21
+
22
+ class << self
23
+ def EVIOCGNAME(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x06, len) end
24
+ def EVIOCGPHYS(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x07, len) end
25
+ def EVIOCGUNIQ(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x08, len) end
26
+ def EVIOCGPROP(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x09, len) end
27
+ def EVIOCGMTSLOTS(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x0a, len) end
28
+ def EVIOCGKEY(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x18, len) end
29
+ def EVIOCGLED(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x19, len) end
30
+ def EVIOCGSND(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x1a, len) end
31
+ def EVIOCGSW(len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x1b, len) end
32
+ def EVIOCGBIT(ev, len) Ioctl.IOC(Ioctl::IOC_READ, INPUT_IOCTL_BASE, 0x20 + ev, len) end
33
+ def EVIOCGABS(abs) Ioctl.IOR(INPUT_IOCTL_BASE, 0x40 + abs, InputAbsinfo.by_value) end
34
+ def EVIOCSABS(abs) Ioctl.IOW(INPUT_IOCTL_BASE, 0xc0 + abs, InputAbsinfo.by_value) end
35
+ end
36
+
37
+ EVIOCSFF = Ioctl.IOC(Ioctl::IOC_WRITE, INPUT_IOCTL_BASE, 0x80, FfEffect.size)
38
+ EVIOCRMFF = Ioctl.IOW(INPUT_IOCTL_BASE, 0x81, :int)
39
+ EVIOCGEFFECTS = Ioctl.IOR(INPUT_IOCTL_BASE, 0x84, :int)
40
+ EVIOCGRAB = Ioctl.IOW(INPUT_IOCTL_BASE, 0x90, :int)
41
+ EVIOCREVOKE = Ioctl.IOW(INPUT_IOCTL_BASE, 0x91, :int)
42
+ EVIOCSCLOCKID = Ioctl.IOW(INPUT_IOCTL_BASE, 0xa0, :int)
43
+ end
@@ -0,0 +1,25 @@
1
+ module Uinput
2
+ module Ioctl
3
+ class_eval File.read(File.join(File.dirname(__FILE__), 'generated/ioctl.rb'))
4
+
5
+ class << self
6
+ def IOC(dir, type, nr, size)
7
+ (dir << IOC_DIRSHIFT) | (type << IOC_TYPESHIFT) | (nr << IOC_NRSHIFT) | (size << IOC_SIZESHIFT)
8
+ end
9
+
10
+ def IO(type, nr) IOC(IOC_NONE, type, nr, 0) end
11
+ def IOR(type, nr, size) IOC(IOC_READ, type, nr, FFI.type_size(size)) end
12
+ def IOW(type, nr, size) IOC(IOC_WRITE, type, nr, FFI.type_size(size)) end
13
+ def IOWR(type, nr, size) IOC(IOC_READ | IOC_WRITE, type, nr, FFI.type_size(size)) end
14
+ def IOR_BAD(type, nr, size) IOC(IOC_READ, type, nr, FFI.type_size(size)) end
15
+ def IOW_BAD(type, nr, size) IOC(IOC_WRITE, type, nr, FFI.type_size(size)) end
16
+ def IOWR_BAD(type, nr, size) IOC(IOC_READ | IOC_WRITE, type, nr, FFI.type_size(size)) end
17
+
18
+ def IOC_DIR(nr) (nr >> IOC_DIRSHIFT) & IOC_DIRMASK end
19
+ def IOC_TYPE(nr) (nr >> IOC_TYPESHIFT) & IOC_TYPEMASK end
20
+ def IOC_NR(nr) (nr >> IOC_NRSHIFT) & IOC_NRMASK end
21
+ def IOC_SIZE(nr) (nr >> IOC_SIZESHIFT) & IOC_SIZEMASK end
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,26 @@
1
+ module Uinput
2
+ class_eval File.read(File.join(File.dirname(__FILE__), 'generated/uinput.rb'))
3
+
4
+ UI_DEV_CREATE = Ioctl.IO(UINPUT_IOCTL_BASE, 1)
5
+ UI_DEV_DESTROY = Ioctl.IO(UINPUT_IOCTL_BASE, 2)
6
+
7
+ UI_SET_EVBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 100, :int)
8
+ UI_SET_KEYBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 101, :int)
9
+ UI_SET_RELBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 102, :int)
10
+ UI_SET_ABSBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 103, :int)
11
+ UI_SET_MSCBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 104, :int)
12
+ UI_SET_LEDBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 105, :int)
13
+ UI_SET_SNDBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 106, :int)
14
+ UI_SET_FFBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 107, :int)
15
+ UI_SET_PHYS = Ioctl.IOW(UINPUT_IOCTL_BASE, 108, :pointer)
16
+ UI_SET_SWBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 109, :int)
17
+ UI_SET_PROPBIT = Ioctl.IOW(UINPUT_IOCTL_BASE, 110, :int)
18
+
19
+ UI_BEGIN_FF_UPLOAD = Ioctl.IOWR(UINPUT_IOCTL_BASE, 200, UinputFfUpload.by_value)
20
+ UI_END_FF_UPLOAD = Ioctl.IOW(UINPUT_IOCTL_BASE, 201, UinputFfUpload.by_value)
21
+ UI_BEGIN_FF_ERASE = Ioctl.IOWR(UINPUT_IOCTL_BASE, 202, UinputFfErase.by_value)
22
+ UI_END_FF_ERASE = Ioctl.IOW(UINPUT_IOCTL_BASE, 203, UinputFfErase.by_value)
23
+
24
+ def self.UI_GET_SYSNAME(len) Ioctl.IOC(Ioctl::IOC_READ, UINPUT_IOCTL_BASE, 300, len) end
25
+ UI_GET_VERSION = Ioctl.IOR(UINPUT_IOCTL_BASE, 301, :uint)
26
+ end
@@ -0,0 +1,3 @@
1
+ module Uinput
2
+ VERSION = "1.0.0"
3
+ end
data/lib/uinput.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "uinput/version"
2
+ require 'ffi'
3
+
4
+ module Uinput
5
+
6
+ end
7
+
8
+ require 'uinput/ioctl.rb'
9
+ require 'uinput/input.rb'
10
+ require 'uinput/uinput.rb'
data/swig/input.i ADDED
@@ -0,0 +1,20 @@
1
+ %module input
2
+
3
+ typedef char __s8;
4
+ typedef unsigned char __u8;
5
+
6
+ typedef short __s16;
7
+ typedef unsigned short __u16;
8
+
9
+ typedef int __s32;
10
+ typedef unsigned int __u32;
11
+
12
+ #ifdef __GNUC__
13
+ __extension__ typedef long long __s64;
14
+ __extension__ typedef unsigned long long __u64;
15
+ #else
16
+ typedef long long __s64;
17
+ typedef unsigned long long __u64;
18
+ #endif
19
+
20
+ %include "linux/input.h"
data/swig/ioctl.i ADDED
@@ -0,0 +1,2 @@
1
+ %module ioctl
2
+ %include "asm-generic/ioctl.h"
data/swig/uinput.i ADDED
@@ -0,0 +1,20 @@
1
+ %module uinput
2
+
3
+ typedef char __s8;
4
+ typedef unsigned char __u8;
5
+
6
+ typedef short __s16;
7
+ typedef unsigned short __u16;
8
+
9
+ typedef int __s32;
10
+ typedef unsigned int __u32;
11
+
12
+ #ifdef __GNUC__
13
+ __extension__ typedef long long __s64;
14
+ __extension__ typedef unsigned long long __u64;
15
+ #else
16
+ typedef long long __s64;
17
+ typedef unsigned long long __u64;
18
+ #endif
19
+
20
+ %include "linux/uinput.h"
data/tasks/ffi.rake ADDED
@@ -0,0 +1,20 @@
1
+ namespace :ffi do
2
+ desc 'Generate ffi interface'
3
+ task :generate do
4
+ `swig -xml -o ioctl_wrap.xml -I/usr/include swig/ioctl.i`
5
+ `swig -xml -o input_wrap.xml -I/usr/include swig/input.i`
6
+ `swig -xml -o uinput_wrap.xml -I/usr/include swig/uinput.i`
7
+
8
+ `ffi-gen ioctl_wrap.xml lib/uinput/generated/ioctl.rb`
9
+ `ffi-gen input_wrap.xml lib/uinput/generated/input.rb`
10
+ `ffi-gen uinput_wrap.xml lib/uinput/generated/uinput.rb`
11
+
12
+ `sed -i 's/\\([0-9]\\)U/\\1/g' lib/uinput/generated/ioctl.rb`
13
+ `sed -i 's/_IO/IO/g' lib/uinput/generated/ioctl.rb`
14
+ `sed -i 's/ff_effect_u/FfEffectU/g' lib/uinput/generated/input.rb`
15
+ `sed -i 's/UINPUT_IOCTL_BASE = U/UINPUT_IOCTL_BASE = ?U.ord/g' lib/uinput/generated/uinput.rb`
16
+ `sed -i 's/a(ABS_CNT).__s32/[:int, ABS_CNT]/g' lib/uinput/generated/uinput.rb`
17
+
18
+ `rm -f ioctl_wrap.xml uinput_wrap.xml input_wrap.xml`
19
+ end
20
+ end
data/uinput.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'uinput/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "uinput"
8
+ spec.version = Uinput::VERSION
9
+ spec.authors = ["Christopher Aue"]
10
+ spec.email = ["mail@christopheraue.net"]
11
+
12
+ spec.summary = %q{Structs and Constants of input, ioctrl and uinput to use uinput with ruby.}
13
+ spec.homepage = "http://github.com/christopheraue/ruby-uinput"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency 'ffi', '~> 1.9'
20
+ spec.add_development_dependency "bundler", "~> 1.8"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "ffi-swig-generator", '~> 0'
23
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uinput
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Aue
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ffi-swig-generator
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - mail@christopheraue.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rakeTasks"
78
+ - ".rspec"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - lib/uinput.rb
83
+ - lib/uinput/generated/input.rb
84
+ - lib/uinput/generated/ioctl.rb
85
+ - lib/uinput/generated/uinput.rb
86
+ - lib/uinput/input.rb
87
+ - lib/uinput/ioctl.rb
88
+ - lib/uinput/uinput.rb
89
+ - lib/uinput/version.rb
90
+ - swig/input.i
91
+ - swig/ioctl.i
92
+ - swig/uinput.i
93
+ - tasks/ffi.rake
94
+ - uinput.gemspec
95
+ homepage: http://github.com/christopheraue/ruby-uinput
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.8
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Structs and Constants of input, ioctrl and uinput to use uinput with ruby.
119
+ test_files: []