hidraw.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2007 Jiri Kosina
  3. */
  4. /*
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * You should have received a copy of the GNU General Public License along with
  10. * this program; if not, write to the Free Software Foundation, Inc.,
  11. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  12. */
  13. #ifndef _HIDRAW_H
  14. #define _HIDRAW_H
  15. #include <uapi/linux/hidraw.h>
  16. struct hidraw {
  17. unsigned int minor;
  18. int exist;
  19. int open;
  20. wait_queue_head_t wait;
  21. struct hid_device *hid;
  22. struct device *dev;
  23. spinlock_t list_lock;
  24. struct list_head list;
  25. };
  26. struct hidraw_report {
  27. __u8 *value;
  28. int len;
  29. };
  30. struct hidraw_list {
  31. struct hidraw_report buffer[HIDRAW_BUFFER_SIZE];
  32. int head;
  33. int tail;
  34. struct fasync_struct *fasync;
  35. struct hidraw *hidraw;
  36. struct list_head node;
  37. struct mutex read_mutex;
  38. };
  39. #ifdef CONFIG_HIDRAW
  40. int hidraw_init(void);
  41. void hidraw_exit(void);
  42. int hidraw_report_event(struct hid_device *, u8 *, int);
  43. int hidraw_connect(struct hid_device *);
  44. void hidraw_disconnect(struct hid_device *);
  45. #else
  46. static inline int hidraw_init(void) { return 0; }
  47. static inline void hidraw_exit(void) { }
  48. static inline int hidraw_report_event(struct hid_device *hid, u8 *data, int len) { return 0; }
  49. static inline int hidraw_connect(struct hid_device *hid) { return -1; }
  50. static inline void hidraw_disconnect(struct hid_device *hid) { }
  51. #endif
  52. #endif