input_uapi.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-3-08 GuEe-GUI the first version
  9. */
  10. #ifndef __INPUT_UAPI_H__
  11. #define __INPUT_UAPI_H__
  12. #include <stdint.h>
  13. #include <sys/time.h>
  14. #include <sys/ioctl.h>
  15. #include <dt-bindings/input/event-codes.h>
  16. struct input_event
  17. {
  18. struct timeval time;
  19. uint16_t type;
  20. uint16_t code;
  21. int32_t value;
  22. };
  23. #define EV_VERSION 0x010001
  24. struct input_id
  25. {
  26. uint16_t bustype;
  27. uint16_t vendor;
  28. uint16_t product;
  29. uint16_t version;
  30. };
  31. struct input_absinfo
  32. {
  33. int32_t value;
  34. int32_t minimum;
  35. int32_t maximum;
  36. int32_t fuzz;
  37. int32_t flat;
  38. int32_t resolution;
  39. };
  40. /* Get driver version */
  41. #define EVIOCGVERSION _IOR('E', 0x01, int)
  42. /* Get device ID */
  43. #define EVIOCGID _IOR('E', 0x02, struct input_id)
  44. /* Get device name */
  45. #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)
  46. /* Get device properties */
  47. #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len)
  48. /* Get event bits */
  49. #define EVIOCGBIT(ev, len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len)
  50. /* Get abs value/limits */
  51. #define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo)
  52. /* Grab/Release device */
  53. #define EVIOCGRAB _IOW('E', 0x90, int)
  54. #endif /* __INPUT_UAPI_H__ */