1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
|
'\" t
.\" Title: xlistinputdevices
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 09/23/2011
.\" Manual: [FIXME: manual]
.\" Source: [FIXME: source]
.\" Language: English
.\"
.TH "XLISTINPUTDEVICES" "libmansuffix" "09/23/2011" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
XListInputDevices, XFreeDeviceList \- list available input devices
.SH "SYNOPSIS"
.sp
.nf
#include <X11/extensions/XInput\&.h>
.fi
.sp
.nf
XDeviceInfo *XListInputDevices( Display *display,
int *ndevices_return);
.fi
.sp
.nf
int XFreeDeviceList( XDeviceInfo *list);
.fi
.sp
.nf
display
Specifies the connection to the X server\&.
.fi
.sp
.nf
ndevices_return
Specifies a pointer to a variable where the number of
available devices canbe returned\&.
.fi
.sp
.nf
list
Specifies the list of devices to free\&. The
XFreeDeviceList functionfrees the list of available
extension input devices\&.
.fi
.SH "DESCRIPTION"
.sp
.if n \{\
.RS 4
.\}
.nf
The XListInputDevices request lists the available input
devices\&. This list includes the core keyboard and any physical
input device currently accessible through the X server, and any
input devices that are not currently accessible through the X
server but could be accessed if requested\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
A master pointer is a virtual pointer device that does not
represent a physical device\&. It is visually represented through
a cursor\&. A master keyboard is a virtual keyboard device that
does not represent a physical device\&. It is virtually
representd through a keyboard focus\&. A master pointer and a
master keyboard are always paired (i\&.e\&. if shift is pressed on
the master keyboard, a pointer click would be a shift\-click)\&.
Multiple master pointer/keyboard pairs can exist\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
X servers supporting the X Input Extension version 2,
XListInputDevices only returns the first master pointer, the
first master keyboard and all slave devices\&. Additional master
devices are not listed\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
Physical devices (so\-called slave devices) are attached to
either a master pointer or a master keyboard, depending on
their capabilities\&. If a slave device generates an event, the
event is also generated by the respective master device\&.
Multiple slave devices can be attached to a single master
device\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
Some server implementations may make all physical input devices
available at the time the server is initialized\&. Others may
wait until requested by a client to access an input device\&. In
the latter case, it is possible that an input device will be
listed as available at one time but not at another\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
For each input device available to the server, the
XListInputDevices request returns an XDeviceInfo structure\&.
That structure contains a pointer to a list of structures, each
of which contains information about one class of input
supported by the device\&. The XDeviceInfo structure is defined
as follows:
typedef struct _XDeviceInfo {
XID id;
Atom type;
char *name;
int num_classes;
int use;
XAnyClassPtr inputclassinfo;
} XDeviceInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The id is a number in the range 0\-128 that uniquely identifies
the device\&. It is assigned to the device when it is initialized
by the server\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The type field is of type Atom and indicates the nature of the
device\&. The type will correspond to one of the following strings
(defined in the header file XI\&.h):
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
XI_MOUSE XI_TABLET XI_KEYBOARD XI_TOUCHSCREEN XI_TOUCHPAD
XI_BUTTONBOX XI_BARCODE XI_TRACKBALL XI_QUADRATURE XI_ID_MODULE
XI_ONE_KNOB XI_NINE_KNOB XI_KNOB_BOX XI_SPACEBALL XI_DATAGLOVE
XI_EYETRACKER XI_CURSORKEYS XI_FOOTMOUSE XI_JOYSTICK
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
These strings may be used in an XInternAtom request to return
an atom that can be compared with the type field of the
XDeviceInfo structure\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The name field contains a pointer to a null\-terminated string
that serves as identifier of the device\&. This identifier may be
user\-configured or automatically assigned by the server\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The num_classes field is a number in the range 0\-255 that
specifies the number of input classes supported by the device
for which information is returned by ListInputDevices\&. Some
input classes, such as class Focus and class Proximity do not
have any information to be returned by ListInputDevices\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
All devices provide an AttachClass\&. This class specifies the
master device a given slave device is attached to\&. For master
devices, the class specifies the respective paired master
device\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The use field specifies how the device is currently being used\&.
If the value is IsXKeyboard, the device is a master keyboard\&.
If the value is IsXPointer, the device is a master pointer\&. If
the value is IsXExtensionPointer, the device is a slave
pointer\&. If the value is IsXExtensionKeyboard, the device is a
slave keyboard\&. If the value is IsXExtensionDevice, the device
is available for use as an extension device\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The inputclassinfo field contains a pointer to the first
input\-class specific data\&. The first two fields are common to
all classes\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The class field is a number in the range 0\-255\&. It uniquely
identifies the class of input for which information is
returned\&. Currently defined classes are KeyClass, ButtonClass,
and ValuatorClass\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The length field is a number in the range 0\- 255\&. It specifies
the number of bytes of data that are contained in this input
class\&. The length includes the class and length fields\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The XKeyInfo structure describes the characteristics of the
keys on the device\&. It is defined as follows:
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
typedef struct _XKeyInfo {
XID class;
int length;
unsigned short min_keycode;
unsigned short max_keycode;
unsigned short num_keys;
} XKeyInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
min_keycode is of type KEYCODE\&. It specifies the minimum
keycode that the device will report\&. The minimum keycode will
not be smaller than 8\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
max_keycode is of type KEYCODE\&. It specifies the maximum
keycode that the device will report\&. The maximum keycode will
not be larger than 255\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
num_keys specifies the number of keys that the device has\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The XButtonInfo structure defines the characteristics of the
buttons on the device\&. It is defined as follows:
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
typedef struct _XButtonInfo {
XID class;
int length;
short num_buttons;
} XButtonInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
num_buttons specifies the number of buttons that the device
has\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The XValuatorInfo structure defines the characteristics of the
valuators on the device\&. It is defined as follows:
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
typedef struct _XValuatorInfo {
XID class;
int length;
unsigned char num_axes;
unsigned char mode;
unsigned long motion_buffer;
XAxisInfoPtr axes;
} XValuatorInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
num_axes contains the number of axes the device supports\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
mode is a constant that has one of the following values:
Absolute or Relative\&. Some devices allow the mode to be changed
dynamically via the SetDeviceMode request\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
motion_buffer_size is a cardinal number that specifies the
number of elements that can be contained in the motion history
buffer for the device\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The axes field contains a pointer to an XAxisInfo structure\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The XAxisInfo structure is defined as follows:
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
typedef struct _XAxisInfo {
int resolution;
int min_value;
int max_value;
} XAxisInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The resolution contains a number in counts/meter\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The min_val field contains a number that specifies the minimum
value the device reports for this axis\&. For devices whose mode
is Relative, the min_val field will contain 0\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The max_val field contains a number that specifies the maximum
value the device reports for this axis\&. For devices whose mode
is Relative, the max_val field will contain 0\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
The XAttachInfo structure is defined as follows:
typedef struct _XAttachInfo {
int attached;
} XAttachInfo;
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
If the device is a slave device, attached specifies the device
ID of the master device this device is attached to\&. If the
device is not attached to a master device, attached is
Floating\&. If the device is a master device, attached specifies
the device ID of the master device this device is paired with\&.
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
To free the XDeviceInfo array created by XListInputDevices, use
XFreeDeviceList\&.
.fi
.if n \{\
.RE
.\}
|