All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarod Wilson <jarod@redhat.com>
To: linux-media@vger.kernel.org
Subject: [RFC PATCH 2/2] IR: add Apple remote keymap
Date: Thu, 28 Oct 2010 23:13:54 -0400	[thread overview]
Message-ID: <20101029031354.GG17238@redhat.com> (raw)
In-Reply-To: <20101029031131.GE17238@redhat.com>

There are at least two variants, and probably more, of the Apple
remotes. http://en.wikipedia.org/wiki/Apple_Remote contains one set of
codes, while the Apple remote I have in my possession sends a slightly
different set of codes. Just add both to the table. Probably needs
extending for the latest Apple remote, but I don't have one of those.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 drivers/media/IR/keymaps/Makefile       |    1 +
 drivers/media/IR/keymaps/rc-nec-apple.c |   51 +++++++++++++++++++++++++++++++
 include/media/rc-map.h                  |    1 +
 3 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/IR/keymaps/rc-nec-apple.c

diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile
index 3194d39..8fa0e53 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-msi-tvanywhere.o \
 			rc-msi-tvanywhere-plus.o \
 			rc-nebula.o \
+			rc-nec-apple.o \
 			rc-nec-terratec-cinergy-xs.o \
 			rc-norwood.o \
 			rc-npgtech.o \
diff --git a/drivers/media/IR/keymaps/rc-nec-apple.c b/drivers/media/IR/keymaps/rc-nec-apple.c
new file mode 100644
index 0000000..9f6189c
--- /dev/null
+++ b/drivers/media/IR/keymaps/rc-nec-apple.c
@@ -0,0 +1,51 @@
+/* rc-nec-apple.c - Keytable for Apple Remote Controls
+ *
+ * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+
+static struct ir_scancode nec_apple[] = {
+	{ 0xee8702, KEY_MENU},
+	{ 0xee8703, KEY_MENU},
+	{ 0xee8704, KEY_PLAYPAUSE},
+	{ 0xee8705, KEY_PLAYPAUSE},
+	{ 0xee8706, KEY_FORWARD},
+	{ 0xee8707, KEY_FORWARD},
+	{ 0xee8708, KEY_BACK},
+	{ 0xee8709, KEY_BACK},
+	{ 0xee870a, KEY_VOLUMEUP},
+	{ 0xee870b, KEY_VOLUMEUP},
+	{ 0xee870c, KEY_VOLUMEDOWN},
+	{ 0xee870d, KEY_VOLUMEDOWN},
+};
+
+static struct rc_keymap nec_apple_map = {
+	.map = {
+		.scan    = nec_apple,
+		.size    = ARRAY_SIZE(nec_apple),
+		.ir_type = IR_TYPE_NEC,
+		.name    = RC_MAP_NEC_APPLE,
+	}
+};
+
+static int __init init_rc_map_nec_apple(void)
+{
+	return ir_register_map(&nec_apple_map);
+}
+
+static void __exit exit_rc_map_nec_apple(void)
+{
+	ir_unregister_map(&nec_apple_map);
+}
+
+module_init(init_rc_map_nec_apple)
+module_exit(exit_rc_map_nec_apple)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 25883cf..868f0c3 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -110,6 +110,7 @@ void rc_map_init(void);
 #define RC_MAP_MSI_TVANYWHERE_PLUS       "rc-msi-tvanywhere-plus"
 #define RC_MAP_MSI_TVANYWHERE            "rc-msi-tvanywhere"
 #define RC_MAP_NEBULA                    "rc-nebula"
+#define RC_MAP_NEC_APPLE                 "rc-nec-apple"
 #define RC_MAP_NEC_TERRATEC_CINERGY_XS   "rc-nec-terratec-cinergy-xs"
 #define RC_MAP_NORWOOD                   "rc-norwood"
 #define RC_MAP_NPGTECH                   "rc-npgtech"
-- 
1.7.1


-- 
Jarod Wilson
jarod@redhat.com


  parent reply	other threads:[~2010-10-29  3:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29  3:11 [RFC PATCH 0/2] Apple remote support Jarod Wilson
2010-10-29  3:13 ` [RFC PATCH 1/2] ir-nec-decoder: decode Apple's NEC remote variant Jarod Wilson
2010-10-29 22:15   ` Andy Walls
2010-10-29  3:13 ` Jarod Wilson [this message]
2010-10-29  3:15 ` [RFC PATCH 0/2] Apple remote support Jarod Wilson
2010-10-29 13:46   ` Mauro Carvalho Chehab
2010-10-29 15:11     ` Jarod Wilson
2010-10-29 19:17       ` David Härdeman
2010-10-29 19:27         ` Jarod Wilson
2010-10-29 19:59           ` David Härdeman
2010-10-29 20:09             ` Jarod Wilson
2010-10-30 23:36               ` David Härdeman
2010-10-31  2:32                 ` Jarod Wilson
2010-11-01 21:56                   ` David Härdeman
2010-11-02 20:42                     ` Jarod Wilson
2010-11-04 12:16                       ` David Härdeman
2010-11-04 15:54                         ` Jarod Wilson
2010-11-04 19:38                           ` David Härdeman
2010-11-04 19:43                             ` Mauro Carvalho Chehab
2010-11-05 13:27                               ` David Härdeman
2010-11-05 14:04                                 ` Christopher Harrington
2010-11-07 19:01                                   ` Jarod Wilson
2010-11-15  4:11                                 ` Jarod Wilson
2010-11-15 18:39                                   ` David Härdeman
2010-11-16 12:08                                   ` Mauro Carvalho Chehab
2010-11-16 23:26                                     ` David Härdeman
2010-11-18 16:33                                       ` Jarod Wilson
2010-11-18 20:43                                         ` David Härdeman
2010-11-18 20:49                                           ` Jarod Wilson
2010-11-18 20:59                                             ` Mauro Carvalho Chehab
2010-11-19 23:55                                               ` David Härdeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101029031354.GG17238@redhat.com \
    --to=jarod@redhat.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.