]> granicus.if.org Git - strace/blobdiff - evdev.c
Update NEWS
[strace] / evdev.c
diff --git a/evdev.c b/evdev.c
index 3b5cbe4bb7f4c61d5151fd1bdf8beb9b546cd97e..b24f9d320b2dc4a0b8b5c7131403e844425d802f 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015 Etienne Gemsa <etienne.gemsa@lse.epita.fr>
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #ifdef HAVE_LINUX_INPUT_H
 
+#include DEF_MPERS_TYPE(struct_ff_effect)
+
 # include <linux/ioctl.h>
 # include <linux/input.h>
-# include "xlat/evdev_abs.h"
+
+typedef struct ff_effect struct_ff_effect;
+
+#endif /* HAVE_LINUX_INPUT_H */
+
+#include MPERS_DEFS
+
+#ifdef HAVE_LINUX_INPUT_H
+
 # include "xlat/evdev_autorepeat.h"
 # include "xlat/evdev_ff_status.h"
 # include "xlat/evdev_ff_types.h"
 # endif
 
 static void
-decode_envelope(const struct ff_envelope *envelope)
+decode_envelope(void *const data)
 {
+       const struct ff_envelope *const envelope = data;
+
        tprintf(", envelope={attack_length=%" PRIu16
                ", attack_level=%" PRIu16
                ", fade_length=%" PRIu16
@@ -68,7 +80,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
 {
        tprints(", ");
 
-       struct ff_effect ffe;
+       struct_ff_effect ffe;
 
        if (umove_or_printaddr(tcp, arg, &ffe))
                return 1;
@@ -121,10 +133,10 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
                                ffe.u.periodic.offset,
                                ffe.u.periodic.phase);
                        decode_envelope(&ffe.u.periodic.envelope);
-                       tprintf(", custom_len=%u"
-                               ", custom_data=%#lx}",
-                               ffe.u.periodic.custom_len,
-                               (unsigned long) ffe.u.periodic.custom_data);
+                       tprintf(", custom_len=%u, custom_data=",
+                               ffe.u.periodic.custom_len);
+                       printaddr((unsigned long) ffe.u.periodic.custom_data);
+                       tprints("}");
                        break;
                case FF_RUMBLE:
                        tprintf(", rumble={strong_magnitude=%" PRIu16
@@ -369,13 +381,16 @@ bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
                        return decode_bitset(tcp, arg, evdev_ff_types,
                                             FF_MAX, "FF_???");
                case EV_PWR:
+                       tprints(", ");
                        printnum_int(tcp, arg, "%d");
                        return 1;
                case EV_FF_STATUS:
                        return decode_bitset(tcp, arg, evdev_ff_status,
                                             FF_STATUS_MAX, "FF_STATUS_???");
                default:
-                       return 0;
+                       tprints(", ");
+                       printaddr(arg);
+                       return 1;
        }
 }
 
@@ -494,8 +509,8 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
        return 0;
 }
 
-int
-evdev_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *tcp,
+                  const unsigned int code, const long arg)
 {
        switch(_IOC_DIR(code)) {
                case _IOC_READ: