From: Maxim Levitsky <maximlevitsky@gmail.com>
To: lirc-list@lists.sourceforge.net
Cc: Jarod Wilson <jarod@wilsonet.com>,
linux-input@vger.kernel.org, linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 2/9] IR: minor fixes:
Date: Wed, 28 Jul 2010 18:14:04 +0300 [thread overview]
Message-ID: <1280330051-27732-3-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1280330051-27732-1-git-send-email-maximlevitsky@gmail.com>
* lirc: Don't propagate reset event to userspace
* lirc: Remove strange logic from lirc that would make first sample always be pulse
* Make TO_US macro actualy print what it should.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 3 +--
drivers/media/IR/ir-lirc-codec.c | 14 ++++++++------
drivers/media/IR/ir-raw-event.c | 3 +++
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index babd520..8ce80e4 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -76,7 +76,6 @@ struct ir_raw_event_ctrl {
struct lirc_codec {
struct ir_input_dev *ir_dev;
struct lirc_driver *drv;
- int lircdata;
} lirc;
};
@@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)
ev->duration -= duration;
}
-#define TO_US(duration) (((duration) + 500) / 1000)
+#define TO_US(duration) ((duration) / 1000)
#define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space")
#define IS_RESET(ev) (ev.duration == 0)
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
index 3ba482d..8ca01fd 100644
--- a/drivers/media/IR/ir-lirc-codec.c
+++ b/drivers/media/IR/ir-lirc-codec.c
@@ -32,6 +32,7 @@
static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
{
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
+ int sample;
if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC))
return 0;
@@ -39,18 +40,21 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf)
return -EINVAL;
+ if (IS_RESET(ev))
+ return 0;
+
IR_dprintk(2, "LIRC data transfer started (%uus %s)\n",
TO_US(ev.duration), TO_STR(ev.pulse));
- ir_dev->raw->lirc.lircdata += ev.duration / 1000;
+
+ sample = ev.duration / 1000;
if (ev.pulse)
- ir_dev->raw->lirc.lircdata |= PULSE_BIT;
+ sample |= PULSE_BIT;
lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf,
- (unsigned char *) &ir_dev->raw->lirc.lircdata);
+ (unsigned char *) &sample);
wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll);
- ir_dev->raw->lirc.lircdata = 0;
return 0;
}
@@ -224,8 +228,6 @@ static int ir_lirc_register(struct input_dev *input_dev)
ir_dev->raw->lirc.drv = drv;
ir_dev->raw->lirc.ir_dev = ir_dev;
- ir_dev->raw->lirc.lircdata = PULSE_MASK;
-
return 0;
lirc_register_failed:
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index 6f192ef..ab9c4da 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -66,6 +66,9 @@ int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev)
if (!ir->raw)
return -EINVAL;
+ IR_dprintk(2, "sample: (05%dus %s)\n", TO_US(ev->duration),
+ TO_STR(ev->pulse));
+
if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev))
return -ENOMEM;
--
1.7.0.4
next prev parent reply other threads:[~2010-07-28 15:14 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
2010-07-28 17:36 ` Randy Dunlap
2010-07-28 20:31 ` Maxim Levitsky
2010-07-28 15:14 ` Maxim Levitsky [this message]
2010-07-28 16:01 ` [PATCH 2/9] IR: minor fixes: Mauro Carvalho Chehab
2010-07-28 16:38 ` Maxim Levitsky
2010-07-28 17:59 ` Mauro Carvalho Chehab
2010-07-28 17:23 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
2010-07-28 16:03 ` Mauro Carvalho Chehab
2010-07-28 16:32 ` Maxim Levitsky
2010-07-28 17:43 ` Jarod Wilson
2010-07-28 18:37 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
2010-07-28 16:09 ` Mauro Carvalho Chehab
2010-07-28 16:29 ` Maxim Levitsky
2010-07-28 17:46 ` Jarod Wilson
2010-07-28 20:57 ` Jarod Wilson
2010-07-28 21:16 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
2010-07-28 17:00 ` Mauro Carvalho Chehab
2010-07-28 20:47 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Maxim Levitsky
2010-07-28 17:58 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found Maxim Levitsky
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
2010-07-28 17:10 ` Mauro Carvalho Chehab
2010-07-28 17:13 ` Maxim Levitsky
2010-07-28 17:17 ` Jarod Wilson
2010-07-28 18:13 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 9/9] STAGING: remove ENE driver Maxim Levitsky
-- strict thread matches above, loose matches on Subject: below --
2010-07-28 23:40 (unknown), Maxim Levitsky
2010-07-28 23:40 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280330051-27732-3-git-send-email-maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=jarod@wilsonet.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lirc-list@lists.sourceforge.net \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).