From patchwork Thu Jan 28 19:11:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsODwqltZXRoIE3Dg8KhcnRvbg==?= X-Patchwork-Id: 75606 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o0SJC5Y2019423 for ; Thu, 28 Jan 2010 19:12:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754179Ab0A1TME (ORCPT ); Thu, 28 Jan 2010 14:12:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753274Ab0A1TME (ORCPT ); Thu, 28 Jan 2010 14:12:04 -0500 Received: from mail01d.mail.t-online.hu ([84.2.42.6]:50578 "EHLO mail01d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866Ab0A1TMD (ORCPT ); Thu, 28 Jan 2010 14:12:03 -0500 Received: from [192.168.1.67] (dsl5402C4B8.pool.t-online.hu [84.2.196.184]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail01d.mail.t-online.hu (Postfix) with ESMTPSA id 1AF04758CC6; Thu, 28 Jan 2010 20:09:03 +0100 (CET) Message-ID: <4B61E170.80807@freemail.hu> Date: Thu, 28 Jan 2010 20:11:44 +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: Jean-Francois Moine CC: Hans de Goede , V4L Mailing List Subject: [PATCH] gspca pac7302: add support for camera button References: <4B530BC6.90903@freemail.hu> In-Reply-To: <4B530BC6.90903@freemail.hu> X-DCC-mail.t-online.hu-Metrics: mail01d.mail.t-online.hu 32721; Body=3 Fuz1=3 Fuz2=3 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 28 Jan 2010 19:12:06 +0000 (UTC) diff -r 875c200a19dc linux/drivers/media/video/gspca/pac7302.c --- a/linux/drivers/media/video/gspca/pac7302.c Sun Jan 17 07:58:51 2010 +0100 +++ b/linux/drivers/media/video/gspca/pac7302.c Sun Jan 17 13:47:50 2010 +0100 @@ -5,6 +5,8 @@ * V4L2 by Jean-Francois Moine * * Separated from Pixart PAC7311 library by M�rton N�meth + * Camera button input handling by Márton Németh + * Copyright (C) 2009-2010 Márton Németh * * 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 @@ -68,6 +70,7 @@ #define MODULE_NAME "pac7302" +#include #include #include "gspca.h" @@ -1164,6 +1167,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 const struct sd_desc sd_desc = { .name = MODULE_NAME, @@ -1180,6 +1214,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 -- */