xref: /linux/drivers/media/rc/keymaps/rc-xbox-360.c (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 // SPDX-License-Identifier: GPL-2.0+
2 // Keytable for Xbox 360 Universal Media remote
3 // Copyright (c) 2021 Bastien Nocera <hadess@hadess.net>
4 
5 #include <media/rc-map.h>
6 #include <linux/module.h>
7 
8 /*
9  * Manual for remote available at:
10  * http://download.microsoft.com/download/b/c/e/bce76f3f-db51-4c98-b79d-b3d21e90ccc1/universalmediaremote_na_0609.pdf
11  */
12 static struct rc_map_table xbox_360[] = {
13 	{KEY_EJECTCD, 0x800f7428},
14 	{KEY_HOMEPAGE, 0x800f7464},
15 	{KEY_POWER, 0x800f740c},
16 	{KEY_STOP, 0x800f7419},
17 	{KEY_PAUSE, 0x800f7418},
18 	{KEY_REWIND, 0x800f7415},
19 	{KEY_FASTFORWARD, 0x800f7414},
20 	{KEY_PREVIOUS, 0x800f741b},
21 	{KEY_NEXT, 0x800f741a},
22 	{KEY_PLAY, 0x800f7416},
23 	{KEY_PROPS, 0x800f744f}, /* "Display" */
24 	{KEY_BACK, 0x800f7423},
25 	{KEY_MEDIA_TOP_MENU, 0x800f7424}, /* "DVD Menu" */
26 	{KEY_ROOT_MENU, 0x800f7451}, /* "Title" */
27 	{KEY_INFO, 0x800f740f},
28 	{KEY_UP, 0x800f741e},
29 	{KEY_LEFT, 0x800f7420},
30 	{KEY_RIGHT, 0x800f7421},
31 	{KEY_DOWN, 0x800f741f},
32 	{KEY_OK, 0x800f7422},
33 	{KEY_YELLOW, 0x800f7426},
34 	{KEY_BLUE, 0x800f7468},
35 	{KEY_GREEN, 0x800f7466},
36 	{KEY_RED, 0x800f7425},
37 	{KEY_VOLUMEUP, 0x800f7410},
38 	{KEY_VOLUMEDOWN, 0x800f7411},
39 	/* TV key doesn't light the IR LED */
40 	{KEY_MUTE, 0x800f740e},
41 	{KEY_CHANNELUP, 0x800f746c},
42 	{KEY_CHANNELDOWN, 0x800f746d},
43 	{KEY_LEFTMETA, 0x800f740d},
44 	{KEY_ENTER, 0x800f740b},
45 	{KEY_RECORD, 0x800f7417},
46 	{KEY_CLEAR, 0x800f740a},
47 	{KEY_NUMERIC_1, 0x800f7401},
48 	{KEY_NUMERIC_2, 0x800f7402},
49 	{KEY_NUMERIC_3, 0x800f7403},
50 	{KEY_NUMERIC_4, 0x800f7404},
51 	{KEY_NUMERIC_5, 0x800f7405},
52 	{KEY_NUMERIC_6, 0x800f7406},
53 	{KEY_NUMERIC_7, 0x800f7407},
54 	{KEY_NUMERIC_8, 0x800f7408},
55 	{KEY_NUMERIC_9, 0x800f7409},
56 	{KEY_NUMERIC_0, 0x800f7400},
57 	{KEY_102ND, 0x800f741d}, /* "100" */
58 	{KEY_CANCEL, 0x800f741c},
59 };
60 
61 static struct rc_map_list xbox_360_map = {
62 	.map = {
63 		.scan     = xbox_360,
64 		.size     = ARRAY_SIZE(xbox_360),
65 		.rc_proto = RC_PROTO_RC6_MCE,
66 		.name     = RC_MAP_XBOX_360,
67 	}
68 };
69 
init_rc_map(void)70 static int __init init_rc_map(void)
71 {
72 	return rc_map_register(&xbox_360_map);
73 }
74 
exit_rc_map(void)75 static void __exit exit_rc_map(void)
76 {
77 	rc_map_unregister(&xbox_360_map);
78 }
79 
80 module_init(init_rc_map)
81 module_exit(exit_rc_map)
82 
83 MODULE_LICENSE("GPL");
84 MODULE_DESCRIPTION("Xbox 360 Universal Media remote controller keytable");
85