1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* rc5-imon-mce.c - Keytable for Windows Media Center RC-6 remotes for use
3  * with the SoundGraph iMON/Antec Veris hardware IR decoder
4  *
5  * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com>
6  */
7 
8 #include <media/rc-map.h>
9 #include <linux/module.h>
10 
11 /* mce-mode imon mce remote key table */
12 static struct rc_map_table imon_mce[] = {
13 	/* keys sorted mostly by frequency of use to optimize lookups */
14 	{ 0x800ff415, KEY_REWIND },
15 	{ 0x800ff414, KEY_FASTFORWARD },
16 	{ 0x800ff41b, KEY_PREVIOUS },
17 	{ 0x800ff41a, KEY_NEXT },
18 
19 	{ 0x800ff416, KEY_PLAY },
20 	{ 0x800ff418, KEY_PAUSE },
21 	{ 0x800ff419, KEY_STOP },
22 	{ 0x800ff417, KEY_RECORD },
23 
24 	{ 0x02000052, KEY_UP },
25 	{ 0x02000051, KEY_DOWN },
26 	{ 0x02000050, KEY_LEFT },
27 	{ 0x0200004f, KEY_RIGHT },
28 
29 	{ 0x800ff41e, KEY_UP },
30 	{ 0x800ff41f, KEY_DOWN },
31 	{ 0x800ff420, KEY_LEFT },
32 	{ 0x800ff421, KEY_RIGHT },
33 
34 	/* 0x800ff40b also KEY_NUMERIC_POUND on some receivers */
35 	{ 0x800ff40b, KEY_ENTER },
36 	{ 0x02000028, KEY_ENTER },
37 /* the OK and Enter buttons decode to the same value on some remotes
38 	{ 0x02000028, KEY_OK }, */
39 	{ 0x800ff422, KEY_OK },
40 	{ 0x0200002a, KEY_EXIT },
41 	{ 0x800ff423, KEY_EXIT },
42 	{ 0x02000029, KEY_DELETE },
43 	/* 0x800ff40a also KEY_NUMERIC_STAR on some receivers */
44 	{ 0x800ff40a, KEY_DELETE },
45 
46 	{ 0x800ff40e, KEY_MUTE },
47 	{ 0x800ff410, KEY_VOLUMEUP },
48 	{ 0x800ff411, KEY_VOLUMEDOWN },
49 	{ 0x800ff412, KEY_CHANNELUP },
50 	{ 0x800ff413, KEY_CHANNELDOWN },
51 
52 	{ 0x0200001e, KEY_NUMERIC_1 },
53 	{ 0x0200001f, KEY_NUMERIC_2 },
54 	{ 0x02000020, KEY_NUMERIC_3 },
55 	{ 0x02000021, KEY_NUMERIC_4 },
56 	{ 0x02000022, KEY_NUMERIC_5 },
57 	{ 0x02000023, KEY_NUMERIC_6 },
58 	{ 0x02000024, KEY_NUMERIC_7 },
59 	{ 0x02000025, KEY_NUMERIC_8 },
60 	{ 0x02000026, KEY_NUMERIC_9 },
61 	{ 0x02000027, KEY_NUMERIC_0 },
62 
63 	{ 0x800ff401, KEY_NUMERIC_1 },
64 	{ 0x800ff402, KEY_NUMERIC_2 },
65 	{ 0x800ff403, KEY_NUMERIC_3 },
66 	{ 0x800ff404, KEY_NUMERIC_4 },
67 	{ 0x800ff405, KEY_NUMERIC_5 },
68 	{ 0x800ff406, KEY_NUMERIC_6 },
69 	{ 0x800ff407, KEY_NUMERIC_7 },
70 	{ 0x800ff408, KEY_NUMERIC_8 },
71 	{ 0x800ff409, KEY_NUMERIC_9 },
72 	{ 0x800ff400, KEY_NUMERIC_0 },
73 
74 	{ 0x02200025, KEY_NUMERIC_STAR },
75 	{ 0x02200020, KEY_NUMERIC_POUND },
76 	/* 0x800ff41d also KEY_BLUE on some receivers */
77 	{ 0x800ff41d, KEY_NUMERIC_STAR },
78 	/* 0x800ff41c also KEY_PREVIOUS on some receivers */
79 	{ 0x800ff41c, KEY_NUMERIC_POUND },
80 
81 	{ 0x800ff446, KEY_TV },
82 	{ 0x800ff447, KEY_AUDIO }, /* My Music */
83 	{ 0x800ff448, KEY_PVR }, /* RecordedTV */
84 	{ 0x800ff449, KEY_CAMERA },
85 	{ 0x800ff44a, KEY_VIDEO },
86 	/* 0x800ff424 also KEY_MENU on some receivers */
87 	{ 0x800ff424, KEY_DVD },
88 	/* 0x800ff425 also KEY_GREEN on some receivers */
89 	{ 0x800ff425, KEY_TUNER }, /* LiveTV */
90 	{ 0x800ff450, KEY_RADIO },
91 
92 	{ 0x800ff44c, KEY_LANGUAGE },
93 	{ 0x800ff427, KEY_ZOOM }, /* Aspect */
94 
95 	{ 0x800ff45b, KEY_RED },
96 	{ 0x800ff45c, KEY_GREEN },
97 	{ 0x800ff45d, KEY_YELLOW },
98 	{ 0x800ff45e, KEY_BLUE },
99 
100 	{ 0x800ff466, KEY_RED },
101 	/* { 0x800ff425, KEY_GREEN }, */
102 	{ 0x800ff468, KEY_YELLOW },
103 	/* { 0x800ff41d, KEY_BLUE }, */
104 
105 	{ 0x800ff40f, KEY_INFO },
106 	{ 0x800ff426, KEY_EPG }, /* Guide */
107 	{ 0x800ff45a, KEY_SUBTITLE }, /* Caption/Teletext */
108 	{ 0x800ff44d, KEY_TITLE },
109 
110 	{ 0x800ff40c, KEY_POWER },
111 	{ 0x800ff40d, KEY_MEDIA }, /* Windows MCE button */
112 
113 };
114 
115 static struct rc_map_list imon_mce_map = {
116 	.map = {
117 		.scan     = imon_mce,
118 		.size     = ARRAY_SIZE(imon_mce),
119 		/* its RC6, but w/a hardware decoder */
120 		.rc_proto = RC_PROTO_RC6_MCE,
121 		.name     = RC_MAP_IMON_MCE,
122 	}
123 };
124 
init_rc_map_imon_mce(void)125 static int __init init_rc_map_imon_mce(void)
126 {
127 	return rc_map_register(&imon_mce_map);
128 }
129 
exit_rc_map_imon_mce(void)130 static void __exit exit_rc_map_imon_mce(void)
131 {
132 	rc_map_unregister(&imon_mce_map);
133 }
134 
135 module_init(init_rc_map_imon_mce)
136 module_exit(exit_rc_map_imon_mce)
137 
138 MODULE_LICENSE("GPL");
139 MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
140