VSF Documented
input.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_INPUT_H__
2#define __VSF_LINUX_INPUT_H__
3
5
6#if VSF_USE_INPUT == ENABLED
7
8#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
9# include "./sys/types.h"
10# include "./sys/time.h"
11# include "./sys/ioctl.h"
12#else
13# include <sys/types.h>
14# include <sys/time.h>
15# include <sys/ioctl.h>
16#endif
17#include <linux/types.h>
18#include <linux/device.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len)
26#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len)
27#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len)
28#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len)
29#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len)
30#define EVIOCGBIT(ev, len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len)
31#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo)
32#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo)
33#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))
34#define EVIOCRMFF _IOW('E', 0x81, int)
35#define EVIOCGEFFECTS _IOR('E', 0x84, int)
36#define EVIOCGRAB _IOW('E', 0x90, int)
37#define EVIOCREVOKE _IOW('E', 0x91, int)
38#define EVIOCSCLOCKID _IOW('E', 0xa0, int)
39#define EVIOCGVERSION _IOR('E', 0x01, int)
40#define EVIOCGID _IOR('E', 0x02, struct input_id)
41#define EVIOCGREP _IOR('E', 0x03, unsigned int[2])
42#define EVIOCSREP _IOW('E', 0x03, unsigned int[2])
43#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2])
44#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
45#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2])
46#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
47#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)
48#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len)
49#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len)
50#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len)
51
52#define EV_VERSION 0x010001
53
54#define BUS_PCI 0x01
55#define BUS_USB 0x03
56#define BUS_BLUETOOTH 0x05
57#define BUS_VIRTUAL 0x06
58
59// event types
60
61#define EV_SYN VSF_INPUT_TYPE_SYNC
62#define EV_KEY VSF_INPUT_TYPE_KEYBOARD
63#define EV_REL 0x10
64#define EV_ABS 0x11
65#define EV_MSC 0x12
66#define EV_SW 0x13
67#define EV_LED 0x14
68#define EV_SND 0x15
69#define EV_REP 0x16
70#define EV_FF 0x17
71#define EV_PWR 0x18
72#define EV_FF_STATUS 0x19
73#define EV_MAX 0x1F
74#define EV_CNT (EV_MAX + 1)
75
76#define SYN_REPORT 0
77#define SYN_CONFIG 1
78#define SYN_MT_REPORT 2
79#define SYN_DROPPED 3
80#define SYN_MAX 0xf
81#define SYN_CNT (SYN_MAX + 1)
82
83// event codes
84// VSF_INPUT_TYPE_SYNC
85
86#define SYN_REPORT 0
87
88// VSF_INPUT_TYPE_KEYBOARD
89
90#define KEY_RESERVED VSF_KB_UNKNOWN
91#define KEY_ESC VSF_KB_ESCAPE
92#define KEY_1 VSF_KB_1
93#define KEY_2 VSF_KB_2
94#define KEY_3 VSF_KB_3
95#define KEY_4 VSF_KB_4
96#define KEY_5 VSF_KB_5
97#define KEY_6 VSF_KB_6
98#define KEY_7 VSF_KB_7
99#define KEY_8 VSF_KB_8
100#define KEY_9 VSF_KB_9
101#define KEY_0 VSF_KB_0
102#define KEY_A VSF_KB_a
103#define KEY_B VSF_KB_b
104#define KEY_C VSF_KB_c
105#define KEY_D VSF_KB_d
106#define KEY_E VSF_KB_e
107#define KEY_F VSF_KB_f
108#define KEY_G VSF_KB_g
109#define KEY_H VSF_KB_h
110#define KEY_I VSF_KB_i
111#define KEY_J VSF_KB_j
112#define KEY_K VSF_KB_k
113#define KEY_L VSF_KB_l
114#define KEY_M VSF_KB_m
115#define KEY_N VSF_KB_n
116#define KEY_O VSF_KB_o
117#define KEY_P VSF_KB_p
118#define KEY_Q VSF_KB_q
119#define KEY_R VSF_KB_r
120#define KEY_S VSF_KB_s
121#define KEY_T VSF_KB_t
122#define KEY_U VSF_KB_u
123#define KEY_V VSF_KB_v
124#define KEY_W VSF_KB_w
125#define KEY_X VSF_KB_x
126#define KEY_Y VSF_KB_y
127#define KEY_Z VSF_KB_z
128#define KEY_MINUS VSF_KB_MINUS
129#define KEY_EQUAL VSF_KB_EQUAL
130#define KEY_BACKSPACE VSF_KB_BACKSPACE
131#define KEY_TAB VSF_KB_TAB
132#define KEY_LEFTBRACE VSF_KB_LEFT_BRACE
133#define KEY_RIGHTBRACE VSF_KB_RIGHT_BRACE
134#define KEY_ENTER VSF_KB_ENTER
135#define KEY_SEMICOLON VSF_KB_SEMICOLON
136#define KEY_APOSTROPHE VSF_KB_SINGLE_QUOTE
137#define KEY_GRAVE VSF_KB_GRAVE
138#define KEY_BACKSLASH VSF_KB_BACKSLASH
139#define KEY_COMMA VSF_KB_COMMA
140#define KEY_DOT VSF_KB_DOT
141#define KEY_SLASH VSF_KB_SLASH
142#define KEY_SPACE VSF_KB_SPACE
143#define KEY_CAPSLOCK VSF_KB_CAPSLOCK
144#define KEY_NUMLOCK VSF_KP_NUMLOCK
145#define KEY_SCROLLLOCK VSF_KB_SCROLLLOCK
146#define KEY_F1 VSF_KB_F1
147#define KEY_F2 VSF_KB_F2
148#define KEY_F3 VSF_KB_F3
149#define KEY_F4 VSF_KB_F4
150#define KEY_F5 VSF_KB_F5
151#define KEY_F6 VSF_KB_F6
152#define KEY_F7 VSF_KB_F7
153#define KEY_F8 VSF_KB_F8
154#define KEY_F9 VSF_KB_F9
155#define KEY_F10 VSF_KB_F10
156#define KEY_F11 VSF_KB_F11
157#define KEY_F12 VSF_KB_F12
158#define KEY_F13 VSF_KB_F13
159#define KEY_F14 VSF_KB_F14
160#define KEY_F15 VSF_KB_F15
161#define KEY_F16 VSF_KB_F16
162#define KEY_F17 VSF_KB_F17
163#define KEY_F18 VSF_KB_F18
164#define KEY_F19 VSF_KB_F19
165#define KEY_F20 VSF_KB_F20
166#define KEY_F21 VSF_KB_F21
167#define KEY_F22 VSF_KB_F22
168#define KEY_F23 VSF_KB_F23
169#define KEY_F24 VSF_KB_F24
170#define KEY_LEFTCTRL VSF_KB_LCTRL
171#define KEY_LEFTSHIFT VSF_KB_LSHIFT
172#define KEY_LEFTALT VSF_KB_LALT
173#define KEY_LEFTMETA VSF_KB_LGUI
174#define KEY_RIGHTCTRL VSF_KB_RCTRL
175#define KEY_RIGHTSHIFT VSF_KB_RSHIFT
176#define KEY_RIGHTALT VSF_KB_RALT
177#define KEY_RIGHTMETA VSF_KB_RGUI
178#define KEY_HOME VSF_KB_HOME
179#define KEY_UP VSF_KB_UP
180#define KEY_DOWN VSF_KB_DOWN
181#define KEY_LEFT VSF_KB_LEFT
182#define KEY_RIGHT VSF_KB_RIGHT
183#define KEY_PAGEUP VSF_KB_PAGE_UP
184#define KEY_PAGEDOWN VSF_KB_PAGE_DOWN
185#define KEY_INSERT VSF_KB_INSERT
186#define KEY_DELETE VSF_KB_DELETE
187#define KEY_END VSF_KB_END
188#define KEY_MUTE VSF_KB_MUTE
189#define KEY_VOLUMEUP VSF_KB_VOLUMEUP
190#define KEY_VOLUMEDOWN VSF_KB_VOLUMEDOWN
191#define KEY_POWER VSF_KB_POWER
192#define KEY_PAUSE VSF_KB_PAUSE
193#define KEY_STOP VSF_KB_STOP
194#define KEY_AGAIN VSF_KB_AGAIN
195#define KEY_UNDO VSF_KB_UNDO
196#define KEY_COPY VSF_KB_COPY
197#define KEY_PASTE VSF_KB_PASTE
198#define KEY_CUT VSF_KB_CUT
199#define KEY_FIND VSF_KB_FIND
200#define KEY_HELP VSF_KB_HELP
201#define KEY_MENU VSF_KB_MENU
202#define KEY_SLEEP VSF_KB_SLEEP
203
204#define KEY_KP1 VSF_KP_1
205#define KEY_KP2 VSF_KP_2
206#define KEY_KP3 VSF_KP_3
207#define KEY_KP4 VSF_KP_4
208#define KEY_KP5 VSF_KP_5
209#define KEY_KP6 VSF_KP_6
210#define KEY_KP7 VSF_KP_7
211#define KEY_KP8 VSF_KP_8
212#define KEY_KP9 VSF_KP_9
213#define KEY_KP0 VSF_KP_0
214#define KEY_KPASTERISK VSF_KP_ASTERISK
215#define KEY_KPMINUS VSF_KP_MINUS
216#define KEY_KPPLUS VSF_KP_PLUS
217#define KEY_KPDOT VSF_KP_DOT
218#define KEY_KPEQUAL VSF_KP_EQUAL
219#define KEY_KPCOMMA VSF_KP_COMMA
220#define KEY_KPENTER VSF_KP_ENTER
221#define KEY_KPSLASH VSF_KP_SLASH
222
223#define KEY_RECORD (VSF_KB_USER + 1)
224#define KEY_SETUP (VSF_KB_USER + 2)
225#define KEY_REWIND (VSF_KB_USER + 3)
226#define KEY_PLAYPAUSE (VSF_KB_USER + 4)
227#define KEY_PLAY (VSF_KB_USER + 5)
228#define KEY_FASTFORWARD (VSF_KB_USER + 6)
229#define KEY_CANCEL (VSF_KB_USER + 7)
230#define KEY_SELECT (VSF_KB_USER + 8)
231#define KEY_CLEAR (VSF_KB_USER + 9)
232#define KEY_EXIT (VSF_KB_USER + 10)
233#define KEY_INFO (VSF_KB_USER + 11)
234#define KEY_PROGRAM (VSF_KB_USER + 12)
235#define KEY_CALENDAR (VSF_KB_USER + 13)
236#define KEY_RED (VSF_KB_USER + 14)
237#define KEY_GREEN (VSF_KB_USER + 15)
238#define KEY_YELLOW (VSF_KB_USER + 16)
239#define KEY_BLUE (VSF_KB_USER + 17)
240#define KEY_CHANNELUP (VSF_KB_USER + 18)
241#define KEY_CHANNELDOWN (VSF_KB_USER + 19)
242
243// btn
244
245#define BTN_MISC (VSF_KB_USER + 0x20)
246#define BTN_0 (BTN_MISC + 0)
247#define BTN_1 (BTN_MISC + 1)
248#define BTN_2 (BTN_MISC + 2)
249#define BTN_3 (BTN_MISC + 3)
250#define BTN_4 (BTN_MISC + 4)
251#define BTN_5 (BTN_MISC + 5)
252#define BTN_6 (BTN_MISC + 6)
253#define BTN_7 (BTN_MISC + 7)
254#define BTN_8 (BTN_MISC + 8)
255#define BTN_9 (BTN_MISC + 9)
256
257#define BTN_GAMEPAD (BTN_MISC + 0x10)
258#define BTN_DPAD_UP (BTN_GAMEPAD | GAMEPAD_ID_L_UP)
259#define BTN_DPAD_DOWN (BTN_GAMEPAD | GAMEPAD_ID_L_DOWN)
260#define BTN_DPAD_LEFT (BTN_GAMEPAD | GAMEPAD_ID_L_LEFT)
261#define BTN_DPAD_RIGHT (BTN_GAMEPAD | GAMEPAD_ID_L_RIGHT)
262#define BTN_SOUTH (BTN_GAMEPAD | GAMEPAD_ID_R_DOWN)
263#define BTN_A BTN_SOUTH
264#define BTN_EAST (BTN_GAMEPAD | GAMEPAD_ID_R_RIGHT)
265#define BTN_B BTN_EAST
266#define BTN_NORTH (BTN_GAMEPAD | GAMEPAD_ID_R_UP)
267#define BTN_X BTN_NORTH
268#define BTN_WEST (BTN_GAMEPAD | GAMEPAD_ID_R_LEFT)
269#define BTN_Y BTN_WEST
270#define BTN_TL (BTN_GAMEPAD | GAMEPAD_ID_LB)
271#define BTN_TR (BTN_GAMEPAD | GAMEPAD_ID_RB)
272#define BTN_TL2 (BTN_GAMEPAD | GAMEPAD_ID_LT)
273#define BTN_TR2 (BTN_GAMEPAD | GAMEPAD_ID_RT)
274#define BTN_SELECT (BTN_GAMEPAD | GAMEPAD_ID_MENU_LEFT)
275#define BTN_MODE (BTN_GAMEPAD | GAMEPAD_ID_MENU_MAIN)
276#define BTN_START (BTN_GAMEPAD | GAMEPAD_ID_MENU_RIGHT)
277#define BTN_THUMBL (BTN_GAMEPAD | GAMEPAD_ID_L_STICK)
278#define BTN_THUMBR (BTN_GAMEPAD | GAMEPAD_ID_R_STICK)
279#define BTN_TRIGGER_HAPPY (BTN_GAMEPAD | (GAMEPAD_ID_USER + 0))
280#define BTN_TRIGGER_HAPPY1 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 0))
281#define BTN_TRIGGER_HAPPY2 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 1))
282#define BTN_TRIGGER_HAPPY3 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 2))
283#define BTN_TRIGGER_HAPPY4 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 3))
284#define BTN_TRIGGER_HAPPY5 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 4))
285#define BTN_TRIGGER_HAPPY6 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 5))
286#define BTN_TRIGGER_HAPPY7 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 6))
287#define BTN_TRIGGER_HAPPY8 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 7))
288#define BTN_TRIGGER_HAPPY9 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 8))
289#define BTN_TRIGGER_HAPPY10 (BTN_GAMEPAD | (GAMEPAD_ID_USER + 9))
290#define BTN_GAMEPAD_MAX BTN_TRIGGER_HAPPY10
291
292#define BTN_MOUSE (BTN_GAMEPAD + 0x10)
293#define BTN_LEFT (BTN_MOUSE + VSF_INPUT_MOUSE_BUTTON_LEFT)
294#define BTN_RIGHT (BTN_MOUSE + VSF_INPUT_MOUSE_BUTTON_RIGHT)
295#define BTN_MIDDLE (BTN_MOUSE + VSF_INPUT_MOUSE_BUTTON_MIDDLE)
296#define BTN_MOUSE_MAX (BTN_MOUSE + 2)
297
298#define BTN_JOYSTICK (BTN_MOUSE + 3)
299#define BTN_TRIGGER (BTN_JOYSTICK + 0)
300#define BTN_THUMB (BTN_JOYSTICK + 1)
301#define BTN_THUMB2 (BTN_JOYSTICK + 2)
302
303#define __BTN_OTHER (BTN_JOYSTICK + 0x10)
304#define BTN_DIGI (__BTN_OTHER + 0)
305#define BTN_TOOL_PEN (__BTN_OTHER + 0)
306#define BTN_TOOL_FINGER (__BTN_OTHER + 5)
307#define BTN_TOUCH (__BTN_OTHER + 10)
308#define BTN_STYLUS (__BTN_OTHER + 11)
309
310#define KEY_OK (__BTN_OTHER + 12)
311#define KEY_ALS_TOGGLE (__BTN_OTHER + 13)
312
314
315#define KEY_MAX 0x3ff
316#define KEY_CNT (KEY_MAX + 1)
317
318// rel
319
320#define REL_X 0x00
321#define REL_Y 0x01
322#define REL_Z 0x02
323#define REL_RX 0x03
324#define REL_RY 0x04
325#define REL_RZ 0x05
326#define REL_HWHEEL 0x06
327#define REL_DIAL 0x07
328#define REL_WHEEL 0x08
329#define REL_MISC 0x09
330
331#define REL_MAX 0x0f
332#define REL_CNT (REL_MAX + 1)
333
334// abs
335
336#define ABS_X 0x00
337#define ABS_Y 0x01
338#define ABS_Z 0x02
339#define ABS_RX 0x03
340#define ABS_RY 0x04
341#define ABS_RZ 0x05
342#define ABS_THROTTLE 0x06
343#define ABS_RUDDER 0x07
344#define ABS_WHEEL 0x08
345#define ABS_GAS 0x09
346#define ABS_BRAKE 0x0a
347#define ABS_HAT0X 0x10
348#define ABS_HAT0Y 0x11
349#define ABS_HAT1X 0x12
350#define ABS_HAT1Y 0x13
351#define ABS_HAT2X 0x14
352#define ABS_HAT2Y 0x15
353#define ABS_HAT3X 0x16
354#define ABS_HAT3Y 0x17
355#define ABS_PRESSURE 0x18
356#define ABS_DISTANCE 0x19
357#define ABS_TILT_X 0x1a
358#define ABS_TILT_Y 0x1b
359#define ABS_TOOL_WIDTH 0x1c
360#define ABS_VOLUME 0x20
361#define ABS_MISC 0x28
362
363#define ABS_MT_POSITION_X 0x35
364#define ABS_MT_POSITION_Y 0x36
365#define ABS_MT_TRACKING_ID 0x39
366#define ABS_MT_PRESSURE 0x3a
367
368#define ABS_MAX 0x3f
369#define ABS_CNT (ABS_MAX + 1)
370
371// LED
372
373#define LED_NUML 0x00
374#define LED_CAPSL 0x01
375#define LED_SCROLLL 0x02
376#define LED_COMPOSE 0x03
377#define LED_KANA 0x04
378#define LED_SLEEP 0x05
379#define LED_SUSPEND 0x06
380#define LED_MUTE 0x07
381#define LED_MISC 0x08
382#define LED_MAIL 0x09
383#define LED_CHARGING 0x0a
384#define LED_MAX 0x0f
385#define LED_CNT (LED_MAX + 1)
386
387// msc
388
389#define MSC_SERIAL 0x00
390#define MSC_PULSELED 0x01
391#define MSC_GESTURE 0x02
392#define MSC_RAW 0x03
393#define MSC_SCAN 0x04
394#define MSC_TIMESTAMP 0x05
395#define MSC_MAX 0x07
396#define MSC_CNT (MSC_MAX + 1)
397
405};
406
408 struct timeval time;
409#define input_event_sec time.tv_sec
410#define input_event_usec time.tv_usec
411
415};
416
417struct input_id {
422};
423
424dcl_vsf_bitmap(input_dev_bitmap, 0x450)
425struct input_dev {
426 const char *name;
427 const char *phys;
428 const char *uniq;
429 struct input_id id;
430
431 struct device dev;
433
434 uint64_t abs_msk;
435 uint64_t rel_msk;
436 struct input_absinfo *absinfo;
437 int rel_value[REL_CNT];
438
439 vsf_bitmap(input_dev_bitmap) key_bitmap;
440};
441#define to_input_dev(__dev) vsf_container_of((__dev), struct input_dev, dev)
442
447};
448
449struct input_handle;
451 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
452 void (*events)(struct input_handle *handle, const struct input_value *vals, unsigned int count);
453 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
454 bool (*match)(struct input_handler *handler, struct input_dev *dev);
455// int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
456 void (*disconnect)(struct input_handle *handle);
457 void (*start)(struct input_handle *handle);
458
459 const char *name;
460};
462 const char *name;
463 struct input_dev *dev;
465};
466
467// force feedback
468struct ff_replay {
471};
475};
481};
485};
490};
498};
508};
512};
513struct ff_effect {
519
520 union {
521 struct ff_constant_effect constant;
522 struct ff_ramp_effect ramp;
523 struct ff_periodic_effect periodic;
524 struct ff_condition_effect condition[2]; // x/y
525 struct ff_rumble_effect rumble;
526 } u;
527};
528#define FF_RUMBLE 0x50
529#define FF_PERIODIC 0x51
530#define FF_CONSTANT 0x52
531#define FF_SPRING 0x53
532#define FF_FRICTION 0x54
533#define FF_DAMPER 0x55
534#define FF_INERTIA 0x56
535#define FF_RAMP 0x57
536#define FF_EFFECT_MIN FF_RUMBLE
537#define FF_EFFECT_MAX FF_RAMP
538
539#define FF_SQUARE 0x58
540#define FF_TRIANGLE 0x59
541#define FF_SINE 0x5a
542#define FF_SAW_UP 0x5b
543#define FF_SAW_DOWN 0x5c
544#define FF_CUSTOM 0x5d
545#define FF_WAVEFORM_MIN FF_SQUARE
546#define FF_WAVEFORM_MAX FF_CUSTOM
547
548#define FF_GAIN 0x60
549#define FF_AUTOCENTER 0x61
550
551#define FF_MAX_EFFECTS FF_GAIN
552#define FF_MAX 0x7f
553#define FF_CNT (FF_MAX + 1)
554
555extern int input_ff_create(struct input_dev *dev, unsigned int max_effects);
556extern void input_ff_destroy(struct input_dev *dev);
557extern int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
558//extern int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file);
559//extern int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
560//extern int input_ff_flush(struct input_dev *dev, struct file *file);
561extern int input_ff_create_memless(struct input_dev *dev, void *data, int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
562
563extern struct input_dev * input_allocate_device(void);
564extern struct input_dev * devm_input_allocate_device(struct device *);
565extern void input_free_device(struct input_dev *dev);
566
567static inline struct input_dev * input_get_device(struct input_dev *dev)
568{
569 return dev ? to_input_dev(get_device(&dev->dev)) : NULL;
570}
571
572static inline void input_put_device(struct input_dev *dev)
573{
574 if (dev) {
575 put_device(&dev->dev);
576 }
577}
578
579static inline void * input_get_drvdata(struct input_dev *dev)
580{
581 return dev_get_drvdata(&dev->dev);
582}
583
584static inline void input_set_drvdata(struct input_dev *dev, void *data)
585{
586 dev_set_drvdata(&dev->dev, data);
587}
588
589extern int input_register_device(struct input_dev *dev);
590extern void input_unregister_device(struct input_dev *dev);
591
592extern void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
593extern void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
594
595static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
596{
597 input_event(dev, EV_KEY, code, !!value);
598}
599
600static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
601{
602 input_event(dev, EV_REL, code, value);
603}
604
605static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
606{
607 input_event(dev, EV_ABS, code, value);
608}
609
610static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
611{
612 input_event(dev, EV_FF_STATUS, code, value);
613}
614
615static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
616{
617 input_event(dev, EV_SW, code, !!value);
618}
619
620static inline void input_sync(struct input_dev *dev)
621{
622 input_event(dev, EV_SYN, SYN_REPORT, 0);
623}
624
625static inline void input_mt_sync(struct input_dev *dev)
626{
628}
629
630extern void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
631
632extern void input_alloc_absinfo(struct input_dev *dev);
633extern void input_set_abs_params(struct input_dev *dev, unsigned int axis, int min, int max, int fuzz, int flat);
634extern void input_copy_abs(struct input_dev *dst, unsigned int dst_axis, const struct input_dev *src, unsigned int src_axis);
635
636#ifdef __cplusplus
637}
638#endif
639
640#endif // VSF_USE_INPUT
641#endif // __VSF_LINUX_INPUT_H__
#define VSF_STATIC_ASSERT(__COND,...)
Definition __type.h:199
bool
Definition type.h:60
Definition vsf_input.h:114
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
void input_copy_abs(struct input_dev *dst, unsigned int dst_axis, const struct input_dev *src, unsigned int src_axis)
Definition vsf_linux_core_input.c:297
void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
#define SYN_REPORT
Definition input.h:76
#define KEY_ALS_TOGGLE
Definition input.h:311
void input_unregister_device(struct input_dev *dev)
Definition vsf_linux_core_input.c:82
#define EV_REL
Definition input.h:63
#define SYN_MT_REPORT
Definition input.h:78
int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
Definition vsf_linux_core_input.c:310
#define REL_CNT
Definition input.h:332
#define EV_SW
Definition input.h:66
#define to_input_dev(__dev)
Definition input.h:441
void input_alloc_absinfo(struct input_dev *dev)
Definition vsf_linux_core_input.c:270
void input_set_abs_params(struct input_dev *dev, unsigned int axis, int min, int max, int fuzz, int flat)
Definition vsf_linux_core_input.c:279
int input_register_device(struct input_dev *dev)
Definition vsf_linux_core_input.c:70
#define EV_ABS
Definition input.h:64
void input_ff_destroy(struct input_dev *dev)
Definition vsf_linux_core_input.c:306
int input_ff_create(struct input_dev *dev, unsigned int max_effects)
Definition vsf_linux_core_input.c:301
void input_free_device(struct input_dev *dev)
Definition vsf_linux_core_input.c:59
#define EV_KEY
Definition input.h:62
int input_ff_create_memless(struct input_dev *dev, void *data, int(*play_effect)(struct input_dev *, void *, struct ff_effect *))
Definition vsf_linux_core_input.c:315
struct input_dev * devm_input_allocate_device(struct device *)
Definition vsf_linux_core_input.c:50
void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code)
Definition vsf_linux_core_input.c:86
#define EV_SYN
Definition input.h:61
#define EV_FF_STATUS
Definition input.h:72
struct input_dev * input_allocate_device(void)
Definition vsf_linux_core_input.c:39
int32_t __s32
Definition types.h:54
uint32_t __u32
Definition types.h:55
int16_t __s16
Definition types.h:52
uint16_t __u16
Definition types.h:53
#define NULL
Definition lvgl.h:26
#define min(x, y)
Definition minmax.h:11
#define max(x, y)
Definition minmax.h:12
void put_device(struct device *dev)
Definition vsf_linux_core.c:546
struct device * get_device(struct device *dev)
Definition vsf_linux_core.c:538
unsigned short uint16_t
Definition stdint.h:7
int int32_t
Definition stdint.h:8
unsigned long long uint64_t
Definition stdint.h:11
Definition device.h:33
Definition input.h:491
__u16 left_saturation
Definition input.h:493
__s16 center
Definition input.h:497
__u16 deadband
Definition input.h:496
__u16 right_saturation
Definition input.h:492
__s16 right_coeff
Definition input.h:494
__s16 left_coeff
Definition input.h:495
Definition input.h:482
struct ff_envelope envelope
Definition input.h:484
__s16 level
Definition input.h:483
Definition input.h:513
__u16 type
Definition input.h:514
__s16 id
Definition input.h:515
__u16 direction
Definition input.h:516
union ff_effect::@977 u
struct ff_trigger trigger
Definition input.h:517
struct ff_replay replay
Definition input.h:518
Definition input.h:476
__u16 fade_level
Definition input.h:480
__u16 attack_level
Definition input.h:478
__u16 attack_length
Definition input.h:477
__u16 fade_length
Definition input.h:479
Definition input.h:499
__s16 * custom_data
Definition input.h:507
__s16 offset
Definition input.h:503
__u32 custom_len
Definition input.h:506
struct ff_envelope envelope
Definition input.h:505
__u16 waveform
Definition input.h:500
__u16 phase
Definition input.h:504
__s16 magnitude
Definition input.h:502
__u16 period
Definition input.h:501
Definition input.h:486
__s16 end_level
Definition input.h:488
__s16 start_level
Definition input.h:487
struct ff_envelope envelope
Definition input.h:489
Definition input.h:468
__u16 length
Definition input.h:469
__u16 delay
Definition input.h:470
Definition input.h:509
__u16 weak_magnitude
Definition input.h:511
__u16 strong_magnitude
Definition input.h:510
Definition input.h:472
__u16 interval
Definition input.h:474
__u16 button
Definition input.h:473
Definition input.h:398
__s32 flat
Definition input.h:403
__s32 fuzz
Definition input.h:402
__s32 resolution
Definition input.h:404
__s32 maximum
Definition input.h:401
__s32 minimum
Definition input.h:400
__s32 value
Definition input.h:399
Definition input.h:407
struct timeval time
Definition input.h:408
uint16_t code
Definition input.h:413
uint16_t type
Definition input.h:412
int32_t value
Definition input.h:414
Definition input.h:461
struct input_dev * dev
Definition input.h:463
struct input_handler * handler
Definition input.h:464
const char * name
Definition input.h:462
Definition input.h:450
bool(* match)(struct input_handler *handler, struct input_dev *dev)
Definition input.h:454
void(* start)(struct input_handle *handle)
Definition input.h:457
void(* events)(struct input_handle *handle, const struct input_value *vals, unsigned int count)
Definition input.h:452
void(* event)(struct input_handle *handle, unsigned int type, unsigned int code, int value)
Definition input.h:451
bool(* filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value)
Definition input.h:453
const char * name
Definition input.h:459
void(* disconnect)(struct input_handle *handle)
Definition input.h:456
Definition input.h:417
__u16 bustype
Definition input.h:418
__u16 product
Definition input.h:420
__u16 version
Definition input.h:421
__u16 vendor
Definition input.h:419
Definition input.h:443
__u16 code
Definition input.h:445
__u16 type
Definition input.h:444
__s32 value
Definition input.h:446
Definition time.h:42
vk_av_control_value_t value
Definition vsf_audio.h:171
vk_av_control_type_t type
Definition vsf_audio.h:170
#define dcl_vsf_bitmap(__name, __bit_size)
Definition vsf_bitmap.h:98
#define vsf_bitmap(__name)
Definition vsf_bitmap.h:93
@ VSF_KB_USER_MAX
Definition vsf_input_keyboard.h:233
vk_input_notifier_t notifier
Definition vsf_xboot.c:31
Generated from commit: vsfteam/vsf@af87c60