ir-core.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Remote Controller core header
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation version 2 of the License.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _IR_CORE
  14. #define _IR_CORE
  15. #include <linux/input.h>
  16. #include <linux/spinlock.h>
  17. extern int ir_core_debug;
  18. #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
  19. printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
  20. enum ir_type {
  21. IR_TYPE_UNKNOWN = 0,
  22. IR_TYPE_RC5 = 1,
  23. IR_TYPE_PD = 2, /* Pulse distance encoded IR */
  24. IR_TYPE_NEC = 3,
  25. IR_TYPE_OTHER = 99,
  26. };
  27. struct ir_scancode {
  28. u16 scancode;
  29. u32 keycode;
  30. };
  31. struct ir_scancode_table {
  32. struct ir_scancode *scan;
  33. int size;
  34. enum ir_type ir_type;
  35. spinlock_t lock;
  36. };
  37. struct ir_input_dev {
  38. struct input_dev *dev; /* Input device*/
  39. struct ir_scancode_table rc_tab; /* scan/key table */
  40. unsigned long devno; /* device number */
  41. struct attribute_group attr; /* IR attributes */
  42. struct device *class_dev; /* virtual class dev */
  43. };
  44. /* Routines from ir-keytable.c */
  45. u32 ir_g_keycode_from_table(struct input_dev *input_dev,
  46. u32 scancode);
  47. int ir_set_keycode_table(struct input_dev *input_dev,
  48. struct ir_scancode_table *rc_tab);
  49. int ir_roundup_tablesize(int n_elems);
  50. int ir_input_register(struct input_dev *dev,
  51. struct ir_scancode_table *ir_codes);
  52. void ir_input_unregister(struct input_dev *input_dev);
  53. /* Routines from ir-sysfs.c */
  54. int ir_register_class(struct input_dev *input_dev);
  55. void ir_unregister_class(struct input_dev *input_dev);
  56. #endif