]>
diplodocus.org Git - xorg-xinput/blob - src/list.c
2 * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Frederic Lepied not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Frederic Lepied makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
28 print_info(XDeviceInfo
*info
, Bool shortformat
)
37 printf("\"%s\"\tid=%ld\t[", info
->name
, info
->id
);
46 case IsXExtensionDevice
:
47 printf("XExtensionDevice");
49 case IsXExtensionKeyboard
:
50 printf("XExtensionKeyboard");
52 case IsXExtensionPointer
:
53 printf("XExtensionPointer");
56 printf("Unknown class");
64 if (info
->num_classes
> 0) {
65 any
= (XAnyClassPtr
) (info
->inputclassinfo
);
66 for (i
=0; i
<info
->num_classes
; i
++) {
69 k
= (XKeyInfoPtr
) any
;
70 printf("\tNum_keys is %d\n", k
->num_keys
);
71 printf("\tMin_keycode is %d\n", k
->min_keycode
);
72 printf("\tMax_keycode is %d\n", k
->max_keycode
);
76 b
= (XButtonInfoPtr
) any
;
77 printf("\tNum_buttons is %d\n", b
->num_buttons
);
81 v
= (XValuatorInfoPtr
) any
;
82 a
= (XAxisInfoPtr
) ((char *) v
+
83 sizeof (XValuatorInfo
));
84 printf("\tNum_axes is %d\n", v
->num_axes
);
85 printf("\tMode is %s\n", (v
->mode
== Absolute
) ? "Absolute" : "Relative");
86 printf("\tMotion_buffer is %ld\n", v
->motion_buffer
);
87 for (j
=0; j
<v
->num_axes
; j
++, a
++) {
88 printf("\tAxis %d :\n", j
);
89 printf("\t\tMin_value is %d\n", a
->min_value
);
90 printf("\t\tMax_value is %d\n", a
->max_value
);
91 printf ("\t\tResolution is %d\n", a
->resolution
);
96 printf ("unknown class\n");
98 any
= (XAnyClassPtr
) ((char *) any
+ any
->length
);
104 list(Display
*display
,
112 int shortformat
= False
;
114 shortformat
= (argc
== 1 && strcmp(argv
[0], "--short") == 0);
116 if (argc
== 0 || shortformat
) {
119 info
= XListInputDevices(display
, &num_devices
);
121 for(loop
=0; loop
<num_devices
; loop
++) {
122 print_info(info
+loop
, shortformat
);
125 int ret
= EXIT_SUCCESS
;
127 for(loop
=0; loop
<argc
; loop
++) {
128 info
= find_device_info(display
, argv
[0], False
);
131 fprintf(stderr
, "unable to find device %s\n", argv
[0]);
134 print_info(info
, shortformat
);