media: rc: XBox DVD Remote uses 12 bits scancodes
authorSean Young <sean@mess.org>
Thu, 18 Oct 2018 11:03:33 +0000 (07:03 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 22 Nov 2018 18:28:24 +0000 (13:28 -0500)
The xbox dvd remote sends 24 bits, the first 12 bits are repeated
and inverted so only 12 bits are used. The upper 4 bits can be read
at offset 3. Ensure we pass this to rc-core and update the keymap
accordingly.

Tested-by: Benjamin Valentin <benpicco@googlemail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/rc/keymaps/rc-xbox-dvd.c
drivers/media/rc/xbox_remote.c

index 61da6706715c7c58b2f142b7f424dd016ca0e063..af387244636b1354b9f6b0c2f6c9a18710ba3676 100644 (file)
@@ -7,35 +7,35 @@
 
 /* based on lircd.conf.xbox */
 static struct rc_map_table xbox_dvd[] = {
-       {0x0b, KEY_OK},
-       {0xa6, KEY_UP},
-       {0xa7, KEY_DOWN},
-       {0xa8, KEY_RIGHT},
-       {0xa9, KEY_LEFT},
-       {0xc3, KEY_INFO},
-
-       {0xc6, KEY_9},
-       {0xc7, KEY_8},
-       {0xc8, KEY_7},
-       {0xc9, KEY_6},
-       {0xca, KEY_5},
-       {0xcb, KEY_4},
-       {0xcc, KEY_3},
-       {0xcd, KEY_2},
-       {0xce, KEY_1},
-       {0xcf, KEY_0},
-
-       {0xd5, KEY_ANGLE},
-       {0xd8, KEY_BACK},
-       {0xdd, KEY_PREVIOUSSONG},
-       {0xdf, KEY_NEXTSONG},
-       {0xe0, KEY_STOP},
-       {0xe2, KEY_REWIND},
-       {0xe3, KEY_FASTFORWARD},
-       {0xe5, KEY_TITLE},
-       {0xe6, KEY_PAUSE},
-       {0xea, KEY_PLAY},
-       {0xf7, KEY_MENU},
+       {0xa0b, KEY_OK},
+       {0xaa6, KEY_UP},
+       {0xaa7, KEY_DOWN},
+       {0xaa8, KEY_RIGHT},
+       {0xaa9, KEY_LEFT},
+       {0xac3, KEY_INFO},
+
+       {0xac6, KEY_9},
+       {0xac7, KEY_8},
+       {0xac8, KEY_7},
+       {0xac9, KEY_6},
+       {0xaca, KEY_5},
+       {0xacb, KEY_4},
+       {0xacc, KEY_3},
+       {0xacd, KEY_2},
+       {0xace, KEY_1},
+       {0xacf, KEY_0},
+
+       {0xad5, KEY_ANGLE},
+       {0xad8, KEY_BACK},
+       {0xadd, KEY_PREVIOUSSONG},
+       {0xadf, KEY_NEXTSONG},
+       {0xae0, KEY_STOP},
+       {0xae2, KEY_REWIND},
+       {0xae3, KEY_FASTFORWARD},
+       {0xae5, KEY_TITLE},
+       {0xae6, KEY_PAUSE},
+       {0xaea, KEY_PLAY},
+       {0xaf7, KEY_MENU},
 };
 
 static struct rc_map_list xbox_dvd_map = {
index 141ef9253018aaaefd766acfaf3946bc26c4ee0a..f959cbb947447d4d081bd2e3914fc422a292d2c4 100644 (file)
@@ -55,7 +55,7 @@ struct xbox_remote {
        struct usb_interface *interface;
 
        struct urb *irq_urb;
-       unsigned char inbuf[DATA_BUFSIZE];
+       unsigned char inbuf[DATA_BUFSIZE] __aligned(sizeof(u16));
 
        char rc_name[NAME_BUFSIZE];
        char rc_phys[NAME_BUFSIZE];
@@ -95,7 +95,7 @@ static void xbox_remote_input_report(struct urb *urb)
         * data[0] = 0x00
         * data[1] = length - always 0x06
         * data[2] = the key code
-        * data[3] = high part of key code? - always 0x0a
+        * data[3] = high part of key code
         * data[4] = last_press_ms (low)
         * data[5] = last_press_ms (high)
         */
@@ -107,7 +107,8 @@ static void xbox_remote_input_report(struct urb *urb)
                return;
        }
 
-       rc_keydown(xbox_remote->rdev, RC_PROTO_UNKNOWN, data[2], 0);
+       rc_keydown(xbox_remote->rdev, RC_PROTO_UNKNOWN,
+                  le16_to_cpup((__le16 *)(data + 2)), 0);
 }
 
 /*