From 4be22b6a7f2f2b7eb6f7aab8902068a367cda8ba Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Tue, 22 Mar 2011 17:23:15 -0300 Subject: [media] rc: interim support for 32-bit NEC-ish scancodes The Apple and TiVo remotes I've got use an NEC-ish protocol, but rather than a command/not_command pair, they have what appear to be vendor ID bytes. This change makes the NEC decoder warn if the command/not_command checksum fails, but then passes along a full 32-bit scancode for keymap lookup. This change should make no difference for existing keymaps, since they simply won't have 32-bit scancodes, but allows for a 32-bit keymap. At the moment, that'll have to be uploaded by the user, but I've got Apple and TiVo remote keymaps forthcoming. In the long run (2.6.40, hopefully), we should probably just always use all 32 bits for all NEC keymaps, but this should get us by for 2.6.39. (Note that a few of the TiVo keys actuallly *do* pass the command checksum, so for now, the keymap for this remote will have to be a mix of 24-bit and 32-bit scancodes, but so be it). Signed-off-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ir-nec-decoder.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/media/rc/ir-nec-decoder.c') diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 7b58b4a1729b..63ee722dbd02 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; u8 address, not_address, command, not_command; + bool send_32bits = false; if (!(dev->raw->enabled_protocols & RC_TYPE_NEC)) return 0; @@ -164,10 +165,15 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) if ((command ^ not_command) != 0xff) { IR_dprintk(1, "NEC checksum error: received 0x%08x\n", data->bits); - break; + send_32bits = true; } - if ((address ^ not_address) != 0xff) { + if (send_32bits) { + /* NEC transport, but modified protocol, used by at + * least Apple and TiVo remotes */ + scancode = data->bits; + IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode); + } else if ((address ^ not_address) != 0xff) { /* Extended NEC */ scancode = address << 16 | not_address << 8 | -- cgit v1.2.3