xref: /linux/drivers/media/rc/keymaps/rc-ati-x10.c (revision 3932b9ca55b0be314a36d3e84faff3e823c081f5)
1 /*
2  * ATI X10 RF remote keytable
3  *
4  * Copyright (C) 2011 Anssi Hannula <anssi.hannula@?ki.fi>
5  *
6  * This file is based on the static generic keytable previously found in
7  * ati_remote.c, which is
8  * Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net>
9  * Copyright (c) 2002 Vladimir Dergachev
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #include <linux/module.h>
27 #include <media/rc-map.h>
28 
29 /*
30  * Intended usage comments below are from vendor-supplied
31  * Source: ATI REMOTE WONDER™ Installation Guide
32  * http://www2.ati.com/manuals/remctrl.pdf
33  *
34  * Scancodes were in strict left-right, top-bottom order on the
35  * original ATI Remote Wonder, but were moved on later models.
36  *
37  * Keys A-F are intended to be user-programmable.
38  */
39 
40 static struct rc_map_table ati_x10[] = {
41 	/* keyboard - Above the cursor pad */
42 	{ 0x00, KEY_A },
43 	{ 0x01, KEY_B },
44 	{ 0x02, KEY_POWER },      /* Power */
45 
46 	{ 0x03, KEY_TV },         /* TV */
47 	{ 0x04, KEY_DVD },        /* DVD */
48 	{ 0x05, KEY_WWW },        /* WEB */
49 	{ 0x06, KEY_BOOKMARKS },  /* "book": Open Media Library */
50 	{ 0x07, KEY_EDIT },       /* "hand": Toggle left mouse button (grab) */
51 
52 	/* Mouse emulation pad goes here, handled by driver separately */
53 
54 	{ 0x09, KEY_VOLUMEDOWN }, /* VOL + */
55 	{ 0x08, KEY_VOLUMEUP },   /* VOL - */
56 	{ 0x0a, KEY_MUTE },       /* MUTE  */
57 	{ 0x0b, KEY_CHANNELUP },  /* CH + */
58 	{ 0x0c, KEY_CHANNELDOWN },/* CH - */
59 
60 	/*
61 	 * We could use KEY_NUMERIC_x for these, but the X11 protocol
62 	 * has problems with keycodes greater than 255, so avoid those high
63 	 * keycodes in default maps.
64 	 */
65 	{ 0x0d, KEY_1 },
66 	{ 0x0e, KEY_2 },
67 	{ 0x0f, KEY_3 },
68 	{ 0x10, KEY_4 },
69 	{ 0x11, KEY_5 },
70 	{ 0x12, KEY_6 },
71 	{ 0x13, KEY_7 },
72 	{ 0x14, KEY_8 },
73 	{ 0x15, KEY_9 },
74 	{ 0x16, KEY_MENU },       /* "menu": DVD root menu */
75 				  /* KEY_NUMERIC_STAR? */
76 	{ 0x17, KEY_0 },
77 	{ 0x18, KEY_SETUP },      /* "check": DVD setup menu */
78 				  /* KEY_NUMERIC_POUND? */
79 
80 	/* DVD navigation buttons */
81 	{ 0x19, KEY_C },
82 	{ 0x1a, KEY_UP },         /* up */
83 	{ 0x1b, KEY_D },
84 
85 	{ 0x1c, KEY_PROPS },      /* "timer" Should be Data On Screen */
86 				  /* Symbol is "circle nailed to box" */
87 	{ 0x1d, KEY_LEFT },       /* left */
88 	{ 0x1e, KEY_OK },         /* "OK" */
89 	{ 0x1f, KEY_RIGHT },      /* right */
90 	{ 0x20, KEY_SCREEN },     /* "max" (X11 warning: 0x177) */
91 				  /* Should be AC View Toggle, but
92 				     that's not in <input/input.h>.
93 				     KEY_ZOOM (0x174)? */
94 	{ 0x21, KEY_E },
95 	{ 0x22, KEY_DOWN },       /* down */
96 	{ 0x23, KEY_F },
97 	/* Play/stop/pause buttons */
98 	{ 0x24, KEY_REWIND },     /* (<<) Rewind */
99 	{ 0x25, KEY_PLAY },       /* ( >) Play (KEY_PLAYCD?) */
100 	{ 0x26, KEY_FASTFORWARD }, /* (>>) Fast forward */
101 
102 	{ 0x27, KEY_RECORD },     /* ( o) red */
103 	{ 0x28, KEY_STOPCD },     /* ([]) Stop  (KEY_STOP is something else!) */
104 	{ 0x29, KEY_PAUSE },      /* ('') Pause (KEY_PAUSECD?) */
105 
106 	/* Extra keys, not on the original ATI remote */
107 	{ 0x2a, KEY_NEXT },       /* (>+) */
108 	{ 0x2b, KEY_PREVIOUS },   /* (<-) */
109 	{ 0x2d, KEY_INFO },       /* PLAYING  (X11 warning: 0x166) */
110 	{ 0x2e, KEY_HOME },       /* TOP */
111 	{ 0x2f, KEY_END },        /* END */
112 	{ 0x30, KEY_SELECT },     /* SELECT  (X11 warning: 0x161) */
113 };
114 
115 static struct rc_map_list ati_x10_map = {
116 	.map = {
117 		.scan    = ati_x10,
118 		.size    = ARRAY_SIZE(ati_x10),
119 		.rc_type = RC_TYPE_OTHER,
120 		.name    = RC_MAP_ATI_X10,
121 	}
122 };
123 
124 static int __init init_rc_map_ati_x10(void)
125 {
126 	return rc_map_register(&ati_x10_map);
127 }
128 
129 static void __exit exit_rc_map_ati_x10(void)
130 {
131 	rc_map_unregister(&ati_x10_map);
132 }
133 
134 module_init(init_rc_map_ati_x10)
135 module_exit(exit_rc_map_ati_x10)
136 
137 MODULE_LICENSE("GPL");
138 MODULE_AUTHOR("Anssi Hannula <anssi.hannula@iki.fi>");
139