1 #include <linux/ioctl.h>
2 #include <linux/input.h>
8 static const struct ioctl input_ioctls
[] = {
14 #ifdef EVIOCGKEYCODE_V2
15 IOCTL(EVIOCGKEYCODE_V2
),
18 #ifdef EVIOCSKEYCODE_V2
19 IOCTL(EVIOCSKEYCODE_V2
),
28 IOCTL(EVIOCGMTSLOTS(0)),
34 IOCTL(EVIOCGBIT(0,0)),
46 static const char *const input_devs
[] = {
50 static void input_sanitise(const struct ioctl_group
*grp
, int childno
)
54 pick_random_ioctl(grp
, childno
);
56 switch (shm
->syscall
[childno
].a2
) {
59 shm
->syscall
[childno
].a2
= EVIOCGNAME(u
);
63 shm
->syscall
[childno
].a2
= EVIOCGPHYS(u
);
67 shm
->syscall
[childno
].a2
= EVIOCGUNIQ(u
);
72 shm
->syscall
[childno
].a2
= EVIOCGPROP(u
);
76 case EVIOCGMTSLOTS(0):
78 shm
->syscall
[childno
].a2
= EVIOCGMTSLOTS(u
);
83 shm
->syscall
[childno
].a2
= EVIOCGKEY(u
);
87 shm
->syscall
[childno
].a2
= EVIOCGLED(u
);
91 shm
->syscall
[childno
].a2
= EVIOCGSND(u
);
95 shm
->syscall
[childno
].a2
= EVIOCGSW(u
);
100 if (u
% 10) u
%= EV_CNT
;
102 shm
->syscall
[childno
].a2
= EVIOCGBIT(u
, r
);
106 if (u
% 10) u
%= ABS_CNT
;
107 shm
->syscall
[childno
].a2
= EVIOCGABS(u
);
111 if (u
% 10) u
%= ABS_CNT
;
112 shm
->syscall
[childno
].a2
= EVIOCSABS(u
);
119 static const struct ioctl_group input_grp
= {
122 .devs_cnt
= ARRAY_SIZE(input_devs
),
123 .sanitise
= input_sanitise
,
124 .ioctls
= input_ioctls
,
125 .ioctls_cnt
= ARRAY_SIZE(input_ioctls
),
128 REG_IOCTL_GROUP(input_grp
)