uhid.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __UHID_H_
  2. #define __UHID_H_
  3. /*
  4. * User-space I/O driver support for HID subsystem
  5. * Copyright (c) 2012 David Herrmann
  6. */
  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 as published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option)
  11. * any later version.
  12. */
  13. /*
  14. * Public header for user-space communication. We try to keep every structure
  15. * aligned but to be safe we also use __attribute__((__packed__)). Therefore,
  16. * the communication should be ABI compatible even between architectures.
  17. */
  18. #include <linux/input.h>
  19. #include <linux/types.h>
  20. enum uhid_event_type {
  21. UHID_CREATE,
  22. UHID_DESTROY,
  23. UHID_START,
  24. UHID_STOP,
  25. UHID_OPEN,
  26. UHID_CLOSE,
  27. UHID_INPUT,
  28. };
  29. struct uhid_create_req {
  30. __u8 name[128];
  31. __u8 phys[64];
  32. __u8 uniq[64];
  33. __u8 __user *rd_data;
  34. __u16 rd_size;
  35. __u16 bus;
  36. __u32 vendor;
  37. __u32 product;
  38. __u32 version;
  39. __u32 country;
  40. } __attribute__((__packed__));
  41. #define UHID_DATA_MAX 4096
  42. struct uhid_input_req {
  43. __u8 data[UHID_DATA_MAX];
  44. __u16 size;
  45. } __attribute__((__packed__));
  46. struct uhid_event {
  47. __u32 type;
  48. union {
  49. struct uhid_create_req create;
  50. struct uhid_input_req input;
  51. } u;
  52. } __attribute__((__packed__));
  53. #endif /* __UHID_H_ */