From patchwork Fri Jul 30 11:38:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 115472 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 o6UBdPCV029746 for ; Fri, 30 Jul 2010 11:39:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758530Ab0G3LjZ (ORCPT ); Fri, 30 Jul 2010 07:39:25 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:45485 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758505Ab0G3LjS (ORCPT ); Fri, 30 Jul 2010 07:39:18 -0400 Received: by mail-fx0-f46.google.com with SMTP id 14so798188fxm.19 for ; Fri, 30 Jul 2010 04:39:17 -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=z7hPmJF7bWStwuTakKa9cE3Szhu+Dc52ddb/9V7Gu2s=; b=Bx7RilgSHsNkZjTmMiPT4REHyE6oHQu21S2l1Ee3ISWsI0VwdDndgTP4TAMXnY68df H+qW37WUr3jbbOFrglGTQV3AeO6iQpnE9oJQcjdpqix2O/wQeVECoXF0EFeg8O7jcPOu 3q53v5gqR6trWNlnJ3BU53tCzbJJN0f1Pwiec= 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=CLWp2fPtjo5+dS5Z39Mp26HQ2ExtmuOHdUCQsGIx5tHHjt3GjN4mTKSj4/LqKxB9xq HbF7+DkB0QIKG91U8V3iUAuedaXb3TAXHRQBD94b313wHR1vxBFvjRXTcSE9oECmHsUx O5ruiHy4owYrFATwrNHoFN1EAKZ9B/Ns+inik= Received: by 10.223.114.75 with SMTP id d11mr1887637faq.44.1280489957741; Fri, 30 Jul 2010 04:39:17 -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.14 (version=SSLv3 cipher=RC4-MD5); Fri, 30 Jul 2010 04:39:16 -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 07/13] IR: NECX: support repeat Date: Fri, 30 Jul 2010 14:38:47 +0300 Message-Id: <1280489933-20865-8-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-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]); Fri, 30 Jul 2010 11:39:30 +0000 (UTC) diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h index 84c7a9a..08383b9 100644 --- a/drivers/media/IR/ir-core-priv.h +++ b/drivers/media/IR/ir-core-priv.h @@ -45,6 +45,7 @@ struct ir_raw_event_ctrl { int state; unsigned count; u32 bits; + bool is_nec_x; } nec; struct rc5_dec { int state; diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 1c0cf03..59127b1 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -26,6 +26,7 @@ #define NEC_BIT_1_SPACE (3 * NEC_UNIT) #define NEC_TRAILER_PULSE (1 * NEC_UNIT) #define NEC_TRAILER_SPACE (10 * NEC_UNIT) /* even longer in reality */ +#define NECX_REPEAT_BITS 1 enum nec_state { STATE_INACTIVE, @@ -67,8 +68,11 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) if (!ev.pulse) break; - if (!eq_margin(ev.duration, NEC_HEADER_PULSE, NEC_UNIT / 2) && - !eq_margin(ev.duration, NECX_HEADER_PULSE, NEC_UNIT / 2)) + if (eq_margin(ev.duration, NEC_HEADER_PULSE, NEC_UNIT / 2)) + data->is_nec_x = false; + else if (eq_margin(ev.duration, NECX_HEADER_PULSE, NEC_UNIT / 2)) + data->is_nec_x = true; + else break; data->count = 0; @@ -105,6 +109,14 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) if (ev.pulse) break; + if (geq_margin(ev.duration, NEC_TRAILER_SPACE, NEC_UNIT / 2) && + data->is_nec_x && data->count == NECX_REPEAT_BITS) { + IR_dprintk(1, "Repeat last key\n"); + ir_repeat(input_dev); + data->state = STATE_INACTIVE; + return 0; + } + data->bits <<= 1; if (eq_margin(ev.duration, NEC_BIT_1_SPACE, NEC_UNIT / 2)) data->bits |= 1;