From patchwork Fri Jul 30 11:38:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 115464 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 o6UBdJtM029693 for ; Fri, 30 Jul 2010 11:39:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758511Ab0G3LjP (ORCPT ); Fri, 30 Jul 2010 07:39:15 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:41194 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758365Ab0G3LjM (ORCPT ); Fri, 30 Jul 2010 07:39:12 -0400 Received: by mail-fx0-f46.google.com with SMTP id 14so798201fxm.19 for ; Fri, 30 Jul 2010 04:39:12 -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=miT9tf/F1jMYFd3PMb0J1Q4E07uoQdMcozuBWQyOyKcFQ+NKDFA4Ngquxz2UplCBe3 JyDle619/V590ZYoHN5CjKmFjlUvRmh/6m6cP+igNkkFFxK5TuPN7wtilxsFzb/MwgND KkcgtXr8WlyxszH9rfdXi7Bm2LKqrKD00Lr6M= 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=ask+PItzynMgHvyirFa72Vrqs/P0MnbO4b0z8eEmhA9OZkhB7ao6f8Pd7JErQ5AxrU PngnLNm2fn7ppjUBeNnQK3fMEe2OwbHrz9XrqJeefYZLpUKxGVOpiHXyl/HttbhHarMw YoTTQlDY6qI0oko5Jf/AzIJioX4MyYneNu5nE= Received: by 10.223.119.203 with SMTP id a11mr1890092far.42.1280489952026; Fri, 30 Jul 2010 04:39:12 -0700 (PDT) Received: from localhost.localdomain (IGLD-84-228-19-51.inter.net.il [84.228.19.51]) by mx.google.com with ESMTPS id q17sm767482faa.21.2010.07.30.04.39.10 (version=SSLv3 cipher=RC4-MD5); Fri, 30 Jul 2010 04:39:11 -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: Fri, 30 Jul 2010 14:38:45 +0300 Message-Id: <1280489933-20865-6-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280489933-20865-1-git-send-email-maximlevitsky@gmail.com> References: <1280489933-20865-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]); Fri, 30 Jul 2010 11:39:19 +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: