Allow -1 as valid fd in libevdev_change_fd
[platform/upstream/libevdev.git] / libevdev / libevdev-int.h
index e77db32..847fe56 100644 (file)
  * OF THIS SOFTWARE.
  */
 
-#ifndef libevdev_INT_H
-#define libevdev_INT_H
+#ifndef LIBEVDEV_INT_H
+#define LIBEVDEV_INT_H
 
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <errno.h>
 #include "libevdev.h"
 
@@ -39,6 +40,7 @@
 #define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1)
 #define LIBEVDEV_EXPORT __attribute__((visibility("default")))
 #define LIBEVDEV_PRINTF(_format, _args) __attribute__ ((format (printf, _format, _args)))
+#define ALIAS(_to) __attribute__((alias(#_to)))
 
 #undef min
 #undef max
@@ -58,9 +60,9 @@
  * default state: SYNC_NONE
  *
  * SYNC_NONE → SYN_DROPPED or forced sync → SYNC_NEEDED
- * SYNC_NEEDED → libevdev_next_event(LIBEVDEV_READ_SYNC) → SYNC_IN_PROGRESS
- * SYNC_NEEDED → libevdev_next_event(LIBEVDEV_READ_SYNC_NONE) → SYNC_NONE
- * SYNC_IN_PROGRESS → libevdev_next_event(LIBEVDEV_READ_SYNC_NONE) → SYNC_NONE
+ * SYNC_NEEDED → libevdev_next_event(LIBEVDEV_READ_FLAG_SYNC) → SYNC_IN_PROGRESS
+ * SYNC_NEEDED → libevdev_next_event(LIBEVDEV_READ_FLAG_SYNC_NONE) → SYNC_NONE
+ * SYNC_IN_PROGRESS → libevdev_next_event(LIBEVDEV_READ_FLAG_SYNC_NONE) → SYNC_NONE
  * SYNC_IN_PROGRESS → no sync events left → SYNC_NONE
  *
  */
@@ -72,6 +74,7 @@ enum SyncState {
 
 struct libevdev {
        int fd;
+       bool initialized;
        char *name;
        char *phys;
        char *uniq;