aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-01-17 08:58:50 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-02-06 06:20:07 -0500
commit18bc17448147e93f31cc9b1a83be49f1224657b2 (patch)
tree3e80fccb07b65eb43faefa75d6518f96b48bfdaa
parent00942d1a1bd93ac108c1b92d504c568a37be1833 (diff)
[media] media: rc: change 32bit NEC scancode format
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. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com> Cc: Jarod Wilson <jarod@redhat.com> Cc: linux-media@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/rc/ir-nec-decoder.c5
-rw-r--r--drivers/media/rc/keymaps/rc-tivo.c86
2 files changed, 47 insertions, 44 deletions
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index 9a9009411439..1bab7ea686fc 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -172,7 +172,10 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
172 if (send_32bits) { 172 if (send_32bits) {
173 /* NEC transport, but modified protocol, used by at 173 /* NEC transport, but modified protocol, used by at
174 * least Apple and TiVo remotes */ 174 * least Apple and TiVo remotes */
175 scancode = data->bits; 175 scancode = not_address << 24 |
176 address << 16 |
177 not_command << 8 |
178 command;
176 IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode); 179 IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
177 } else if ((address ^ not_address) != 0xff) { 180 } else if ((address ^ not_address) != 0xff) {
178 /* Extended NEC */ 181 /* Extended NEC */
diff --git a/drivers/media/rc/keymaps/rc-tivo.c b/drivers/media/rc/keymaps/rc-tivo.c
index 454e06295692..5cc1b456e329 100644
--- a/drivers/media/rc/keymaps/rc-tivo.c
+++ b/drivers/media/rc/keymaps/rc-tivo.c
@@ -15,62 +15,62 @@
15 * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle, 15 * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle,
16 * which also ships with a TiVo-branded IR transceiver, supported by the mceusb 16 * which also ships with a TiVo-branded IR transceiver, supported by the mceusb
17 * driver. Note that the remote uses an NEC-ish protocol, but instead of having 17 * driver. Note that the remote uses an NEC-ish protocol, but instead of having
18 * a command/not_command pair, it has a vendor ID of 0xa10c, but some keys, the 18 * a command/not_command pair, it has a vendor ID of 0x3085, but some keys, the
19 * NEC extended checksums do pass, so the table presently has the intended 19 * NEC extended checksums do pass, so the table presently has the intended
20 * values and the checksum-passed versions for those keys. 20 * values and the checksum-passed versions for those keys.
21 */ 21 */
22static struct rc_map_table tivo[] = { 22static struct rc_map_table tivo[] = {
23 { 0xa10c900f, KEY_MEDIA }, /* TiVo Button */ 23 { 0x3085f009, KEY_MEDIA }, /* TiVo Button */
24 { 0xa10c0807, KEY_POWER2 }, /* TV Power */ 24 { 0x3085e010, KEY_POWER2 }, /* TV Power */
25 { 0xa10c8807, KEY_TV }, /* Live TV/Swap */ 25 { 0x3085e011, KEY_TV }, /* Live TV/Swap */
26 { 0xa10c2c03, KEY_VIDEO_NEXT }, /* TV Input */ 26 { 0x3085c034, KEY_VIDEO_NEXT }, /* TV Input */
27 { 0xa10cc807, KEY_INFO }, 27 { 0x3085e013, KEY_INFO },
28 { 0xa10cfa05, KEY_CYCLEWINDOWS }, /* Window */ 28 { 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */
29 { 0x0085305f, KEY_CYCLEWINDOWS }, 29 { 0x0085305f, KEY_CYCLEWINDOWS },
30 { 0xa10c6c03, KEY_EPG }, /* Guide */ 30 { 0x3085c036, KEY_EPG }, /* Guide */
31 31
32 { 0xa10c2807, KEY_UP }, 32 { 0x3085e014, KEY_UP },
33 { 0xa10c6807, KEY_DOWN }, 33 { 0x3085e016, KEY_DOWN },
34 { 0xa10ce807, KEY_LEFT }, 34 { 0x3085e017, KEY_LEFT },
35 { 0xa10ca807, KEY_RIGHT }, 35 { 0x3085e015, KEY_RIGHT },
36 36
37 { 0xa10c1807, KEY_SCROLLDOWN }, /* Red Thumbs Down */ 37 { 0x3085e018, KEY_SCROLLDOWN }, /* Red Thumbs Down */
38 { 0xa10c9807, KEY_SELECT }, 38 { 0x3085e019, KEY_SELECT },
39 { 0xa10c5807, KEY_SCROLLUP }, /* Green Thumbs Up */ 39 { 0x3085e01a, KEY_SCROLLUP }, /* Green Thumbs Up */
40 40
41 { 0xa10c3807, KEY_VOLUMEUP }, 41 { 0x3085e01c, KEY_VOLUMEUP },
42 { 0xa10cb807, KEY_VOLUMEDOWN }, 42 { 0x3085e01d, KEY_VOLUMEDOWN },
43 { 0xa10cd807, KEY_MUTE }, 43 { 0x3085e01b, KEY_MUTE },
44 { 0xa10c040b, KEY_RECORD }, 44 { 0x3085d020, KEY_RECORD },
45 { 0xa10c7807, KEY_CHANNELUP }, 45 { 0x3085e01e, KEY_CHANNELUP },
46 { 0xa10cf807, KEY_CHANNELDOWN }, 46 { 0x3085e01f, KEY_CHANNELDOWN },
47 { 0x0085301f, KEY_CHANNELDOWN }, 47 { 0x0085301f, KEY_CHANNELDOWN },
48 48
49 { 0xa10c840b, KEY_PLAY }, 49 { 0x3085d021, KEY_PLAY },
50 { 0xa10cc40b, KEY_PAUSE }, 50 { 0x3085d023, KEY_PAUSE },
51 { 0xa10ca40b, KEY_SLOW }, 51 { 0x3085d025, KEY_SLOW },
52 { 0xa10c440b, KEY_REWIND }, 52 { 0x3085d022, KEY_REWIND },
53 { 0xa10c240b, KEY_FASTFORWARD }, 53 { 0x3085d024, KEY_FASTFORWARD },
54 { 0xa10c640b, KEY_PREVIOUS }, 54 { 0x3085d026, KEY_PREVIOUS },
55 { 0xa10ce40b, KEY_NEXT }, /* ->| */ 55 { 0x3085d027, KEY_NEXT }, /* ->| */
56 56
57 { 0xa10c220d, KEY_ZOOM }, /* Aspect */ 57 { 0x3085b044, KEY_ZOOM }, /* Aspect */
58 { 0xa10c120d, KEY_STOP }, 58 { 0x3085b048, KEY_STOP },
59 { 0xa10c520d, KEY_DVD }, /* DVD Menu */ 59 { 0x3085b04a, KEY_DVD }, /* DVD Menu */
60 60
61 { 0xa10c140b, KEY_NUMERIC_1 }, 61 { 0x3085d028, KEY_NUMERIC_1 },
62 { 0xa10c940b, KEY_NUMERIC_2 }, 62 { 0x3085d029, KEY_NUMERIC_2 },
63 { 0xa10c540b, KEY_NUMERIC_3 }, 63 { 0x3085d02a, KEY_NUMERIC_3 },
64 { 0xa10cd40b, KEY_NUMERIC_4 }, 64 { 0x3085d02b, KEY_NUMERIC_4 },
65 { 0xa10c340b, KEY_NUMERIC_5 }, 65 { 0x3085d02c, KEY_NUMERIC_5 },
66 { 0xa10cb40b, KEY_NUMERIC_6 }, 66 { 0x3085d02d, KEY_NUMERIC_6 },
67 { 0xa10c740b, KEY_NUMERIC_7 }, 67 { 0x3085d02e, KEY_NUMERIC_7 },
68 { 0xa10cf40b, KEY_NUMERIC_8 }, 68 { 0x3085d02f, KEY_NUMERIC_8 },
69 { 0x0085302f, KEY_NUMERIC_8 }, 69 { 0x0085302f, KEY_NUMERIC_8 },
70 { 0xa10c0c03, KEY_NUMERIC_9 }, 70 { 0x3085c030, KEY_NUMERIC_9 },
71 { 0xa10c8c03, KEY_NUMERIC_0 }, 71 { 0x3085c031, KEY_NUMERIC_0 },
72 { 0xa10ccc03, KEY_ENTER }, 72 { 0x3085c033, KEY_ENTER },
73 { 0xa10c4c03, KEY_CLEAR }, 73 { 0x3085c032, KEY_CLEAR },
74}; 74};
75 75
76static struct rc_map_list tivo_map = { 76static struct rc_map_list tivo_map = {