summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ir-nec-decoder.c
diff options
context:
space:
mode:
authorSean Young2016-09-21 11:54:19 +0200
committerMauro Carvalho Chehab2016-09-22 16:46:49 +0200
commit2ceeca0499d745213306ecd785af17adb2321b6a (patch)
tree7bd01f282f8fd67bdbd4a3828e1af6db34744a65 /drivers/media/rc/ir-nec-decoder.c
parent[media] rc: Hauppauge z8f0811 can decode RC6 (diff)
downloadkernel-qcow2-linux-2ceeca0499d745213306ecd785af17adb2321b6a.tar.gz
kernel-qcow2-linux-2ceeca0499d745213306ecd785af17adb2321b6a.tar.xz
kernel-qcow2-linux-2ceeca0499d745213306ecd785af17adb2321b6a.zip
[media] rc: split nec protocol into its three variants
Currently we do not know what variant (bit length) of the nec protocol is used, other than from guessing from the length of the scancode. Now nec will be handled the same way as the sony protocol or the rc6 protocol; one variant per bit length. In the future we might want to expose the rc protocol type to userspace and we don't want to be introducing this world of pain into userspace too. 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-nec-decoder.c')
-rw-r--r--drivers/media/rc/ir-nec-decoder.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index bea0d1eedee0..2a9d155548ab 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -49,6 +49,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
{
struct nec_dec *data = &dev->raw->nec;
u32 scancode;
+ enum rc_type rc_type;
u8 address, not_address, command, not_command;
bool send_32bits = false;
@@ -171,22 +172,25 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
* least Apple and TiVo remotes */
scancode = data->bits;
IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
+ rc_type = RC_TYPE_NEC32;
} else if ((address ^ not_address) != 0xff) {
/* Extended NEC */
scancode = address << 16 |
not_address << 8 |
command;
IR_dprintk(1, "NEC (Ext) scancode 0x%06x\n", scancode);
+ rc_type = RC_TYPE_NECX;
} else {
/* Normal NEC */
scancode = address << 8 | command;
IR_dprintk(1, "NEC scancode 0x%04x\n", scancode);
+ rc_type = RC_TYPE_NEC;
}
if (data->is_nec_x)
data->necx_repeat = true;
- rc_keydown(dev, RC_TYPE_NEC, scancode, 0);
+ rc_keydown(dev, rc_type, scancode, 0);
data->state = STATE_INACTIVE;
return 0;
}
@@ -198,7 +202,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
}
static struct ir_raw_handler nec_handler = {
- .protocols = RC_BIT_NEC,
+ .protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32,
.decode = ir_nec_decode,
};