Skip to contentSkip to conversation

media: rc: change 32bit NEC scancode format

git:media_tree/master Mauro Carvalho Chehab 1 participant 1 message Feb 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is an automatic generated email to let you know that the following patch were queued at the
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] media: rc: change 32bit NEC scancode format
Author:  James Hogan <[email protected]>
Date:    Fri Jan 17 10:58:50 2014 -0300

Change 32bit NEC scancode format (used by Apple and TiVo remotes) to encode the data with the correct bit order. Previously the raw bits were used without being bit reversed, now each 16bit half is bit reversed compared to before.

So for the raw NEC data:
(LSB/First) 0xAAaaCCcc (MSB/Last)
(where traditionally AA=address, aa=~address, CC=command, cc=~command)

We now generate the scancodes:
(MSB) 0x0000AACC (LSB) (normal NEC)
(MSB) 0x00AAaaCC (LSB) (extended NEC, address check wrong) (MSB) 0xaaAAccCC (LSB) (32-bit NEC, command check wrong)

Note that the address byte order in 32-bit NEC scancodes is different to that of the extended NEC scancodes. I chose this way as it maintains the order of the bits in the address/command fields, and CC is clearly intended to be the LSB of the command if the TiVo codes are anything to go by so it makes sense for AA to also be the LSB.

The TiVo keymap is updated accordingly.

 drivers/media/rc/ir-nec-decoder.c  |    5 ++-
 drivers/media/rc/keymaps/rc-tivo.c |   86 ++++++++++++++++++------------------
 2 files changed, 47 insertions(+), 44 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=18bc17448147e93f31cc9b1a83be49f1224657b2

drivers/media/rc/ir-nec-decoder.c +4 -1
index 9a90094..1bab7ea 100644
@@ -172,7 +172,10 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
 		if (send_32bits) {
 			/* NEC transport, but modified protocol, used by at
 			 * least Apple and TiVo remotes */
-			scancode = data->bits;
+			scancode = not_address << 24 |
+				   address     << 16 |
+				   not_command <<  8 |
+				   command;
 			IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
 		} else if ((address ^ not_address) != 0xff) {
 			/* Extended NEC */
drivers/media/rc/keymaps/rc-tivo.c +43 -43

105 lines not on this page · raw message