1 module core.sys.linux.uinput;
2 
3 version (linux):
4 extern(C):
5 nothrow:
6 
7 import core.sys.posix.sys.ioctl;
8 
9 public import core.sys.linux.input;
10 public import core.sys.linux.input_event_codes;
11 
12 enum UINPUT_VERSION = 5;
13 enum UINPUT_MAX_NAME_SIZE = 80;
14 
15 struct uinput_ff_upload
16 {
17     uint            request_id;
18     int             retval;
19     ff_effect       effect;
20     ff_effect       old;
21 }
22 
23 struct uinput_ff_erase
24 {
25     uint           request_id;
26     int            retval;
27     uint           effect_id;
28 }
29 
30 enum UINPUT_IOCTL_BASE  = 'U';
31 enum UI_DEV_CREATE              = _IO(UINPUT_IOCTL_BASE, 1);
32 enum UI_DEV_DESTROY             = _IO(UINPUT_IOCTL_BASE, 2);
33 
34 struct uinput_setup
35 {
36     input_id id;
37     char[UINPUT_MAX_NAME_SIZE] name;
38     uint ff_effects_max;
39 }
40 
41 enum UI_DEV_SETUP = _IOW!uinput_setup(UINPUT_IOCTL_BASE, 3);
42 
43 struct uinput_abs_setup
44 {
45     ushort  code;
46 
47     input_absinfo absinfo;
48 }
49 
50 enum UI_ABS_SETUP = _IOW!uinput_abs_setup(UINPUT_IOCTL_BASE, 4);
51 
52 enum UI_SET_EVBIT               = _IOW!int(UINPUT_IOCTL_BASE, 100);
53 enum UI_SET_KEYBIT              = _IOW!int(UINPUT_IOCTL_BASE, 101);
54 enum UI_SET_RELBIT              = _IOW!int(UINPUT_IOCTL_BASE, 102);
55 enum UI_SET_ABSBIT              = _IOW!int(UINPUT_IOCTL_BASE, 103);
56 enum UI_SET_MSCBIT              = _IOW!int(UINPUT_IOCTL_BASE, 104);
57 enum UI_SET_LEDBIT              = _IOW!int(UINPUT_IOCTL_BASE, 105);
58 enum UI_SET_SNDBIT              = _IOW!int(UINPUT_IOCTL_BASE, 106);
59 enum UI_SET_FFBIT               = _IOW!int(UINPUT_IOCTL_BASE, 107);
60 enum UI_SET_PHYS                = _IOW!(char*)(UINPUT_IOCTL_BASE, 108);
61 enum UI_SET_SWBIT               = _IOW!int(UINPUT_IOCTL_BASE, 109);
62 enum UI_SET_PROPBIT             = _IOW!int(UINPUT_IOCTL_BASE, 110);
63 
64 enum UI_BEGIN_FF_UPLOAD = _IOWR!uinput_ff_upload(UINPUT_IOCTL_BASE, 200);
65 enum UI_END_FF_UPLOAD   = _IOW!uinput_ff_upload(UINPUT_IOCTL_BASE, 201);
66 enum UI_BEGIN_FF_ERASE  = _IOWR!uinput_ff_erase(UINPUT_IOCTL_BASE, 202);
67 enum UI_END_FF_ERASE    = _IOW!uinput_ff_erase(UINPUT_IOCTL_BASE, 203);
68 
69 enum UI_GET_SYSNAME(len) = _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len);
70 
71 enum UI_GET_VERSION             = _IOR!uint(UINPUT_IOCTL_BASE, 45);
72 
73 enum EV_UINPUT          = 0x0101;
74 enum UI_FF_UPLOAD               = 1;
75 enum UI_FF_ERASE                = 2;
76 
77 struct uinput_user_dev {
78     char[UINPUT_MAX_NAME_SIZE] name;
79     input_id id;
80     uint ff_effects_max;
81     int[ABS_CNT] absmax;
82     int[ABS_CNT] absmin;
83     int[ABS_CNT] absfuzz;
84     int[ABS_CNT] absflat;
85 }