From patchwork Sat Nov 21 11:16:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TsODwqltZXRoIE3Dg8KhcnRvbg==?= X-Patchwork-Id: 61872 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nALBH5bN012061 for ; Sat, 21 Nov 2009 11:17:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753615AbZKULQ5 (ORCPT ); Sat, 21 Nov 2009 06:16:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753555AbZKULQ5 (ORCPT ); Sat, 21 Nov 2009 06:16:57 -0500 Received: from mail01a.mail.t-online.hu ([84.2.40.6]:57547 "EHLO mail01a.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbZKULQ4 (ORCPT ); Sat, 21 Nov 2009 06:16:56 -0500 Received: from [192.168.1.64] (dsl51B6C41D.pool.t-online.hu [81.182.196.29]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail01a.mail.t-online.hu (Postfix) with ESMTPSA id 6F992797F1F; Sat, 21 Nov 2009 12:16:07 +0100 (CET) Message-ID: <4B07CC2B.2020301@freemail.hu> Date: Sat, 21 Nov 2009 12:16:59 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Hans de Goede , linux-input@vger.kernel.org CC: Jean-Francois Moine , V4L Mailing List Subject: Re: [RFC, PATCH 2/2] gspca pac7302: add support for camera button References: <4B04F7EA.4020804@freemail.hu> <4B0641CF.1000000@freemail.hu> In-Reply-To: <4B0641CF.1000000@freemail.hu> X-DCC-mail.t-online.hu-Metrics: mail01a.mail.t-online.hu 32711; Body=4 Fuz1=4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff -r abfdd03b800d linux/drivers/media/video/gspca/pac7302.c --- a/linux/drivers/media/video/gspca/pac7302.c Thu Nov 19 10:34:21 2009 +0100 +++ b/linux/drivers/media/video/gspca/pac7302.c Sat Nov 21 13:02:44 2009 +0100 @@ -68,8 +68,10 @@ #define MODULE_NAME "pac7302" +#include #include #include "gspca.h" +#include "input.h" MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_DESCRIPTION("Pixart PAC7302"); @@ -1220,6 +1222,37 @@ } #endif +#ifdef CONFIG_INPUT +static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, + u8 *data, /* interrupt packet data */ + int len) /* interrput packet length */ +{ + int ret = -EINVAL; + u8 data0, data1; + + if (len == 2) { + data0 = data[0]; + data1 = data[1]; + if ((data0 == 0x00 && data1 == 0x11) || + (data0 == 0x22 && data1 == 0x33) || + (data0 == 0x44 && data1 == 0x55) || + (data0 == 0x66 && data1 == 0x77) || + (data0 == 0x88 && data1 == 0x99) || + (data0 == 0xaa && data1 == 0xbb) || + (data0 == 0xcc && data1 == 0xdd) || + (data0 == 0xee && data1 == 0xff)) { + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); + input_sync(gspca_dev->input_dev); + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); + input_sync(gspca_dev->input_dev); + ret = 0; + } + } + + return ret; +} +#endif + /* sub-driver description for pac7302 */ static struct sd_desc sd_desc = { .name = MODULE_NAME, @@ -1236,6 +1269,9 @@ .set_register = sd_dbg_s_register, .get_chip_ident = sd_chip_ident, #endif +#ifdef CONFIG_INPUT + .int_pkt_scan = sd_int_pkt_scan, +#endif }; /* -- module initialisation -- */