diff options
author | Sean Young <sean@mess.org> | 2018-01-05 16:38:43 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-01-23 15:32:38 +0300 |
commit | 80008ddbed83b40d5b745a9bae721b736dd7314c (patch) | |
tree | fd6bb283662c629bf0af4a373ef6681660824c4b /drivers/media/rc/ir-rc5-decoder.c | |
parent | ddf9c1bb3d2ae24a216237d8195bb31ff632d8e5 (diff) | |
download | linux-80008ddbed83b40d5b745a9bae721b736dd7314c.tar.xz |
media: rc: do not remove first bit if leader pulse is present
The rc5 protocol does not have a leading pulse or space, but we encode
the first bit using a single leading pulse. For other protocols, the
leading pulse or space does not represent any bit. So, don't remove the
first bit if a leading pulse is present.
Cc: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/ir-rc5-decoder.c')
-rw-r--r-- | drivers/media/rc/ir-rc5-decoder.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index a1d6c955ffc8..11a28f8772da 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c @@ -225,9 +225,9 @@ static int ir_rc5_encode(enum rc_proto protocol, u32 scancode, /* encode data */ data = !commandx << 12 | system << 6 | command; - /* Modulate the data */ + /* First bit is encoded by leader_pulse */ ret = ir_raw_gen_manchester(&e, max, &ir_rc5_timings, - RC5_NBITS, data); + RC5_NBITS - 1, data); if (ret < 0) return ret; } else if (protocol == RC_PROTO_RC5X_20) { @@ -240,10 +240,11 @@ static int ir_rc5_encode(enum rc_proto protocol, u32 scancode, /* encode data */ data = commandx << 18 | system << 12 | command << 6 | xdata; - /* Modulate the data */ + /* First bit is encoded by leader_pulse */ pre_space_data = data >> (RC5X_NBITS - CHECK_RC5X_NBITS); ret = ir_raw_gen_manchester(&e, max, &ir_rc5x_timings[0], - CHECK_RC5X_NBITS, pre_space_data); + CHECK_RC5X_NBITS - 1, + pre_space_data); if (ret < 0) return ret; ret = ir_raw_gen_manchester(&e, max - (e - events), @@ -254,8 +255,10 @@ static int ir_rc5_encode(enum rc_proto protocol, u32 scancode, return ret; } else if (protocol == RC_PROTO_RC5_SZ) { /* RC5-SZ scancode is raw enough for Manchester as it is */ + /* First bit is encoded by leader_pulse */ ret = ir_raw_gen_manchester(&e, max, &ir_rc5_sz_timings, - RC5_SZ_NBITS, scancode & 0x2fff); + RC5_SZ_NBITS - 1, + scancode & 0x2fff); if (ret < 0) return ret; } else { |