~ubuntu-branches/debian/sid/libevdev/sid

« back to all changes in this revision

Viewing changes to libevdev/libevdev-int.h

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2014-09-09 07:59:54 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20140909075954-wuic1ooxes68u2er
Tags: 1.3+dfsg-1
* New upstream release.
* libevdev should really have priority optional rather than extra.
* Add upstream's signing key and use it in debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        int val[];
61
61
};
62
62
 
 
63
/**
 
64
 * Internal only: log data used to send messages to the respective log
 
65
 * handler. We re-use the same struct for a global and inside
 
66
 * struct libevdev.
 
67
 * For the global, device_handler is NULL, for per-device instance
 
68
 * global_handler is NULL.
 
69
 */
 
70
struct logdata {
 
71
        enum libevdev_log_priority priority;            /** minimum logging priority */
 
72
        libevdev_log_func_t global_handler;             /** global handler function */
 
73
        libevdev_device_log_func_t device_handler;      /** per-device handler function */
 
74
        void *userdata;                                 /** user-defined data pointer */
 
75
};
 
76
 
63
77
struct libevdev {
64
78
        int fd;
65
79
        bool initialized;
106
120
                unsigned long *tracking_id_changes;
107
121
                size_t tracking_id_changes_sz;   /* in bytes */
108
122
        } mt_sync;
109
 
};
110
 
 
111
 
struct logdata {
112
 
        enum libevdev_log_priority priority;    /** minimum logging priority */
113
 
        libevdev_log_func_t handler;            /** handler function */
114
 
        void *userdata;                         /** user-defined data pointer */
115
 
};
116
 
extern struct logdata log_data;
117
 
 
118
 
#define log_msg_cond(priority, ...) \
 
123
 
 
124
        struct logdata log;
 
125
};
 
126
 
 
127
#define log_msg_cond(dev, priority, ...) \
119
128
        do { \
120
 
                if (libevdev_get_log_priority() >= priority) \
121
 
                        log_msg(priority, log_data.userdata, __FILE__, __LINE__, __func__, __VA_ARGS__); \
 
129
                if (_libevdev_log_priority(dev) >= priority) \
 
130
                        _libevdev_log_msg(dev, priority, __FILE__, __LINE__, __func__, __VA_ARGS__); \
122
131
        } while(0)
123
132
 
124
 
#define log_error(...) log_msg_cond(LIBEVDEV_LOG_ERROR, __VA_ARGS__)
125
 
#define log_info(...) log_msg_cond(LIBEVDEV_LOG_INFO, __VA_ARGS__)
126
 
#define log_dbg(...) log_msg_cond(LIBEVDEV_LOG_DEBUG, __VA_ARGS__)
127
 
#define log_bug(...) log_msg_cond(LIBEVDEV_LOG_ERROR, "BUG: "__VA_ARGS__)
 
133
#define log_error(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_ERROR, __VA_ARGS__)
 
134
#define log_info(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_INFO, __VA_ARGS__)
 
135
#define log_dbg(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_DEBUG, __VA_ARGS__)
 
136
#define log_bug(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_ERROR, "BUG: "__VA_ARGS__)
128
137
 
129
138
extern void
130
 
log_msg(enum libevdev_log_priority priority,
131
 
        void *data,
132
 
        const char *file, int line, const char *func,
133
 
        const char *format, ...) LIBEVDEV_ATTRIBUTE_PRINTF(6, 7);
 
139
_libevdev_log_msg(const struct libevdev *dev,
 
140
                  enum libevdev_log_priority priority,
 
141
                  const char *file, int line, const char *func,
 
142
                  const char *format, ...) LIBEVDEV_ATTRIBUTE_PRINTF(6, 7);
 
143
extern enum libevdev_log_priority
 
144
_libevdev_log_priority(const struct libevdev *dev);
134
145
 
135
146
/**
136
147
 * @return a pointer to the next element in the queue, or NULL if the queue