From patchwork Wed Nov 17 15:25:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 332941 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAHFQ7kY032117 for ; Wed, 17 Nov 2010 15:26:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758221Ab0KQPZr (ORCPT ); Wed, 17 Nov 2010 10:25:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52041 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758210Ab0KQPZq (ORCPT ); Wed, 17 Nov 2010 10:25:46 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAHFPk6O019731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Nov 2010 10:25:46 -0500 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAHFPjbs010104 for ; Wed, 17 Nov 2010 10:25:46 -0500 Received: by xavier.bos.redhat.com (Postfix, from userid 500) id BFE50817CB; Wed, 17 Nov 2010 10:25:45 -0500 (EST) Date: Wed, 17 Nov 2010 10:25:45 -0500 From: Jarod Wilson To: linux-media@vger.kernel.org Subject: [PATCH] streamzap: merge timeout space with trailing space Message-ID: <20101117152545.GA24814@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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 (demeter1.kernel.org [140.211.167.41]); Wed, 17 Nov 2010 15:26:07 +0000 (UTC) diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 7781910..19652d4 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -137,7 +137,9 @@ static struct usb_driver streamzap_driver = { static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) { - ir_raw_event_store(sz->rdev, &rawir); + dev_dbg(sz->dev, "Storing %s with duration %u us\n", + (rawir.pulse ? "pulse" : "space"), rawir.duration); + ir_raw_event_store_with_filter(sz->rdev, &rawir); } static void sz_push_full_pulse(struct streamzap_ir *sz, @@ -164,7 +166,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, rawir.duration *= 1000; rawir.duration &= IR_MAX_DURATION; } - dev_dbg(sz->dev, "ls %u\n", rawir.duration); sz_push(sz, rawir); sz->idle = false; @@ -177,7 +178,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, sz->sum += rawir.duration; rawir.duration *= 1000; rawir.duration &= IR_MAX_DURATION; - dev_dbg(sz->dev, "p %u\n", rawir.duration); sz_push(sz, rawir); } @@ -197,7 +197,6 @@ static void sz_push_full_space(struct streamzap_ir *sz, rawir.duration += SZ_RESOLUTION / 2; sz->sum += rawir.duration; rawir.duration *= 1000; - dev_dbg(sz->dev, "s %u\n", rawir.duration); sz_push(sz, rawir); } @@ -218,8 +217,6 @@ static void streamzap_callback(struct urb *urb) struct streamzap_ir *sz; unsigned int i; int len; - static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & - IR_MAX_DURATION) | 0x03000000); if (!urb) return; @@ -243,7 +240,7 @@ static void streamzap_callback(struct urb *urb) dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); for (i = 0; i < len; i++) { - dev_dbg(sz->dev, "sz idx %d: %x\n", + dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", i, (unsigned char)sz->buf_in[i]); switch (sz->decoder_state) { case PulseSpace: @@ -270,7 +267,7 @@ static void streamzap_callback(struct urb *urb) DEFINE_IR_RAW_EVENT(rawir); rawir.pulse = false; - rawir.duration = timeout; + rawir.duration = sz->rdev->timeout; sz->idle = true; if (sz->timeout_enabled) sz_push(sz, rawir); @@ -430,6 +427,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf, sz->decoder_state = PulseSpace; /* FIXME: don't yet have a way to set this */ sz->timeout_enabled = true; + sz->rdev->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & + IR_MAX_DURATION) | 0x03000000); #if 0 /* not yet supported, depends on patches from maxim */ /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */