From patchwork Sat Aug 6 22:18:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 1042122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p76MSa85021332 for ; Sat, 6 Aug 2011 22:28:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756914Ab1HFW20 (ORCPT ); Sat, 6 Aug 2011 18:28:26 -0400 Received: from sirokuusama.dnainternet.net ([83.102.40.133]:44456 "EHLO sirokuusama.dnainternet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756808Ab1HFW2Y (ORCPT ); Sat, 6 Aug 2011 18:28:24 -0400 Received: from localhost (localhost [127.0.0.1]) by sirokuusama.dnainternet.net (Postfix) with ESMTP id 759CA3FFF2; Sun, 7 Aug 2011 01:19:20 +0300 (EEST) X-Virus-Scanned: DNA Postiturva at dnainternet.net X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-9999 required=6 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from sirokuusama.dnainternet.net ([83.102.40.133]) by localhost (sirokuusama.dnainternet.net [127.0.0.1]) (DNA Postiturva, port 10041) with ESMTP id 88Jms15bJx3v; Sun, 7 Aug 2011 01:19:20 +0300 (EEST) Received: from omenapuu.dnainternet.net (omenapuu.dnainternet.net [83.102.40.212]) by sirokuusama.dnainternet.net (Postfix) with ESMTP id 0471B3F855; Sun, 7 Aug 2011 01:19:20 +0300 (EEST) Received: from mail.onse.fi (host-109-204-162-131.tp-fne.tampereenpuhelin.net [109.204.162.131]) by omenapuu.dnainternet.net (Postfix) with ESMTP id D11672BAD5; Sun, 7 Aug 2011 01:19:15 +0300 (EEST) Received: by mail.onse.fi (Postfix, from userid 501) id ACC69200FCF; Sun, 7 Aug 2011 01:19:15 +0300 (EEST) From: Anssi Hannula To: dmitry.torokhov@gmail.com Cc: linux-media@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: =?UTF-8?q?=5BPATCH=206/7=5D=20=5Bmedia=5D=20ati=5Fremote=3A=20add=20support=20for=20SnapStream=20Firefly=20remote?= Date: Sun, 7 Aug 2011 01:18:12 +0300 Message-Id: <1312669093-23771-7-git-send-email-anssi.hannula@iki.fi> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1312669093-23771-1-git-send-email-anssi.hannula@iki.fi> References: <4E3DB2C2.7040104@iki.fi> <1312669093-23771-1-git-send-email-anssi.hannula@iki.fi> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 06 Aug 2011 22:28:36 +0000 (UTC) diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 4576462..9e03efa 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -107,6 +107,7 @@ #define ATI_REMOTE_PRODUCT_ID 0x0004 #define NVIDIA_REMOTE_PRODUCT_ID 0x0005 #define MEDION_REMOTE_PRODUCT_ID 0x0006 +#define FIREFLY_REMOTE_PRODUCT_ID 0x0008 #define DRIVER_VERSION "2.2.1" #define DRIVER_AUTHOR "Torrey Hoffman " @@ -156,6 +157,7 @@ static struct usb_device_id ati_remote_table[] = { { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 }, { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_ATI_X10 }, { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_MEDION_X10 }, + { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)RC_MAP_SNAPSTREAM_FIREFLY }, {} /* Terminating entry */ }; @@ -482,7 +484,15 @@ static void ati_remote_input_report(struct urb *urb) scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f)); - scancode[1] = data[2]; + /* + * Some devices (e.g. SnapStream Firefly) use 8080 as toggle code, + * so we have to clear them. The first bit is a bit tricky as the + * "non-toggled" state depends on remote_num, so we xor it with the + * second bit which is only used for toggle. + */ + scancode[0] ^= (data[2] & 0x80); + + scancode[1] = data[2] & ~0x80; /* Look up event code index in mouse translation table. */ index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]); @@ -546,7 +556,8 @@ static void ati_remote_input_report(struct urb *urb) * it would cause ghost repeats which would be a * regression for this driver. */ - rc_keydown_notimeout(ati_remote->rdev, rc_code, 0); + rc_keydown_notimeout(ati_remote->rdev, rc_code, + data[2]); rc_keyup(ati_remote->rdev); return; } diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index c3d0f34..5ff4d10 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 \ rc-hauppauge.o \ rc-rc6-mce.o \ rc-real-audio-220-32-keys.o \ + rc-snapstream-firefly.o \ rc-streamzap.o \ rc-tbs-nec.o \ 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 0000000..2df02e4 --- /dev/null +++ b/drivers/media/rc/keymaps/rc-snapstream-firefly.c @@ -0,0 +1,106 @@ +/* + * SnapStream Firefly X10 RF remote keytable + * + * Copyright (C) 2011 Anssi Hannula + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +static struct rc_map_table snapstream_firefly[] = { + { 0xf12c, KEY_ZOOM }, /* Maximize */ + { 0xc702, KEY_CLOSE }, + + { 0xd20d, KEY_1 }, + { 0xd30e, KEY_2 }, + { 0xd40f, KEY_3 }, + { 0xd510, KEY_4 }, + { 0xd611, KEY_5 }, + { 0xd712, KEY_6 }, + { 0xd813, KEY_7 }, + { 0xd914, KEY_8 }, + { 0xda15, KEY_9 }, + { 0xdc17, KEY_0 }, + { 0xdb16, KEY_BACK }, + { 0xdd18, KEY_KPENTER }, /* ent */ + + { 0xce09, KEY_VOLUMEUP }, + { 0xcd08, KEY_VOLUMEDOWN }, + { 0xcf0a, KEY_MUTE }, + { 0xd00b, KEY_CHANNELUP }, + { 0xd10c, KEY_CHANNELDOWN }, + { 0xc500, KEY_VENDOR }, /* firefly */ + + { 0xf32e, KEY_INFO }, + { 0xf42f, KEY_OPTION }, + + { 0xe21d, KEY_LEFT }, + { 0xe41f, KEY_RIGHT }, + { 0xe722, KEY_DOWN }, + { 0xdf1a, KEY_UP }, + { 0xe31e, KEY_OK }, + + { 0xe11c, KEY_MENU }, + { 0xe520, KEY_EXIT }, + + { 0xec27, KEY_RECORD }, + { 0xea25, KEY_PLAY }, + { 0xed28, KEY_STOP }, + { 0xe924, KEY_REWIND }, + { 0xeb26, KEY_FORWARD }, + { 0xee29, KEY_PAUSE }, + { 0xf02b, KEY_PREVIOUS }, + { 0xef2a, KEY_NEXT }, + + { 0xcb06, KEY_AUDIO }, /* Music */ + { 0xca05, KEY_IMAGES }, /* Photos */ + { 0xc904, KEY_DVD }, + { 0xc803, KEY_TV }, + { 0xcc07, KEY_VIDEO }, + + { 0xc601, KEY_HELP }, + { 0xf22d, KEY_MODE }, /* Mouse */ + + { 0xde19, KEY_A }, + { 0xe01b, KEY_B }, + { 0xe621, KEY_C }, + { 0xe823, KEY_D }, +}; + +static struct rc_map_list snapstream_firefly_map = { + .map = { + .scan = snapstream_firefly, + .size = ARRAY_SIZE(snapstream_firefly), + .rc_type = RC_TYPE_OTHER, + .name = RC_MAP_SNAPSTREAM_FIREFLY, + } +}; + +static int __init init_rc_map_snapstream_firefly(void) +{ + return rc_map_register(&snapstream_firefly_map); +} + +static void __exit exit_rc_map_snapstream_firefly(void) +{ + rc_map_unregister(&snapstream_firefly_map); +} + +module_init(init_rc_map_snapstream_firefly) +module_exit(exit_rc_map_snapstream_firefly) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Anssi Hannula "); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 86e7e85..9bc16cf 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -131,6 +131,7 @@ void rc_map_init(void); #define RC_MAP_RC5_TV "rc-rc5-tv" #define RC_MAP_RC6_MCE "rc-rc6-mce" #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" +#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" #define RC_MAP_STREAMZAP "rc-streamzap" #define RC_MAP_TBS_NEC "rc-tbs-nec" #define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2"