-
Notifications
You must be signed in to change notification settings - Fork 10
/
udev-utils.c
645 lines (554 loc) · 16.8 KB
/
udev-utils.c
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
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/*
* Copyright (c) 2015 Vladimir Kondratyev <wulf@cicgroup.ru>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "config.h"
#include "libudev.h"
#include "udev-device.h"
#include "udev-list.h"
#include "udev-utils.h"
#include "utils.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
#else
#define BUS_PCI 0x01
#define BUS_USB 0x03
#define BUS_VIRTUAL 0x06
#define BUS_ISA 0x10
#define BUS_I8042 0x11
#endif
#define PS2_KEYBOARD_VENDOR 0x001
#define PS2_KEYBOARD_PRODUCT 0x001
#define PS2_MOUSE_VENDOR 0x002
#define PS2_MOUSE_GENERIC_PRODUCT 0x001
#ifdef HAVE_LINUX_INPUT_H
static const char *virtual_sysname = "uinput";
#endif
void create_evdev_handler(struct udev_device *udev_device);
void create_keyboard_handler(struct udev_device *udev_device);
void create_mouse_handler(struct udev_device *udev_device);
void create_joystick_handler(struct udev_device *udev_device);
void create_touchpad_handler(struct udev_device *udev_device);
void create_touchscreen_handler(struct udev_device *udev_device);
void create_sysmouse_handler(struct udev_device *udev_device);
void create_kbdmux_handler(struct udev_device *udev_device);
void create_drm_handler(struct udev_device *udev_device);
struct subsystem_config {
char *subsystem;
char *syspath;
int flags; /* See SCFLAG_* below. */
void (*create_handler)(struct udev_device *udev_device);
};
enum {
IT_NONE,
IT_KEYBOARD,
IT_MOUSE,
IT_TOUCHPAD,
IT_TOUCHSCREEN,
IT_JOYSTICK,
IT_TABLET,
IT_ACCELEROMETER,
IT_SWITCH,
};
/* Flag which in indicates a device should be skipped because it's
* already exposed through EVDEV when it's enabled. */
#define SCFLAG_SKIP_IF_EVDEV 0x01
struct subsystem_config subsystems[] = {
#ifdef HAVE_LINUX_INPUT_H
{ "input", DEV_PATH_ROOT "/input/event[0-9]*",
0,
create_evdev_handler },
#endif
{ "input", DEV_PATH_ROOT "/ukbd[0-9]*",
SCFLAG_SKIP_IF_EVDEV,
create_keyboard_handler },
{ "input", DEV_PATH_ROOT "/atkbd[0-9]*",
SCFLAG_SKIP_IF_EVDEV,
create_keyboard_handler },
{ "input", DEV_PATH_ROOT "/kbdmux[0-9]*",
SCFLAG_SKIP_IF_EVDEV,
create_kbdmux_handler },
{ "input", DEV_PATH_ROOT "/ums[0-9]*",
SCFLAG_SKIP_IF_EVDEV,
create_mouse_handler },
{ "input", DEV_PATH_ROOT "/psm[0-9]*",
SCFLAG_SKIP_IF_EVDEV,
create_mouse_handler },
{ "input", DEV_PATH_ROOT "/joy[0-9]*",
0,
create_joystick_handler },
{ "input", DEV_PATH_ROOT "/atp[0-9]*",
0,
create_touchpad_handler },
{ "input", DEV_PATH_ROOT "/wsp[0-9]*",
0,
create_touchpad_handler },
{ "input", DEV_PATH_ROOT "/uep[0-9]*",
0,
create_touchscreen_handler },
{ "input", DEV_PATH_ROOT "/sysmouse",
SCFLAG_SKIP_IF_EVDEV,
create_sysmouse_handler },
{ "input", DEV_PATH_ROOT "/vboxguest",
0,
create_mouse_handler },
{ "drm", DEV_PATH_ROOT "/dri/card[0-9]*",
0,
create_drm_handler },
};
static struct subsystem_config *
get_subsystem_config_by_syspath(const char *path)
{
size_t i;
for (i = 0; i < nitems(subsystems); i++)
if (fnmatch(subsystems[i].syspath, path, 0) == 0)
return (&subsystems[i]);
return (NULL);
}
static bool
kernel_has_evdev_enabled()
{
static int enabled = -1;
size_t len;
if (enabled != -1)
return (enabled);
if (sysctlbyname("kern.features.evdev_support", &enabled, &len, NULL, 0) < 0)
return (0);
TRC("() EVDEV enabled: %s", enabled ? "true" : "false");
return (enabled);
}
const char *
get_subsystem_by_syspath(const char *syspath)
{
struct subsystem_config *sc;
sc = get_subsystem_config_by_syspath(syspath);
if (sc == NULL)
return (UNKNOWN_SUBSYSTEM);
if (sc->flags & SCFLAG_SKIP_IF_EVDEV && kernel_has_evdev_enabled()) {
TRC("(%s) EVDEV enabled -> skipping device", syspath);
return (UNKNOWN_SUBSYSTEM);
}
return (sc->subsystem);
}
const char *
get_sysname_by_syspath(const char *syspath)
{
return (strbase(syspath));
}
const char *
get_devpath_by_syspath(const char *syspath)
{
return (syspath);
}
const char *
get_syspath_by_devpath(const char *devpath)
{
return (devpath);
}
void
invoke_create_handler(struct udev_device *ud)
{
const char *path;
struct subsystem_config *sc;
path = udev_device_get_syspath(ud);
sc = get_subsystem_config_by_syspath(path);
if (sc == NULL || sc->create_handler == NULL)
return;
if (sc->flags & SCFLAG_SKIP_IF_EVDEV && kernel_has_evdev_enabled()) {
TRC("(%p) EVDEV enabled -> skipping device", ud);
return;
}
sc->create_handler(ud);
}
static int
set_input_device_type(struct udev_device *ud, int input_type)
{
struct udev_list *ul;
ul = udev_device_get_properties_list(ud);
if (udev_list_insert(ul, "ID_INPUT", "1") < 0)
return (-1);
switch (input_type) {
case IT_KEYBOARD:
udev_list_insert(ul, "ID_INPUT_KEY", "1");
udev_list_insert(ul, "ID_INPUT_KEYBOARD", "1");
break;
case IT_MOUSE:
udev_list_insert(ul, "ID_INPUT_MOUSE", "1");
break;
case IT_TOUCHPAD:
udev_list_insert(ul, "ID_INPUT_MOUSE", "1");
udev_list_insert(ul, "ID_INPUT_TOUCHPAD", "1");
break;
case IT_TOUCHSCREEN:
udev_list_insert(ul, "ID_INPUT_TOUCHSCREEN", "1");
break;
case IT_JOYSTICK:
udev_list_insert(ul, "ID_INPUT_JOYSTICK", "1");
break;
case IT_TABLET:
udev_list_insert(ul, "ID_INPUT_TABLET", "1");
break;
case IT_ACCELEROMETER:
udev_list_insert(ul, "ID_INPUT_ACCELEROMETER", "1");
break;
case IT_SWITCH:
udev_list_insert(ul, "ID_INPUT_SWITCH", "1");
break;
}
return (0);
}
static struct udev_device *
create_xorg_parent(struct udev_device *ud, const char* sysname,
const char *name, const char *product, const char *pnp_id)
{
struct udev_device *parent;
struct udev *udev;
struct udev_list *props, *sysattrs;
/* xorg-server gets device name and vendor string from parent device */
udev = udev_device_get_udev(ud);
parent = udev_device_new_common(udev, sysname, UD_ACTION_NONE);
if (parent == NULL)
return NULL;
props = udev_device_get_properties_list(parent);
sysattrs = udev_device_get_sysattr_list(parent);
udev_list_insert(props, "NAME", name);
udev_list_insert(sysattrs, "name", name);
if (product != NULL)
udev_list_insert(props, "PRODUCT", product);
if (pnp_id != NULL)
udev_list_insert(sysattrs, "id", product);
return (parent);
}
#ifdef HAVE_LINUX_INPUT_H
#define LONG_BITS (sizeof(long) * 8)
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
static inline bool
bit_is_set(const unsigned long *array, int bit)
{
return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
}
static inline bool
bit_find(const unsigned long *array, int start, int stop)
{
int i;
for (i = start; i < stop; i++)
if (bit_is_set(array, i))
return true;
return false;
}
void
create_evdev_handler(struct udev_device *ud)
{
struct udev_device *parent;
const char *sysname, *unit;
char name[80], product[80], phys[80], mib[32];
int fd = -1, input_type = IT_NONE;
size_t len;
bool opened = false;
bool has_keys, has_buttons, has_lmr;
bool has_rel_axes, has_abs_axes, has_mt, has_switches;
unsigned long key_bits[NLONGS(KEY_CNT)];
unsigned long rel_bits[NLONGS(REL_CNT)];
unsigned long abs_bits[NLONGS(ABS_CNT)];
unsigned long sw_bits[NLONGS(SW_CNT)];
unsigned long prp_bits[NLONGS(INPUT_PROP_CNT)];
struct input_id id;
sysname = udev_device_get_sysname(ud);
len = syspathlen_wo_units(sysname);
unit = sysname + len;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.name", unit);
len = sizeof(name);
if (sysctlbyname(mib, name, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.phys", unit);
len = sizeof(phys);
if (sysctlbyname(mib, phys, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.id", unit);
len = sizeof(id);
if (sysctlbyname(mib, &id, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.key_bits", unit);
len = sizeof(key_bits);
if (sysctlbyname(mib, key_bits, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.rel_bits", unit);
len = sizeof(rel_bits);
if (sysctlbyname(mib, rel_bits, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.abs_bits", unit);
len = sizeof(abs_bits);
if (sysctlbyname(mib, abs_bits, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.sw_bits", unit);
len = sizeof(sw_bits);
if (sysctlbyname(mib, sw_bits, &len, NULL, 0) < 0)
goto use_ioctl;
snprintf(mib, sizeof(mib), "kern.evdev.input.%s.props", unit);
len = sizeof(prp_bits);
if (sysctlbyname(mib, prp_bits, &len, NULL, 0) < 0)
goto use_ioctl;
goto found_values;
use_ioctl:
ERR("sysctl not found, opening device and using ioctl");
fd = path_to_fd(udev_device_get_devnode(ud));
if (fd == -1) {
fd = open(udev_device_get_devnode(ud), O_RDONLY | O_CLOEXEC);
opened = true;
}
if (fd == -1)
return;
if (ioctl(fd, EVIOCGNAME(sizeof(name)), name) < 0 ||
(ioctl(fd, EVIOCGPHYS(sizeof(phys)), phys) < 0 && errno != ENOENT) ||
ioctl(fd, EVIOCGID, &id) < 0 ||
ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)), rel_bits) < 0 ||
ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits) < 0 ||
ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits) < 0 ||
ioctl(fd, EVIOCGBIT(EV_SW, sizeof(sw_bits)), sw_bits) < 0 ||
ioctl(fd, EVIOCGPROP(sizeof(prp_bits)), prp_bits) < 0) {
ERR("could not query evdev");
goto bail_out;
}
found_values:
/* Derived from EvdevProbe() function of xf86-input-evdev driver */
has_keys = bit_find(key_bits, 0, BTN_MISC);
has_buttons = bit_find(key_bits, BTN_MISC, BTN_JOYSTICK);
has_lmr = bit_find(key_bits, BTN_LEFT, BTN_MIDDLE + 1);
has_rel_axes = bit_find(rel_bits, 0, REL_CNT);
has_abs_axes = bit_find(abs_bits, 0, ABS_CNT);
has_switches = bit_find(sw_bits, 0, SW_CNT);
has_mt = bit_find(abs_bits, ABS_MT_SLOT, ABS_CNT);
if (has_abs_axes) {
if (has_mt && !has_buttons) {
if (bit_is_set(key_bits, BTN_JOYSTICK)) {
input_type = IT_JOYSTICK;
goto detected;
} else {
has_buttons = true;
}
}
if (bit_is_set(abs_bits, ABS_X) &&
bit_is_set(abs_bits, ABS_Y)) {
if (bit_is_set(key_bits, BTN_TOOL_PEN) ||
bit_is_set(key_bits, BTN_STYLUS) ||
bit_is_set(key_bits, BTN_STYLUS2)) {
input_type = IT_TABLET;
goto detected;
} else if (bit_is_set(key_bits, BTN_SELECT) ||
bit_is_set(key_bits, BTN_START) ||
bit_is_set(key_bits, BTN_TL) ||
bit_is_set(key_bits, BTN_TR)) {
input_type = IT_JOYSTICK;
goto detected;
} else if (bit_is_set(abs_bits, ABS_PRESSURE) ||
bit_is_set(key_bits, BTN_TOUCH)) {
if (has_lmr ||
bit_is_set(key_bits, BTN_TOOL_FINGER)) {
input_type = IT_TOUCHPAD;
} else {
input_type = IT_TOUCHSCREEN;
}
goto detected;
} else if (!(bit_is_set(rel_bits, REL_X) &&
bit_is_set(rel_bits, REL_Y)) &&
has_lmr) {
/* some touchscreens use BTN_LEFT rather than BTN_TOUCH */
input_type = IT_TOUCHSCREEN;
goto detected;
}
}
}
if (bit_is_set(prp_bits, INPUT_PROP_ACCELEROMETER))
input_type = IT_ACCELEROMETER;
else if (has_keys)
input_type = IT_KEYBOARD;
else if (bit_is_set(prp_bits, INPUT_PROP_POINTER) || has_rel_axes || has_abs_axes || has_buttons)
input_type = IT_MOUSE;
else if (has_switches)
input_type = IT_SWITCH;
if (input_type == IT_NONE)
goto bail_out;
detected:
set_input_device_type(ud, input_type);
sysname = phys[0] == 0 ? virtual_sysname : phys;
*(strchrnul(name, ',')) = '\0'; /* strip name */
snprintf(product, sizeof(product), "%x/%x/%x/%x",
id.bustype, id.vendor, id.product, id.version);
parent = create_xorg_parent(ud, sysname, name, product, NULL);
if (parent != NULL)
udev_device_set_parent(ud, parent);
bail_out:
if (opened)
close(fd);
}
#endif
size_t
syspathlen_wo_units(const char *path) {
size_t len;
len = strlen(path);
while (len > 0) {
if (path[len-1] < '0' || path[len-1] > '9')
break;
--len;
}
return len;
}
void
set_parent(struct udev_device *ud)
{
struct udev_device *parent;
char devname[DEV_PATH_MAX], mib[32], pnpinfo[1024];
char name[80], product[80], parentname[80], *pnp_id;
const char *sysname, *unit, *vendorstr, *prodstr, *devicestr;
size_t len, vendorlen, prodlen, devicelen, pnplen;
uint32_t bus, prod, vendor;
sysname = udev_device_get_sysname(ud);
len = syspathlen_wo_units(sysname);
/* Check if device unit number found */
if (strlen(sysname) == len)
return;
snprintf(devname, len + 1, "%s", sysname);
unit = sysname + len;
snprintf(mib, sizeof(mib), "dev.%.17s.%.3s.%%desc", devname, unit);
len = sizeof(name);
if (sysctlbyname(mib, name, &len, NULL, 0) < 0)
return;
*(strchrnul(name, ',')) = '\0'; /* strip name */
snprintf(mib, sizeof(mib), "dev.%.14s.%.3s.%%pnpinfo", devname, unit);
len = sizeof(pnpinfo);
if (sysctlbyname(mib, pnpinfo, &len, NULL, 0) < 0)
return;
snprintf(mib, sizeof(mib), "dev.%.15s.%.3s.%%parent", devname, unit);
len = sizeof(parentname);
if (sysctlbyname(mib, parentname, &len, NULL, 0) < 0)
return;
vendorstr = get_kern_prop_value(pnpinfo, "vendor", &vendorlen);
prodstr = get_kern_prop_value(pnpinfo, "product", &prodlen);
devicestr = get_kern_prop_value(pnpinfo, "device", &devicelen);
pnp_id = get_kern_prop_value(pnpinfo, "_HID", &pnplen);
if (pnp_id != NULL && pnplen == 4 && strncmp(pnp_id, "none", 4) == 0)
pnp_id = NULL;
if (pnp_id != NULL)
pnp_id[pnplen] = '\0';
if (prodstr != NULL && vendorstr != NULL) {
/* XXX: should parent be compared to uhub* to detect usb? */
vendor = strtol(vendorstr, NULL, 0);
prod = strtol(prodstr, NULL, 0);
bus = BUS_USB;
} else if (devicestr != NULL && vendorstr != NULL) {
vendor = strtol(vendorstr, NULL, 0);
prod = strtol(devicestr, NULL, 0);
bus = BUS_PCI;
} else if (strcmp(parentname, "atkbdc0") == 0) {
if (strcmp(devname, "atkbd") == 0) {
vendor = PS2_KEYBOARD_VENDOR;
prod = PS2_KEYBOARD_PRODUCT;
} else if (strcmp(devname, "psm") == 0) {
vendor = PS2_MOUSE_VENDOR;
prod = PS2_MOUSE_GENERIC_PRODUCT;
} else {
vendor = 0;
prod = 0;
}
bus = BUS_I8042;
} else {
vendor = 0;
prod = 0;
bus = BUS_VIRTUAL;
}
snprintf(product, sizeof(product), "%x/%x/%x/0", bus, vendor, prod);
parent = create_xorg_parent(ud, sysname, name, product, pnp_id);
if (parent != NULL)
udev_device_set_parent(ud, parent);
return;
}
void
create_keyboard_handler(struct udev_device *ud)
{
set_input_device_type(ud, IT_KEYBOARD);
set_parent(ud);
}
void
create_mouse_handler(struct udev_device *ud)
{
set_input_device_type(ud, IT_MOUSE);
set_parent(ud);
}
void
create_kbdmux_handler(struct udev_device *ud)
{
struct udev_device *parent;
const char* sysname;
set_input_device_type(ud, IT_KEYBOARD);
sysname = udev_device_get_sysname(ud);
parent = create_xorg_parent(ud, sysname,
"System keyboard multiplexor", "6/1/1/0", NULL);
if (parent != NULL)
udev_device_set_parent(ud, parent);
}
void
create_sysmouse_handler(struct udev_device *ud)
{
struct udev_device *parent;
const char* sysname;
set_input_device_type(ud, IT_MOUSE);
sysname = udev_device_get_sysname(ud);
parent = create_xorg_parent(ud, sysname,
"System mouse", "6/2/1/0", NULL);
if (parent != NULL)
udev_device_set_parent(ud, parent);
}
void
create_joystick_handler(struct udev_device *ud)
{
set_input_device_type(ud, IT_JOYSTICK);
set_parent(ud);
}
void
create_touchpad_handler(struct udev_device *ud)
{
set_input_device_type(ud, IT_TOUCHPAD);
set_parent(ud);
}
void create_touchscreen_handler(struct udev_device *ud)
{
set_input_device_type(ud, IT_TOUCHSCREEN);
set_parent(ud);
}
void
create_drm_handler(struct udev_device *ud)
{
udev_list_insert(udev_device_get_properties_list(ud), "HOTPLUG", "1");
set_parent(ud);
}