mt.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _INPUT_MT_H
  2. #define _INPUT_MT_H
  3. /*
  4. * Input Multitouch Library
  5. *
  6. * Copyright (c) 2010 Henrik Rydberg
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published by
  10. * the Free Software Foundation.
  11. */
  12. #include <linux/input.h>
  13. #define TRKID_MAX 0xffff
  14. /**
  15. * struct input_mt_slot - represents the state of an input MT slot
  16. * @abs: holds current values of ABS_MT axes for this slot
  17. */
  18. struct input_mt_slot {
  19. int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
  20. };
  21. static inline void input_mt_set_value(struct input_mt_slot *slot,
  22. unsigned code, int value)
  23. {
  24. slot->abs[code - ABS_MT_FIRST] = value;
  25. }
  26. static inline int input_mt_get_value(const struct input_mt_slot *slot,
  27. unsigned code)
  28. {
  29. return slot->abs[code - ABS_MT_FIRST];
  30. }
  31. int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
  32. void input_mt_destroy_slots(struct input_dev *dev);
  33. static inline int input_mt_new_trkid(struct input_dev *dev)
  34. {
  35. return dev->trkid++ & TRKID_MAX;
  36. }
  37. static inline void input_mt_slot(struct input_dev *dev, int slot)
  38. {
  39. input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
  40. }
  41. void input_mt_report_slot_state(struct input_dev *dev,
  42. unsigned int tool_type, bool active);
  43. void input_mt_report_finger_count(struct input_dev *dev, int count);
  44. void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
  45. #endif