#include "defs.h"
+#include <linux/ioctl.h>
+
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
#include "xlat/evdev_abs.h"
#include "xlat/evdev_switch.h"
#include "xlat/evdev_sync.h"
+#ifndef SYN_MAX
+# define SYN_MAX 0xf
+#endif
+
static void
decode_envelope(struct ff_envelope *envelope)
{
if (!abbrev(tcp)) {
tprintf(", maximum=%" PRIu32 ", fuzz=%" PRIu32,
absinfo.maximum, absinfo.fuzz);
- tprintf(", flat=%" PRIu32 ", resolution=%" PRIu32,
- absinfo.flat, absinfo.resolution);
+ tprintf(", flat=%" PRIu32, absinfo.flat);
+#ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION
+ tprintf(", resolution=%" PRIu32, absinfo.resolution);
+#endif
tprints("}");
} else {
tprints(", ...}");
return 1;
}
+#ifdef EVIOCGKEYCODE_V2
static int
keycode_V2_ioctl(struct tcb *tcp, long arg)
{
struct input_keymap_entry ike;
- unsigned i;
if (!arg) {
tprints(", NULL");
if (!verbose(tcp) || umove(tcp, arg, &ike) < 0)
return 0;
- tprintf(", {flags=%" PRIu8 ", len=%" PRIu8,
- ike.flags, ike.len);
+ tprintf(", {flags=%" PRIu8 ", len=%" PRIu8, ike.flags, ike.len);
if (!abbrev(tcp)) {
- tprintf(", index=%" PRIu16 ", keycode=%" PRIu32,
- ike.index, ike.keycode);
- tprints(", scancode={");
- for (i = 0; i < ARRAY_SIZE(ike.scancode); i++)
- tprintf(" %" PRIx8, ike.scancode[i]);
- tprints("}}");
+ unsigned int i;
+
+ tprintf(", index=%" PRIu16 ", keycode=", ike.index);
+ printxval(evdev_keycode, ike.keycode, "KEY_???");
+ tprints(", scancode=[");
+ for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
+ if (i > 0)
+ tprints(", ");
+ tprintf("%" PRIx8, ike.scancode[i]);
+ }
+ tprints("]}");
} else {
tprints(", ...}");
}
return 1;
}
+#endif /* EVIOCGKEYCODE_V2 */
static int
getid_ioctl(struct tcb *tcp, long arg)
return 1;
}
+#ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
tprints("]}");
return 1;
}
+#endif /* EVIOCGMTSLOTS */
+#if defined EVIOCGREP || defined EVIOCSREP
static int
repeat_ioctl(struct tcb *tcp, long arg)
{
- unsigned int val[2];
-
- if (!verbose(tcp) || umove(tcp, arg, &val) < 0)
- return 0;
-
- tprintf(", [%" PRIu32 " %" PRIu32 "]", val[0], val[1]);
+ tprints(", ");
+ printpair_int(tcp, arg, "%u");
return 1;
}
+#endif /* EVIOCGREP || EVIOCSREP */
static int
evdev_read_ioctl(struct tcb *tcp, const unsigned int code, long arg)
case EV_MSC:
return decode_bitset(tcp, arg,
evdev_misc, MSC_MAX, "MSC_???");
+#ifdef EV_SW
case EV_SW:
return decode_bitset(tcp, arg,
evdev_switch, SW_MAX, "SW_???");
+#endif
case EV_LED:
return decode_bitset(tcp, arg,
evdev_leds, LED_MAX, "LED_???");
return 1;
case EVIOCGID:
return getid_ioctl(tcp, arg);
+#ifdef EVIOCGREP
case EVIOCGREP:
return repeat_ioctl(tcp, arg);;
+#endif
case EVIOCGKEYCODE:
return keycode_ioctl(tcp, arg);
+#ifdef EVIOCGKEYCODE_V2
case EVIOCGKEYCODE_V2:
return keycode_V2_ioctl(tcp, arg);
+#endif
}
switch (_IOC_NR(code)) {
+#ifdef EVIOCGMTSLOTS
case _IOC_NR(EVIOCGMTSLOTS(0)):
return mtslots_ioctl(tcp, code, arg);
+#endif
case _IOC_NR(EVIOCGNAME(0)):
case _IOC_NR(EVIOCGPHYS(0)):
case _IOC_NR(EVIOCGUNIQ(0)):
tprints(", ");
printstr(tcp, arg, tcp->u_rval - 1);
return 1;
+#ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
return decode_bitset(tcp, arg,
evdev_prop, INPUT_PROP_MAX, "PROP_???");
+#endif
case _IOC_NR(EVIOCGSND(0)):
return decode_bitset(tcp, arg,
evdev_snd, SND_MAX, "SND_???");
+#ifdef EVIOCGSW
case _IOC_NR(EVIOCGSW(0)):
return decode_bitset(tcp, arg,
evdev_switch, SW_MAX, "SW_???");
+#endif
case _IOC_NR(EVIOCGKEY(0)):
return decode_bitset(tcp, arg,
evdev_keycode, KEY_MAX, "KEY_???");
return abs_ioctl(tcp, arg);
switch (code) {
+#ifdef EVIOCSREP
case EVIOCSREP:
return repeat_ioctl(tcp, arg);
+#endif
case EVIOCSKEYCODE:
return keycode_ioctl(tcp, arg);
+#ifdef EVIOCSKEYCODE_V2
case EVIOCSKEYCODE_V2:
return keycode_V2_ioctl(tcp, arg);
+#endif
case EVIOCSFF:
return ff_effect_ioctl(tcp, arg);
case EVIOCRMFF:
+#ifdef EVIOCSCLOCKID
case EVIOCSCLOCKID:
+#endif
case EVIOCGRAB:
+#ifdef EVIOCREVOKE
case EVIOCREVOKE:
+#endif
tprints(", ");
printnum_int(tcp, arg, "%u");
return 1;