From: James Hogan <james@albanarts.com>
To: "Antti Seppälä" <a.seppala@gmail.com>
Cc: "Mauro Carvalho Chehab" <m.chehab@samsung.com>,
linux-media@vger.kernel.org, "David Härdeman" <david@hardeman.nu>
Subject: Re: [PATCH v2 6/9] rc: ir-rc5-sz-decoder: Add ir encoding support
Date: Sun, 16 Mar 2014 11:50:58 +0000 [thread overview]
Message-ID: <3611058.9Umk0NSF20@radagast> (raw)
In-Reply-To: <CAKv9HNYgfoAnTHfivgo8tov4nkSZHZ2+qJ=1BJzXUHXDmDSm2w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2781 bytes --]
Hi Antti,
On Sunday 16 March 2014 10:34:31 Antti Seppälä wrote:
> > +/**
> > + * ir_rc5_sz_encode() - Encode a scancode as a stream of raw events
> > + *
> > + * @protocols: allowed protocols
> > + * @scancode: scancode filter describing scancode (helps distinguish
> > between + * protocol subtypes when scancode is ambiguous)
> > + * @events: array of raw ir events to write into
> > + * @max: maximum size of @events
> > + *
> > + * Returns: The number of events written.
> > + * -ENOBUFS if there isn't enough space in the array to fit
> > the + * encoding. In this case all @max events will have been
> > written. + * -EINVAL if the scancode is ambiguous or invalid.
> > + */
> > +static int ir_rc5_sz_encode(u64 protocols,
> > + const struct rc_scancode_filter *scancode,
> > + struct ir_raw_event *events, unsigned int max)
> > +{
> > + int ret;
> > + struct ir_raw_event *e = events;
> > +
> > + /* all important bits of scancode should be set in mask */
> > + if (~scancode->mask & 0x2fff)
>
> Do we want to be so restrictive here? In my opinion it's quite nice to
> be able to encode also the toggle bit if needed. Therefore a check
> against 0x3fff would be a better choice.
>
> I think the ability to encode toggle bit might also be nice to have
> for rc-5(x) also.
>
I don't believe the toggle bit is encoded in the scancode though, so I'm not
sure it makes sense to treat it like that. I'm not an expert on RC-5 like
protocols or the use of the toggle bit though.
> > + return -EINVAL;
> > + /* extra bits in mask should be zero in data */
> > + if (scancode->mask & scancode->data & ~0x2fff)
> > + return -EINVAL;
> > +
> > + /* RC5-SZ scancode is raw enough for Manchester as it is */
> > + ret = ir_raw_gen_manchester(&e, max, &ir_rc5_sz_timings,
> > RC5_SZ_NBITS, + scancode->data &
> > 0x2fff);
>
> I'm not sure that the & 0x2fff is necessary. It has the ill effect of
> eventually writing something else to hardware while still committing
> the filter as unmodified original value. This will result in
> difference between what sysfs states was written when read back and
> what was actually written.
>
> I think checks above are good enough to restrict the values and as
> little modification as possible of the data should be done after that.
I suspect it was the toggle bit I was thinking about, e.g.
echo 0x3fff > wakeup_filter
echo 0x2fff > wakeup_filter_mask
I had assumed shouldn't be able to affect the toggle bit (it's not set in
mask).
Cheers
James
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-03-16 11:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 23:04 [PATCH v2 0/9] rc: Add IR encode based wakeup filtering James Hogan
2014-03-14 23:04 ` [PATCH v2 1/9] rc: ir-raw: Add scancode encoder callback James Hogan
2014-03-14 23:04 ` [PATCH v2 2/9] rc: ir-raw: Add pulse-distance modulation helper James Hogan
2014-03-14 23:04 ` [PATCH v2 3/9] rc: ir-raw: Add Manchester encoder (phase encoder) helper James Hogan
2014-03-14 23:04 ` [PATCH v2 4/9] rc: ir-nec-decoder: Add encode capability James Hogan
2014-03-14 23:04 ` [PATCH v2 5/9] rc: ir-rc5-decoder: " James Hogan
2014-03-14 23:04 ` [PATCH v2 6/9] rc: ir-rc5-sz-decoder: Add ir encoding support James Hogan
2014-03-16 8:34 ` Antti Seppälä
2014-03-16 11:50 ` James Hogan [this message]
2014-03-16 12:14 ` Antti Seppälä
2014-03-16 21:18 ` James Hogan
2014-03-17 16:34 ` Antti Seppälä
2014-03-14 23:04 ` [PATCH v2 7/9] rc: rc-core: Add support for encode_wakeup drivers James Hogan
2014-03-14 23:04 ` [PATCH v2 8/9] rc: rc-loopback: Add loopback of filter scancodes James Hogan
2014-03-14 23:04 ` [PATCH v2 9/9] rc: nuvoton-cir: Add support for writing wakeup samples via sysfs filter callback James Hogan
2014-03-16 8:39 ` Antti Seppälä
2014-03-16 11:52 ` James Hogan
2014-03-16 8:22 ` [PATCH v2 0/9] rc: Add IR encode based wakeup filtering Antti Seppälä
2014-03-16 22:41 ` James Hogan
2014-03-17 17:01 ` Antti Seppälä
2014-03-17 22:34 ` James Hogan
2014-03-25 0:15 ` David Härdeman
2014-07-23 19:39 ` Mauro Carvalho Chehab
2014-07-25 20:46 ` 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=3611058.9Umk0NSF20@radagast \
--to=james@albanarts.com \
--cc=a.seppala@gmail.com \
--cc=david@hardeman.nu \
--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.