rc-ati-x10.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * ATI X10 RF remote keytable
  4. *
  5. * Copyright (C) 2011 Anssi Hannula <anssi.hannula@?ki.fi>
  6. *
  7. * This file is based on the static generic keytable previously found in
  8. * ati_remote.c, which is
  9. * Copyright (c) 2004 Torrey Hoffman <[email protected]>
  10. * Copyright (c) 2002 Vladimir Dergachev
  11. */
  12. #include <linux/module.h>
  13. #include <media/rc-map.h>
  14. /*
  15. * Intended usage comments below are from vendor-supplied
  16. * Source: ATI REMOTE WONDER™ Installation Guide
  17. * http://www2.ati.com/manuals/remctrl.pdf
  18. *
  19. * Scancodes were in strict left-right, top-bottom order on the
  20. * original ATI Remote Wonder, but were moved on later models.
  21. *
  22. * Keys A-F are intended to be user-programmable.
  23. */
  24. static struct rc_map_table ati_x10[] = {
  25. /* keyboard - Above the cursor pad */
  26. { 0x00, KEY_A },
  27. { 0x01, KEY_B },
  28. { 0x02, KEY_POWER }, /* Power */
  29. { 0x03, KEY_TV }, /* TV */
  30. { 0x04, KEY_DVD }, /* DVD */
  31. { 0x05, KEY_WWW }, /* WEB */
  32. { 0x06, KEY_BOOKMARKS }, /* "book": Open Media Library */
  33. { 0x07, KEY_EDIT }, /* "hand": Toggle left mouse button (grab) */
  34. /* Mouse emulation pad goes here, handled by driver separately */
  35. { 0x09, KEY_VOLUMEDOWN }, /* VOL + */
  36. { 0x08, KEY_VOLUMEUP }, /* VOL - */
  37. { 0x0a, KEY_MUTE }, /* MUTE */
  38. { 0x0b, KEY_CHANNELUP }, /* CH + */
  39. { 0x0c, KEY_CHANNELDOWN },/* CH - */
  40. /*
  41. * We could use KEY_NUMERIC_x for these, but the X11 protocol
  42. * has problems with keycodes greater than 255, so avoid those high
  43. * keycodes in default maps.
  44. */
  45. { 0x0d, KEY_NUMERIC_1 },
  46. { 0x0e, KEY_NUMERIC_2 },
  47. { 0x0f, KEY_NUMERIC_3 },
  48. { 0x10, KEY_NUMERIC_4 },
  49. { 0x11, KEY_NUMERIC_5 },
  50. { 0x12, KEY_NUMERIC_6 },
  51. { 0x13, KEY_NUMERIC_7 },
  52. { 0x14, KEY_NUMERIC_8 },
  53. { 0x15, KEY_NUMERIC_9 },
  54. { 0x16, KEY_MENU }, /* "menu": DVD root menu */
  55. /* KEY_NUMERIC_STAR? */
  56. { 0x17, KEY_NUMERIC_0 },
  57. { 0x18, KEY_SETUP }, /* "check": DVD setup menu */
  58. /* KEY_NUMERIC_POUND? */
  59. /* DVD navigation buttons */
  60. { 0x19, KEY_C },
  61. { 0x1a, KEY_UP }, /* up */
  62. { 0x1b, KEY_D },
  63. { 0x1c, KEY_PROPS }, /* "timer" Should be Data On Screen */
  64. /* Symbol is "circle nailed to box" */
  65. { 0x1d, KEY_LEFT }, /* left */
  66. { 0x1e, KEY_OK }, /* "OK" */
  67. { 0x1f, KEY_RIGHT }, /* right */
  68. { 0x20, KEY_SCREEN }, /* "max" (X11 warning: 0x177) */
  69. /* Should be AC View Toggle, but
  70. that's not in <input/input.h>.
  71. KEY_ZOOM (0x174)? */
  72. { 0x21, KEY_E },
  73. { 0x22, KEY_DOWN }, /* down */
  74. { 0x23, KEY_F },
  75. /* Play/stop/pause buttons */
  76. { 0x24, KEY_REWIND }, /* (<<) Rewind */
  77. { 0x25, KEY_PLAY }, /* ( >) Play (KEY_PLAYCD?) */
  78. { 0x26, KEY_FASTFORWARD }, /* (>>) Fast forward */
  79. { 0x27, KEY_RECORD }, /* ( o) red */
  80. { 0x28, KEY_STOPCD }, /* ([]) Stop (KEY_STOP is something else!) */
  81. { 0x29, KEY_PAUSE }, /* ('') Pause (KEY_PAUSECD?) */
  82. /* Extra keys, not on the original ATI remote */
  83. { 0x2a, KEY_NEXT }, /* (>+) */
  84. { 0x2b, KEY_PREVIOUS }, /* (<-) */
  85. { 0x2d, KEY_INFO }, /* PLAYING (X11 warning: 0x166) */
  86. { 0x2e, KEY_HOME }, /* TOP */
  87. { 0x2f, KEY_END }, /* END */
  88. { 0x30, KEY_SELECT }, /* SELECT (X11 warning: 0x161) */
  89. };
  90. static struct rc_map_list ati_x10_map = {
  91. .map = {
  92. .scan = ati_x10,
  93. .size = ARRAY_SIZE(ati_x10),
  94. .rc_proto = RC_PROTO_OTHER,
  95. .name = RC_MAP_ATI_X10,
  96. }
  97. };
  98. static int __init init_rc_map_ati_x10(void)
  99. {
  100. return rc_map_register(&ati_x10_map);
  101. }
  102. static void __exit exit_rc_map_ati_x10(void)
  103. {
  104. rc_map_unregister(&ati_x10_map);
  105. }
  106. module_init(init_rc_map_ati_x10)
  107. module_exit(exit_rc_map_ati_x10)
  108. MODULE_LICENSE("GPL");
  109. MODULE_AUTHOR("Anssi Hannula <[email protected]>");