ir-core.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #define IR_TYPE_UNKNOWN 0
  21. #define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
  22. #define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */
  23. #define IR_TYPE_NEC (1 << 2)
  24. #define IR_TYPE_OTHER (((u64)1) << 63l)
  25. struct ir_scancode {
  26. u16 scancode;
  27. u32 keycode;
  28. };
  29. struct ir_scancode_table {
  30. struct ir_scancode *scan;
  31. int size;
  32. u64 ir_type;
  33. char *name;
  34. spinlock_t lock;
  35. };
  36. struct ir_dev_props {
  37. unsigned long allowed_protos;
  38. void *priv;
  39. int (*change_protocol)(void *priv, u64 ir_type);
  40. };
  41. struct ir_input_dev {
  42. struct device dev; /* device */
  43. struct ir_scancode_table rc_tab; /* scan/key table */
  44. unsigned long devno; /* device number */
  45. const struct ir_dev_props *props; /* Device properties */
  46. };
  47. #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
  48. /* Routines from ir-keytable.c */
  49. u32 ir_g_keycode_from_table(struct input_dev *input_dev,
  50. u32 scancode);
  51. int ir_input_register(struct input_dev *dev,
  52. const struct ir_scancode_table *ir_codes,
  53. const struct ir_dev_props *props);
  54. void ir_input_unregister(struct input_dev *input_dev);
  55. /* Routines from ir-sysfs.c */
  56. int ir_register_class(struct input_dev *input_dev);
  57. void ir_unregister_class(struct input_dev *input_dev);
  58. #endif