From patchwork Sun Jan 17 18:51:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Rakitnican X-Patchwork-Id: 2477 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sun, 17 Jan 2010 18:52:14 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Sun, 17 Jan 2010 16:57:42 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NWaEQ-0007uc-CA; Sun, 17 Jan 2010 18:52:14 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754323Ab0AQSwM (ORCPT + 1 other); Sun, 17 Jan 2010 13:52:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754302Ab0AQSwM (ORCPT ); Sun, 17 Jan 2010 13:52:12 -0500 Received: from mail-fx0-f225.google.com ([209.85.220.225]:52941 "EHLO mail-fx0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754264Ab0AQSwI (ORCPT ); Sun, 17 Jan 2010 13:52:08 -0500 Received: by fxm25 with SMTP id 25so488687fxm.21 for ; Sun, 17 Jan 2010 10:52:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:cc:references :subject:to:date:mime-version:content-transfer-encoding:from :message-id:in-reply-to:user-agent; bh=8dz8oDGh8mvnLyl3SfRCjM7qQIvjnUKVfSL41CQj4x8=; b=c0tnnpnZ8++2wZcmajL1+NK0dDJHoa83lJdYiiNgAAMHvhEf55DBnHNYZveb3PPEzk aXDJ2ik+YwBzEJajrv2yMymFngBGJaMgAtTL13lGcx7hn6W7P+QFjXUZUW9C/CtmCBWE 472oyr+wZhVHAYq0iorQhLsBp9HfHwKWoPpN8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:cc:references:subject:to:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; b=Znnvai0Q9a2uph3yh9iwLVTL8XnWkudYwmBuunQutqmwbjsIkxdcbi91e7xiOtFUQT kAQLG062MFse/IN8jMZ5/yEAuM/duROTcmg3Yd/Gh7KgENUEjYJ+Dqkh1O6CvHnSwZHy 9w3oueM5qaaUvN2/Uoyfc482c5d0OY5F8+dDs= Received: by 10.87.40.9 with SMTP id s9mr6319225fgj.11.1263754326975; Sun, 17 Jan 2010 10:52:06 -0800 (PST) Received: from denis-laptop.lan (93-137-61-250.adsl.net.t-com.hr [93.137.61.250]) by mx.google.com with ESMTPS id 3sm9423798fge.21.2010.01.17.10.51.56 (version=SSLv3 cipher=RC4-MD5); Sun, 17 Jan 2010 10:52:06 -0800 (PST) Cc: "linux-media@vger.kernel.org" References: Subject: [RESEND PATCH] ir-kbd-i2c: Allow to disable Hauppauge filter through module parameter To: "Mauro Carvalho Chehab" Date: Sun, 17 Jan 2010 19:51:06 +0100 MIME-Version: 1.0 From: "Samuel Rakitnican" Message-ID: In-Reply-To: User-Agent: Opera Mail/10.10 (Win32) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some Hauppauge devices have id=0 so such devices won't work. For such devices add a module parameter that allow to turn off filtering. Signed-off-by: Samuel Rakitni?an diff -r 82bbb3bd0f0a linux/drivers/media/video/ir-kbd-i2c.c --- a/linux/drivers/media/video/ir-kbd-i2c.c Mon Jan 11 11:47:33 2010 -0200 +++ b/linux/drivers/media/video/ir-kbd-i2c.c Sat Jan 16 16:39:14 2010 +0100 @@ -61,6 +61,10 @@ module_param(hauppauge, int, 0644); /* Choose Hauppauge remote */ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)"); +static int haup_filter = 1; +module_param(haup_filter, int, 0644); +MODULE_PARM_DESC(haup_filter, "Hauppauge filter for other remotes, default is 1 (On)"); + #define DEVNAME "ir-kbd-i2c" #define dprintk(level, fmt, arg...) if (debug >= level) \ @@ -96,24 +100,27 @@ if (!start) /* no key pressed */ return 0; - /* - * Hauppauge remotes (black/silver) always use - * specific device ids. If we do not filter the - * device ids then messages destined for devices - * such as TVs (id=0) will get through causing - * mis-fired events. - * - * We also filter out invalid key presses which - * produce annoying debug log entries. - */ - ircode= (start << 12) | (toggle << 11) | (dev << 6) | code; - if ((ircode & 0x1fff)==0x1fff) - /* invalid key press */ - return 0; - if (dev!=0x1e && dev!=0x1f) - /* not a hauppauge remote */ - return 0; + if (haup_filter != 0) { + /* + * Hauppauge remotes (black/silver) always use + * specific device ids. If we do not filter the + * device ids then messages destined for devices + * such as TVs (id=0) will get through causing + * mis-fired events. + * + * We also filter out invalid key presses which + * produce annoying debug log entries. + */ + ircode = (start << 12) | (toggle << 11) | (dev << 6) | code; + if ((ircode & 0x1fff) == 0x1fff) + /* invalid key press */ + return 0; + + if (dev != 0x1e && dev != 0x1f) + /* not a hauppauge remote */ + return 0; + } if (!range) code += 64;