evdev: fix decoding of EVIOCGBIT(0, ...)
There is a comment in drivers/input/evdev.c which says: /* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */ That is, EVIOCGBIT(0, ...) should return a bit mask with supported event types instead of SYN_* event codes. * defs.h (evdev_ev): New prototype. * evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h". (bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev with XT_SORTED in decode_bitset invocation instead. * ioctl.c: Do not include "xlat/evdev_ev.h". (evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN". * tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT output. * xlat/evdev_sync.in: Remove. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> Fixes: v4.10~89 "Add decoding for evdev ioctls"
This commit is contained in:
parent
99300f217b
commit
5ee385e2eb
1
defs.h
1
defs.h
@ -330,6 +330,7 @@ extern const struct xlat evdev_abs[];
|
||||
/** Number of elements in evdev_abs array without the terminating record. */
|
||||
extern const size_t evdev_abs_size;
|
||||
|
||||
extern const struct xlat evdev_ev[];
|
||||
extern const struct xlat iffflags[];
|
||||
extern const struct xlat ip_type_of_services[];
|
||||
extern const struct xlat ipc_private[];
|
||||
|
8
evdev.c
8
evdev.c
@ -30,6 +30,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
#include "xlat/evdev_abs.h"
|
||||
#include "xlat/evdev_ev.h"
|
||||
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
@ -47,7 +48,6 @@
|
||||
# include "xlat/evdev_relative_axes.h"
|
||||
# include "xlat/evdev_snd.h"
|
||||
# include "xlat/evdev_switch.h"
|
||||
# include "xlat/evdev_sync.h"
|
||||
|
||||
# ifndef SYN_MAX
|
||||
# define SYN_MAX 0xf
|
||||
@ -258,9 +258,9 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
|
||||
const kernel_ulong_t arg)
|
||||
{
|
||||
switch (ev_nr) {
|
||||
case EV_SYN:
|
||||
return decode_bitset(tcp, arg, evdev_sync,
|
||||
SYN_MAX, "SYN_???", XT_INDEXED);
|
||||
case 0:
|
||||
return decode_bitset(tcp, arg, evdev_ev,
|
||||
EV_MAX, "EV_???", XT_SORTED);
|
||||
case EV_KEY:
|
||||
return decode_bitset(tcp, arg, evdev_keycode,
|
||||
KEY_MAX, "KEY_???", XT_INDEXED);
|
||||
|
7
ioctl.c
7
ioctl.c
@ -33,8 +33,6 @@
|
||||
#include <linux/ioctl.h>
|
||||
#include "xlat/ioctl_dirs.h"
|
||||
|
||||
#include "xlat/evdev_ev.h"
|
||||
|
||||
static int
|
||||
compare(const void *a, const void *b)
|
||||
{
|
||||
@ -99,7 +97,10 @@ evdev_decode_number(const unsigned int code)
|
||||
|
||||
if (nr >= 0x20 && nr <= 0x20 + 0x1f) {
|
||||
tprints("EVIOCGBIT(");
|
||||
printxval(evdev_ev, nr - 0x20, "EV_???");
|
||||
if (nr == 0x20)
|
||||
tprintf("0");
|
||||
else
|
||||
printxval(evdev_ev, nr - 0x20, "EV_???");
|
||||
tprintf(", %u)", _IOC_SIZE(code));
|
||||
return 1;
|
||||
} else if (nr >= 0x40 && nr <= 0x40 + 0x3f) {
|
||||
|
@ -138,7 +138,7 @@ main(void)
|
||||
TEST_NULL_ARG_EX(EVIOCGABS(0x3f), "EVIOCGABS(0x3f /* ABS_??? */)");
|
||||
TEST_NULL_ARG_EX(EVIOCSABS(0x3f), "EVIOCSABS(0x3f /* ABS_??? */)");
|
||||
|
||||
TEST_NULL_ARG(EVIOCGBIT(EV_SYN, 0));
|
||||
TEST_NULL_ARG(EVIOCGBIT(0, 0));
|
||||
TEST_NULL_ARG(EVIOCGBIT(EV_KEY, 1));
|
||||
TEST_NULL_ARG(EVIOCGBIT(EV_REL, 2));
|
||||
TEST_NULL_ARG(EVIOCGBIT(EV_ABS, 3));
|
||||
|
@ -1,5 +0,0 @@
|
||||
#value_indexed
|
||||
SYN_REPORT 0
|
||||
SYN_CONFIG 1
|
||||
SYN_MT_REPORT 2
|
||||
SYN_DROPPED 3
|
Loading…
x
Reference in New Issue
Block a user