aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-08-06 17:18:12 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-22 09:54:40 -0400
commit999d6bc9b142a531fb10652c64de51e2ad672a1e (patch)
treed9e2f49851a9c09c0f3f874688e8d37983807cd0 /drivers
parent175fcecf79b4698c7beea5810326dba66a56ea39 (diff)
[media] ati_remote: add support for SnapStream Firefly remote
The protocol differs by having two toggle bits in the scancode. Since one of the bits is otherwise unused, we can safely handle the bits unconditionally. [mchehab@redhat.com: Fix some bad whitespacing] Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/rc/ati_remote.c15
-rw-r--r--drivers/media/rc/keymaps/Makefile1
-rw-r--r--drivers/media/rc/keymaps/rc-snapstream-firefly.c106
3 files changed, 120 insertions, 2 deletions
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 94d241d37619..303f22ea04c0 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -107,6 +107,7 @@
107#define ATI_REMOTE_PRODUCT_ID 0x0004 107#define ATI_REMOTE_PRODUCT_ID 0x0004
108#define NVIDIA_REMOTE_PRODUCT_ID 0x0005 108#define NVIDIA_REMOTE_PRODUCT_ID 0x0005
109#define MEDION_REMOTE_PRODUCT_ID 0x0006 109#define MEDION_REMOTE_PRODUCT_ID 0x0006
110#define FIREFLY_REMOTE_PRODUCT_ID 0x0008
110 111
111#define DRIVER_VERSION "2.2.1" 112#define DRIVER_VERSION "2.2.1"
112#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>" 113#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>"
@@ -156,6 +157,7 @@ static struct usb_device_id ati_remote_table[] = {
156 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 }, 157 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 },
157 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 }, 158 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 },
158 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_MEDION_X10 }, 159 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_MEDION_X10 },
160 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_SNAPSTREAM_FIREFLY },
159 {} /* Terminating entry */ 161 {} /* Terminating entry */
160}; 162};
161 163
@@ -482,7 +484,15 @@ static void ati_remote_input_report(struct urb *urb)
482 484
483 scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f)); 485 scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f));
484 486
485 scancode[1] = data[2]; 487 /*
488 * Some devices (e.g. SnapStream Firefly) use 8080 as toggle code,
489 * so we have to clear them. The first bit is a bit tricky as the
490 * "non-toggled" state depends on remote_num, so we xor it with the
491 * second bit which is only used for toggle.
492 */
493 scancode[0] ^= (data[2] & 0x80);
494
495 scancode[1] = data[2] & ~0x80;
486 496
487 /* Look up event code index in mouse translation table. */ 497 /* Look up event code index in mouse translation table. */
488 index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]); 498 index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]);
@@ -546,7 +556,8 @@ static void ati_remote_input_report(struct urb *urb)
546 * it would cause ghost repeats which would be a 556 * it would cause ghost repeats which would be a
547 * regression for this driver. 557 * regression for this driver.
548 */ 558 */
549 rc_keydown_notimeout(ati_remote->rdev, rc_code, 0); 559 rc_keydown_notimeout(ati_remote->rdev, rc_code,
560 data[2]);
550 rc_keyup(ati_remote->rdev); 561 rc_keyup(ati_remote->rdev);
551 return; 562 return;
552 } 563 }
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 2b97b4327ab2..36e4d5e8dd6a 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -72,6 +72,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
72 rc-hauppauge.o \ 72 rc-hauppauge.o \
73 rc-rc6-mce.o \ 73 rc-rc6-mce.o \
74 rc-real-audio-220-32-keys.o \ 74 rc-real-audio-220-32-keys.o \
75 rc-snapstream-firefly.o \
75 rc-streamzap.o \ 76 rc-streamzap.o \
76 rc-tbs-nec.o \ 77 rc-tbs-nec.o \
77 rc-technisat-usb2.o \ 78 rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-snapstream-firefly.c b/drivers/media/rc/keymaps/rc-snapstream-firefly.c
new file mode 100644
index 000000000000..5836aa216621
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-snapstream-firefly.c
@@ -0,0 +1,106 @@
1/*
2 * SnapStream Firefly X10 RF remote keytable
3 *
4 * Copyright (C) 2011 Anssi Hannula <anssi.hannula@?ki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <media/rc-map.h>
22
23static struct rc_map_table snapstream_firefly[] = {
24 { 0xf12c, KEY_ZOOM }, /* Maximize */
25 { 0xc702, KEY_CLOSE },
26
27 { 0xd20d, KEY_1 },
28 { 0xd30e, KEY_2 },
29 { 0xd40f, KEY_3 },
30 { 0xd510, KEY_4 },
31 { 0xd611, KEY_5 },
32 { 0xd712, KEY_6 },
33 { 0xd813, KEY_7 },
34 { 0xd914, KEY_8 },
35 { 0xda15, KEY_9 },
36 { 0xdc17, KEY_0 },
37 { 0xdb16, KEY_BACK },
38 { 0xdd18, KEY_KPENTER }, /* ent */
39
40 { 0xce09, KEY_VOLUMEUP },
41 { 0xcd08, KEY_VOLUMEDOWN },
42 { 0xcf0a, KEY_MUTE },
43 { 0xd00b, KEY_CHANNELUP },
44 { 0xd10c, KEY_CHANNELDOWN },
45 { 0xc500, KEY_VENDOR }, /* firefly */
46
47 { 0xf32e, KEY_INFO },
48 { 0xf42f, KEY_OPTION },
49
50 { 0xe21d, KEY_LEFT },
51 { 0xe41f, KEY_RIGHT },
52 { 0xe722, KEY_DOWN },
53 { 0xdf1a, KEY_UP },
54 { 0xe31e, KEY_OK },
55
56 { 0xe11c, KEY_MENU },
57 { 0xe520, KEY_EXIT },
58
59 { 0xec27, KEY_RECORD },
60 { 0xea25, KEY_PLAY },
61 { 0xed28, KEY_STOP },
62 { 0xe924, KEY_REWIND },
63 { 0xeb26, KEY_FORWARD },
64 { 0xee29, KEY_PAUSE },
65 { 0xf02b, KEY_PREVIOUS },
66 { 0xef2a, KEY_NEXT },
67
68 { 0xcb06, KEY_AUDIO }, /* Music */
69 { 0xca05, KEY_IMAGES }, /* Photos */
70 { 0xc904, KEY_DVD },
71 { 0xc803, KEY_TV },
72 { 0xcc07, KEY_VIDEO },
73
74 { 0xc601, KEY_HELP },
75 { 0xf22d, KEY_MODE }, /* Mouse */
76
77 { 0xde19, KEY_A },
78 { 0xe01b, KEY_B },
79 { 0xe621, KEY_C },
80 { 0xe823, KEY_D },
81};
82
83static struct rc_map_list snapstream_firefly_map = {
84 .map = {
85 .scan = snapstream_firefly,
86 .size = ARRAY_SIZE(snapstream_firefly),
87 .rc_type = RC_TYPE_OTHER,
88 .name = RC_MAP_SNAPSTREAM_FIREFLY,
89 }
90};
91
92static int __init init_rc_map_snapstream_firefly(void)
93{
94 return rc_map_register(&snapstream_firefly_map);
95}
96
97static void __exit exit_rc_map_snapstream_firefly(void)
98{
99 rc_map_unregister(&snapstream_firefly_map);
100}
101
102module_init(init_rc_map_snapstream_firefly)
103module_exit(exit_rc_map_snapstream_firefly)
104
105MODULE_LICENSE("GPL");
106MODULE_AUTHOR("Anssi Hannula <anssi.hannula@iki.fi>");