From: "David Härdeman" <david@hardeman.nu>
To: James Hogan <james.hogan@imgtec.com>
Cc: "Mauro Carvalho Chehab" <m.chehab@samsung.com>,
linux-media@vger.kernel.org,
"Antti Seppälä" <a.seppala@gmail.com>
Subject: Re: [PATCH 1/5] rc-main: add generic scancode filtering
Date: Tue, 25 Mar 2014 00:51:46 +0100 [thread overview]
Message-ID: <20140324235146.GA25627@hardeman.nu> (raw)
In-Reply-To: <1393629426-31341-2-git-send-email-james.hogan@imgtec.com>
On Fri, Feb 28, 2014 at 11:17:02PM +0000, James Hogan wrote:
>Add generic scancode filtering of RC input events, and fall back to
>permitting any RC_FILTER_NORMAL scancode filter to be set if no s_filter
>callback exists. This allows raw IR decoder events to be filtered, and
>potentially allows hardware decoders to set looser filters and rely on
>generic code to filter out the corner cases.
Hi James,
What's the purpose of providing the sw scancode filtering in the case where
there's no hardware filtering support at all?
(sorry that I'm replying so late...busy schedule :))
>
>Signed-off-by: James Hogan <james.hogan@imgtec.com>
>Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
>Cc: Antti Seppälä <a.seppala@gmail.com>
>Cc: linux-media@vger.kernel.org
>---
> drivers/media/rc/rc-main.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
>index 6448128..0a4f680 100644
>--- a/drivers/media/rc/rc-main.c
>+++ b/drivers/media/rc/rc-main.c
>@@ -633,6 +633,7 @@ EXPORT_SYMBOL_GPL(rc_repeat);
> static void ir_do_keydown(struct rc_dev *dev, int scancode,
> u32 keycode, u8 toggle)
> {
>+ struct rc_scancode_filter *filter;
> bool new_event = !dev->keypressed ||
> dev->last_scancode != scancode ||
> dev->last_toggle != toggle;
>@@ -640,6 +641,11 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode,
> if (new_event && dev->keypressed)
> ir_do_keyup(dev, false);
>
>+ /* Generic scancode filtering */
>+ filter = &dev->scancode_filters[RC_FILTER_NORMAL];
>+ if (filter->mask && ((scancode ^ filter->data) & filter->mask))
>+ return;
>+
> input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode);
>
> if (new_event && keycode != KEY_RESERVED) {
>@@ -1019,9 +1025,7 @@ static ssize_t show_filter(struct device *device,
> return -EINVAL;
>
> mutex_lock(&dev->lock);
>- if (!dev->s_filter)
>- val = 0;
>- else if (fattr->mask)
>+ if (fattr->mask)
> val = dev->scancode_filters[fattr->type].mask;
> else
> val = dev->scancode_filters[fattr->type].data;
>@@ -1069,7 +1073,7 @@ static ssize_t store_filter(struct device *device,
> return ret;
>
> /* Scancode filter not supported (but still accept 0) */
>- if (!dev->s_filter)
>+ if (!dev->s_filter && fattr->type != RC_FILTER_NORMAL)
> return val ? -EINVAL : count;
>
> mutex_lock(&dev->lock);
>@@ -1081,9 +1085,11 @@ static ssize_t store_filter(struct device *device,
> local_filter.mask = val;
> else
> local_filter.data = val;
>- ret = dev->s_filter(dev, fattr->type, &local_filter);
>- if (ret < 0)
>- goto unlock;
>+ if (dev->s_filter) {
>+ ret = dev->s_filter(dev, fattr->type, &local_filter);
>+ if (ret < 0)
>+ goto unlock;
>+ }
>
> /* Success, commit the new filter */
> *filter = local_filter;
>--
>1.8.3.2
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-media" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
David Härdeman
next prev parent reply other threads:[~2014-03-24 23:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 23:17 [PATCH 0/5] rc: scancode filtering improvements James Hogan
2014-02-28 23:17 ` [PATCH 1/5] rc-main: add generic scancode filtering James Hogan
2014-03-24 23:51 ` David Härdeman [this message]
2014-03-25 9:12 ` James Hogan
2014-03-25 23:21 ` David Härdeman
2014-03-26 7:08 ` Antti Seppälä
2014-03-26 13:44 ` David Härdeman
2014-03-26 15:54 ` James Hogan
2014-02-28 23:17 ` [PATCH 2/5] rc: abstract access to allowed/enabled protocols James Hogan
2014-02-28 23:17 ` [PATCH 3/5] rc: add allowed/enabled wakeup protocol masks James Hogan
2014-02-28 23:17 ` [PATCH 4/5] rc: add wakeup_protocols sysfs file James Hogan
2014-02-28 23:17 ` [PATCH 5/5] rc-main: automatically refresh filter on protocol change James Hogan
2014-03-05 18:12 ` [PATCH 0/5] rc: scancode filtering improvements Antti Seppälä
2014-03-05 23:17 ` James Hogan
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=20140324235146.GA25627@hardeman.nu \
--to=david@hardeman.nu \
--cc=a.seppala@gmail.com \
--cc=james.hogan@imgtec.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.