mt.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. /**
  14. * struct input_mt_slot - represents the state of an input MT slot
  15. * @abs: holds current values of ABS_MT axes for this slot
  16. */
  17. struct input_mt_slot {
  18. int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
  19. };
  20. static inline void input_mt_set_value(struct input_mt_slot *slot,
  21. unsigned code, int value)
  22. {
  23. slot->abs[code - ABS_MT_FIRST] = value;
  24. }
  25. static inline int input_mt_get_value(const struct input_mt_slot *slot,
  26. unsigned code)
  27. {
  28. return slot->abs[code - ABS_MT_FIRST];
  29. }
  30. int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
  31. void input_mt_destroy_slots(struct input_dev *dev);
  32. static inline void input_mt_slot(struct input_dev *dev, int slot)
  33. {
  34. input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
  35. }
  36. #endif