ir-core.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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;
  39. struct ir_scancode_table rc_tab;
  40. };
  41. /* Routines from ir-keytable.c */
  42. u32 ir_g_keycode_from_table(struct input_dev *input_dev,
  43. u32 scancode);
  44. int ir_set_keycode_table(struct input_dev *input_dev,
  45. struct ir_scancode_table *rc_tab);
  46. int ir_roundup_tablesize(int n_elems);
  47. int ir_input_register(struct input_dev *dev,
  48. struct ir_scancode_table *ir_codes);
  49. void ir_input_unregister(struct input_dev *input_dev);
  50. #endif