11 #include <linux/time.h>
12 #include <linux/list.h>
15 #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
16 #define ABS_MT_LAST ABS_MT_TOOL_Y
22 #include <linux/device.h>
134 unsigned int hint_events_per_packet;
136 unsigned int keycodemax;
137 unsigned int keycodesize;
140 int (*setkeycode)(
struct input_dev *
dev,
142 unsigned int *old_keycode);
143 int (*getkeycode)(
struct input_dev *
dev,
146 struct ff_device *ff;
148 unsigned int repeat_key;
163 void (*close)(
struct input_dev *
dev);
167 struct input_handle
__rcu *grab;
180 unsigned int num_vals;
181 unsigned int max_vals;
182 struct input_value *vals;
184 #define to_input_dev(d) container_of(d, struct input_dev, dev)
190 #if EV_MAX != INPUT_DEVICE_ID_EV_MAX
191 #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
194 #if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING
195 #error "KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not match"
198 #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
199 #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
202 #if REL_MAX != INPUT_DEVICE_ID_REL_MAX
203 #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match"
206 #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX
207 #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match"
210 #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX
211 #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match"
214 #if LED_MAX != INPUT_DEVICE_ID_LED_MAX
215 #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match"
218 #if SND_MAX != INPUT_DEVICE_ID_SND_MAX
219 #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match"
222 #if FF_MAX != INPUT_DEVICE_ID_FF_MAX
223 #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match"
226 #if SW_MAX != INPUT_DEVICE_ID_SW_MAX
227 #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
230 #define INPUT_DEVICE_ID_MATCH_DEVICE \
231 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
232 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
233 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
277 struct input_handler {
283 const struct input_value *vals,
unsigned int count);
312 struct input_handle {
319 struct input_dev *
dev;
326 struct input_dev *input_allocate_device(
void);
327 void input_free_device(
struct input_dev *
dev);
329 static inline struct input_dev *input_get_device(
struct input_dev *
dev)
334 static inline void input_put_device(
struct input_dev *dev)
340 static inline void *input_get_drvdata(
struct input_dev *dev)
345 static inline void input_set_drvdata(
struct input_dev *dev,
void *
data)
350 int __must_check input_register_device(
struct input_dev *);
351 void input_unregister_device(
struct input_dev *);
353 void input_reset_device(
struct input_dev *);
355 int __must_check input_register_handler(
struct input_handler *);
356 void input_unregister_handler(
struct input_handler *);
358 int __must_check input_get_new_minor(
int legacy_base,
unsigned int legacy_num,
360 void input_free_minor(
unsigned int minor);
362 int input_handler_for_each_handle(
struct input_handler *,
void *
data,
363 int (*
fn)(
struct input_handle *,
void *));
365 int input_register_handle(
struct input_handle *);
366 void input_unregister_handle(
struct input_handle *);
368 int input_grab_device(
struct input_handle *);
369 void input_release_device(
struct input_handle *);
371 int input_open_device(
struct input_handle *);
372 void input_close_device(
struct input_handle *);
374 int input_flush_device(
struct input_handle *
handle,
struct file *
file);
377 void input_inject_event(
struct input_handle *
handle,
unsigned int type,
unsigned int code,
int value);
379 static inline void input_report_key(
struct input_dev *dev,
unsigned int code,
int value)
384 static inline void input_report_rel(
struct input_dev *dev,
unsigned int code,
int value)
389 static inline void input_report_abs(
struct input_dev *dev,
unsigned int code,
int value)
394 static inline void input_report_ff_status(
struct input_dev *dev,
unsigned int code,
int value)
399 static inline void input_report_switch(
struct input_dev *dev,
unsigned int code,
int value)
404 static inline void input_sync(
struct input_dev *dev)
409 static inline void input_mt_sync(
struct input_dev *dev)
414 void input_set_capability(
struct input_dev *dev,
unsigned int type,
unsigned int code);
426 static inline void input_set_events_per_packet(
struct input_dev *dev,
int n_events)
428 dev->hint_events_per_packet = n_events;
431 void input_alloc_absinfo(
struct input_dev *dev);
432 void input_set_abs_params(
struct input_dev *dev,
unsigned int axis,
433 int min,
int max,
int fuzz,
int flat);
435 #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
436 static inline int input_abs_get_##_suffix(struct input_dev *dev, \
439 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
442 static inline void input_abs_set_##_suffix(struct input_dev *dev, \
443 unsigned int axis, int val) \
445 input_alloc_absinfo(dev); \
447 dev->absinfo[axis]._item = val; \
453 INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
454 INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
455 INPUT_GENERATE_ABS_ACCESSORS(
res, resolution)
458 unsigned int *scancode);
461 int input_set_keycode(
struct input_dev *dev,
496 int (*erase)(
struct input_dev *
dev,
int effect_id);
498 int (*playback)(
struct input_dev *
dev,
int effect_id,
int value);
500 void (*set_autocenter)(
struct input_dev *
dev,
u16 magnitude);
512 struct file *effect_owners[];
515 int input_ff_create(
struct input_dev *dev,
unsigned int max_effects);
516 void input_ff_destroy(
struct input_dev *dev);
518 int input_ff_event(
struct input_dev *dev,
unsigned int type,
unsigned int code,
int value);
524 int (*play_effect)(
struct input_dev *,
void *,
struct ff_effect *));