From patchwork Sat Jul 31 14:59:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 116204 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6VGE2GU028325 for ; Sat, 31 Jul 2010 16:14:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756175Ab0GaO7x (ORCPT ); Sat, 31 Jul 2010 10:59:53 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:55010 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756096Ab0GaO7o (ORCPT ); Sat, 31 Jul 2010 10:59:44 -0400 Received: by mail-bw0-f46.google.com with SMTP id 1so870874bwz.19 for ; Sat, 31 Jul 2010 07:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=pTcMJMpQLG6/7tE86aVVZt/1yO87RETar2gdL5359ak=; b=B/r1QRGWDYFLRTzTKcIt2wQDx878TWBv0ATKzELJiAHr8wuaH/9m0sJLBtsdr3PNwi UaUOCrLGN79nFuUQb9OsR9bCoNpJ8K30ZSTRR+879P3iO3H6/6sg+XWUbBCYuFAr75eM OEzN4wcidMfVQAbVj5eJS//qsWmCPkINBCzBo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=eOKo+HgjafouptWv44zQAAcX4jAhzVpD7igJV4Epj45+nmiqzbuIpJaDgh8kZctSQV cTDI2R3xHTLMj8jd/oRgHxvDSK8oMNsoTE8MedrSkf3uvHBZ8vAlo+c61u9BYbZzoZho jfjdJxAXJcvm77tM1I7CO7kL2EgwSI3vMTVBM= Received: by 10.204.150.74 with SMTP id x10mr2269725bkv.130.1280588383440; Sat, 31 Jul 2010 07:59:43 -0700 (PDT) Received: from localhost.localdomain (IGLD-84-228-252-15.inter.net.il [84.228.252.15]) by mx.google.com with ESMTPS id a9sm2445428bky.23.2010.07.31.07.59.41 (version=SSLv3 cipher=RC4-MD5); Sat, 31 Jul 2010 07:59:42 -0700 (PDT) From: Maxim Levitsky To: lirc-list@lists.sourceforge.net Cc: Jarod Wilson , linux-input@vger.kernel.org, linux-media@vger.kernel.org, Mauro Carvalho Chehab , Christoph Bartelmus , Maxim Levitsky Subject: [PATCH 05/13] IR: JVC: make repeat work Date: Sat, 31 Jul 2010 17:59:18 +0300 Message-Id: <1280588366-26101-6-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280588366-26101-1-git-send-email-maximlevitsky@gmail.com> References: <1280588366-26101-1-git-send-email-maximlevitsky@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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]); Sat, 31 Jul 2010 16:14:03 +0000 (UTC) diff --git a/drivers/media/IR/ir-jvc-decoder.c b/drivers/media/IR/ir-jvc-decoder.c index 8894d8b..77a89c4 100644 --- a/drivers/media/IR/ir-jvc-decoder.c +++ b/drivers/media/IR/ir-jvc-decoder.c @@ -32,6 +32,7 @@ enum jvc_state { STATE_BIT_SPACE, STATE_TRAILER_PULSE, STATE_TRAILER_SPACE, + STATE_CHECK_REPEAT, }; /** @@ -60,6 +61,7 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev) IR_dprintk(2, "JVC decode started at state %d (%uus %s)\n", data->state, TO_US(ev.duration), TO_STR(ev.pulse)); +again: switch (data->state) { case STATE_INACTIVE: @@ -149,8 +151,18 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev) } data->count = 0; - data->state = STATE_BIT_PULSE; + data->state = STATE_CHECK_REPEAT; return 0; + + case STATE_CHECK_REPEAT: + if (!ev.pulse) + break; + + if (eq_margin(ev.duration, JVC_HEADER_PULSE, JVC_UNIT / 2)) + data->state = STATE_INACTIVE; + else + data->state = STATE_BIT_PULSE; + goto again; } out: