The OpenD Programming Language

1 module core.sys.linux.input;
2 
3 version (linux):
4 extern(C):
5 nothrow:
6 
7 import core.sys.linux.sys.time;
8 import core.sys.posix.sys.ioctl;
9 
10 public import core.sys.linux.input_event_codes;
11 
12 struct input_event
13 {
14     timeval time;
15     ushort type;
16     ushort code;
17     int value;
18 }
19 
20 enum EV_VERSION     = 0x010001;
21 
22 struct input_id
23 {
24     ushort bustype;
25     ushort vendor;
26     ushort product;
27     ushort version_;
28 }
29 
30 struct input_absinfo
31 {
32     int value;
33     int minimum;
34     int maximum;
35     int fuzz;
36     int flat;
37     int resolution;
38 }
39 
40 enum INPUT_KEYMAP_BY_INDEX = (1 << 0);
41 struct input_keymap_entry
42 {
43     ubyte  flags;
44     ubyte  len;
45     ushort index;
46     uint keycode;
47     ubyte[32]  scancode;
48 }
49 
50 struct input_mask
51 {
52     uint type;
53     uint codes_size;
54     ulong codes_ptr;
55 }
56 
57 enum EVIOCGVERSION       = _IOR!int('E', 0x01);
58 enum EVIOCGID            = _IOR!input_id('E', 0x02);
59 enum EVIOCGREP           = _IOR!(uint[2])('E', 0x03);
60 enum EVIOCSREP           = _IOW!(uint[2])('E', 0x03);
61 
62 enum EVIOCGKEYCODE       = _IOR!(uint[2])('E', 0x04);
63 enum EVIOCGKEYCODE_V2    = _IOR!input_keymap_entry('E', 0x04);
64 enum EVIOCSKEYCODE       = _IOW!(uint[2])('E', 0x04);
65 enum EVIOCSKEYCODE_V2    = _IOW!input_keymap_entry('E', 0x04);
66 
67 enum EVIOCGNAME(len)     = _IOC(_IOC_READ, 'E', 0x06, len);
68 enum EVIOCGPHYS(len)     = _IOC(_IOC_READ, 'E', 0x07, len);
69 enum EVIOCGUNIQ(len)     = _IOC(_IOC_READ, 'E', 0x08, len);
70 enum EVIOCGPROP(len)     = _IOC(_IOC_READ, 'E', 0x09, len);
71 
72 enum EVIOCGMTSLOTS(len)  = _IOC(_IOC_READ, 'E', 0x0a, len);
73 
74 enum EVIOCGKEY(len)      = _IOC(_IOC_READ, 'E', 0x18, len);
75 enum EVIOCGLED(len)      = _IOC(_IOC_READ, 'E', 0x19, len);
76 enum EVIOCGSND(len)      = _IOC(_IOC_READ, 'E', 0x1a, len);
77 enum EVIOCGSW(len)       = _IOC(_IOC_READ, 'E', 0x1b, len);
78 
79 enum EVIOCGBIT(ev,len)   = _IOC(_IOC_READ, 'E', 0x20 + (ev), len);
80 enum EVIOCGABS(abs)      = _IOR!input_absinfo('E', 0x40 + (abs));
81 enum EVIOCSABS(abs)      = _IOW!input_absinfo('E', 0xc0 + (abs));
82 
83 enum EVIOCSFF            = _IOW!ff_effect('E', 0x80);
84 enum EVIOCRMFF           = _IOW!int('E', 0x81);
85 enum EVIOCGEFFECTS       = _IOR!int('E', 0x84);
86 
87 enum EVIOCGRAB           = _IOW!int('E', 0x90);
88 enum EVIOCREVOKE         = _IOW!int('E', 0x91);
89 
90 enum EVIOCGMASK      = _IOR!input_mask('E', 0x92);
91 
92 enum EVIOCSMASK      = _IOW!input_mask('E', 0x93);
93 
94 enum EVIOCSCLOCKID   = _IOW!int('E', 0xa0);
95 
96 enum ID_BUS          = 0;
97 enum ID_VENDOR       = 1;
98 enum ID_PRODUCT      = 2;
99 enum ID_VERSION      = 3;
100 
101 enum BUS_PCI         = 0x01;
102 enum BUS_ISAPNP      = 0x02;
103 enum BUS_USB         = 0x03;
104 enum BUS_HIL         = 0x04;
105 enum BUS_BLUETOOTH   = 0x05;
106 enum BUS_VIRTUAL     = 0x06;
107 
108 enum BUS_ISA         = 0x10;
109 enum BUS_I8042       = 0x11;
110 enum BUS_XTKBD       = 0x12;
111 enum BUS_RS232       = 0x13;
112 enum BUS_GAMEPORT    = 0x14;
113 enum BUS_PARPORT     = 0x15;
114 enum BUS_AMIGA       = 0x16;
115 enum BUS_ADB         = 0x17;
116 enum BUS_I2C         = 0x18;
117 enum BUS_HOST        = 0x19;
118 enum BUS_GSC         = 0x1A;
119 enum BUS_ATARI       = 0x1B;
120 enum BUS_SPI         = 0x1C;
121 enum BUS_RMI         = 0x1D;
122 enum BUS_CEC         = 0x1E;
123 enum BUS_INTEL_ISHTP = 0x1F;
124 
125 enum MT_TOOL_FINGER  = 0;
126 enum MT_TOOL_PEN     = 1;
127 enum MT_TOOL_PALM    = 2;
128 enum MT_TOOL_MAX     = 2;
129 
130 enum FF_STATUS_STOPPED   = 0x00;
131 enum FF_STATUS_PLAYING   = 0x01;
132 enum FF_STATUS_MAX       = 0x01;
133 
134 struct ff_replay {
135     ushort length;
136     ushort delay;
137 };
138 
139 struct ff_trigger {
140     ushort button;
141     ushort interval;
142 };
143 
144 struct ff_envelope {
145     ushort attack_length;
146     ushort attack_level;
147     ushort fade_length;
148     ushort fade_level;
149 };
150 
151 struct ff_constant_effect {
152     short level;
153     ff_envelope envelope;
154 };
155 
156 struct ff_ramp_effect {
157     short start_level;
158     short end_level;
159     ff_envelope envelope;
160 };
161 
162 struct ff_condition_effect {
163     ushort right_saturation;
164     ushort left_saturation;
165 
166     short right_coeff;
167     short left_coeff;
168 
169     ushort deadband;
170     short center;
171 };
172 
173 struct ff_periodic_effect {
174     ushort waveform;
175     ushort period;
176     short magnitude;
177     short offset;
178     ushort phase;
179 
180     ff_envelope envelope;
181 
182     uint custom_len;
183     short *custom_data;
184 };
185 
186 struct ff_rumble_effect {
187     ushort strong_magnitude;
188     ushort weak_magnitude;
189 };
190 
191 struct ff_effect {
192     ushort type;
193     short id;
194     ushort direction;
195     ff_trigger trigger;
196     ff_replay replay;
197 
198     union U {
199         ff_constant_effect constant;
200         ff_ramp_effect ramp;
201         ff_periodic_effect periodic;
202         ff_condition_effect[2] condition;
203         ff_rumble_effect rumble;
204     }
205     U u;
206 };
207 
208 enum FF_RUMBLE   = 0x50;
209 enum FF_PERIODIC = 0x51;
210 enum FF_CONSTANT = 0x52;
211 enum FF_SPRING   = 0x53;
212 enum FF_FRICTION = 0x54;
213 enum FF_DAMPER   = 0x55;
214 enum FF_INERTIA  = 0x56;
215 enum FF_RAMP     = 0x57;
216 
217 enum FF_EFFECT_MIN   = FF_RUMBLE;
218 enum FF_EFFECT_MAX   = FF_RAMP;
219 
220 enum FF_SQUARE   = 0x58;
221 enum FF_TRIANGLE = 0x59;
222 enum FF_SINE     = 0x5a;
223 enum FF_SAW_UP   = 0x5b;
224 enum FF_SAW_DOWN = 0x5c;
225 enum FF_CUSTOM   = 0x5d;
226 
227 enum FF_WAVEFORM_MIN = FF_SQUARE;
228 enum FF_WAVEFORM_MAX = FF_CUSTOM;
229 
230 enum FF_GAIN     = 0x60;
231 enum FF_AUTOCENTER   = 0x61;
232 
233 enum FF_MAX_EFFECTS  = FF_GAIN;
234 
235 enum FF_MAX      = 0x7f;
236 enum FF_CNT      = (FF_MAX+1);