Hi James.

On 10 February 2014 12:30, James Hogan <james.ho...@imgtec.com> wrote:
> Hi Antti,
>
> On 08/02/14 12:07, Antti Seppälä wrote:
>> The encoding in rc5-sz first inserts a pulse and then simply utilizes the
>> generic Manchester encoder available in rc-core.
>>
>> Signed-off-by: Antti Seppälä <a.sepp...@gmail.com>
>> ---
>>  drivers/media/rc/ir-rc5-sz-decoder.c | 35 
>> +++++++++++++++++++++++++++++++++++
>>  1 file changed, 35 insertions(+)
>>
>> diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c 
>> b/drivers/media/rc/ir-rc5-sz-decoder.c
>> index 984e5b9..0d5e552 100644
>> --- a/drivers/media/rc/ir-rc5-sz-decoder.c
>> +++ b/drivers/media/rc/ir-rc5-sz-decoder.c
>> @@ -127,9 +127,44 @@ out:
>>       return -EINVAL;
>>  }
>>
>> +static struct ir_raw_timings_manchester ir_rc5_sz_timings = {
>> +     .pulse_space_start      = 0,
>> +     .clock                  = RC5_UNIT,
>> +};
>> +
>> +/*
>> + * 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
>> + *
>> + * This function returns -EINVAL if the scancode filter is invalid or 
>> matches
>> + * multiple scancodes. Otherwise the number of ir_raw_events generated is
>> + * returned.
>> + */
>> +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;
>
> Probably worth checking scancode->mask == 0xfff too?
>

I guess so. However if I'm not mistaken this makes all wakeup_filter
writes fail in user space if wakeup_filter_mask is not set. Is that
intended?

>> +
>> +     /* 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);
>> +     if (ret < 0)
>> +             return ret;
>
> I suspect it needs some more space at the end too, to be sure that no
> more bits afterwards are accepted.
>

I'm sorry but I'm not sure I completely understood what you meant
here. For RC-5-SZ the entire scancode gets encoded and nothing more.
Do you mean that the encoder should append some ir silence to the end
result to make sure the ir sample has ended?

-Antti
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to