[media] cxusb: dvico remotes are nec
authorSean Young <sean@mess.org>
Sat, 4 Feb 2017 19:00:36 +0000 (17:00 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 24 Mar 2017 10:41:17 +0000 (07:41 -0300)
Adjust the keymap to use the correct nec scancodes, and adjust the
rc driver to output the correct nec scancodes.

Now the keymap can be used with any nec receiver, and the rc device
should work with any nec keymap.

Tested-by: Vincent McIntyre <vincent.mcintyre@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/keymaps/rc-dvico-mce.c
drivers/media/rc/keymaps/rc-dvico-portable.c
drivers/media/usb/dvb-usb/cxusb.c

index e5f098c50235d50696c3858d0bc2ea707b7afa6d..d1e861f4d0953d7c5355c34c99d2e5011556a0fc 100644 (file)
 #include <linux/module.h>
 
 static struct rc_map_table rc_map_dvico_mce_table[] = {
-       { 0xfe02, KEY_TV },
-       { 0xfe0e, KEY_MP3 },
-       { 0xfe1a, KEY_DVD },
-       { 0xfe1e, KEY_FAVORITES },
-       { 0xfe16, KEY_SETUP },
-       { 0xfe46, KEY_POWER2 },
-       { 0xfe0a, KEY_EPG },
-       { 0xfe49, KEY_BACK },
-       { 0xfe4d, KEY_MENU },
-       { 0xfe51, KEY_UP },
-       { 0xfe5b, KEY_LEFT },
-       { 0xfe5f, KEY_RIGHT },
-       { 0xfe53, KEY_DOWN },
-       { 0xfe5e, KEY_OK },
-       { 0xfe59, KEY_INFO },
-       { 0xfe55, KEY_TAB },
-       { 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
-       { 0xfe12, KEY_NEXTSONG },       /* Skip */
-       { 0xfe42, KEY_ENTER      },     /* Windows/Start */
-       { 0xfe15, KEY_VOLUMEUP },
-       { 0xfe05, KEY_VOLUMEDOWN },
-       { 0xfe11, KEY_CHANNELUP },
-       { 0xfe09, KEY_CHANNELDOWN },
-       { 0xfe52, KEY_CAMERA },
-       { 0xfe5a, KEY_TUNER },  /* Live */
-       { 0xfe19, KEY_OPEN },
-       { 0xfe0b, KEY_1 },
-       { 0xfe17, KEY_2 },
-       { 0xfe1b, KEY_3 },
-       { 0xfe07, KEY_4 },
-       { 0xfe50, KEY_5 },
-       { 0xfe54, KEY_6 },
-       { 0xfe48, KEY_7 },
-       { 0xfe4c, KEY_8 },
-       { 0xfe58, KEY_9 },
-       { 0xfe13, KEY_ANGLE },  /* Aspect */
-       { 0xfe03, KEY_0 },
-       { 0xfe1f, KEY_ZOOM },
-       { 0xfe43, KEY_REWIND },
-       { 0xfe47, KEY_PLAYPAUSE },
-       { 0xfe4f, KEY_FASTFORWARD },
-       { 0xfe57, KEY_MUTE },
-       { 0xfe0d, KEY_STOP },
-       { 0xfe01, KEY_RECORD },
-       { 0xfe4e, KEY_POWER },
+       { 0x0102, KEY_TV },
+       { 0x010e, KEY_MP3 },
+       { 0x011a, KEY_DVD },
+       { 0x011e, KEY_FAVORITES },
+       { 0x0116, KEY_SETUP },
+       { 0x0146, KEY_POWER2 },
+       { 0x010a, KEY_EPG },
+       { 0x0149, KEY_BACK },
+       { 0x014d, KEY_MENU },
+       { 0x0151, KEY_UP },
+       { 0x015b, KEY_LEFT },
+       { 0x015f, KEY_RIGHT },
+       { 0x0153, KEY_DOWN },
+       { 0x015e, KEY_OK },
+       { 0x0159, KEY_INFO },
+       { 0x0155, KEY_TAB },
+       { 0x010f, KEY_PREVIOUSSONG },/* Replay */
+       { 0x0112, KEY_NEXTSONG },       /* Skip */
+       { 0x0142, KEY_ENTER      },     /* Windows/Start */
+       { 0x0115, KEY_VOLUMEUP },
+       { 0x0105, KEY_VOLUMEDOWN },
+       { 0x0111, KEY_CHANNELUP },
+       { 0x0109, KEY_CHANNELDOWN },
+       { 0x0152, KEY_CAMERA },
+       { 0x015a, KEY_TUNER },  /* Live */
+       { 0x0119, KEY_OPEN },
+       { 0x010b, KEY_1 },
+       { 0x0117, KEY_2 },
+       { 0x011b, KEY_3 },
+       { 0x0107, KEY_4 },
+       { 0x0150, KEY_5 },
+       { 0x0154, KEY_6 },
+       { 0x0148, KEY_7 },
+       { 0x014c, KEY_8 },
+       { 0x0158, KEY_9 },
+       { 0x0113, KEY_ANGLE },  /* Aspect */
+       { 0x0103, KEY_0 },
+       { 0x011f, KEY_ZOOM },
+       { 0x0143, KEY_REWIND },
+       { 0x0147, KEY_PLAYPAUSE },
+       { 0x014f, KEY_FASTFORWARD },
+       { 0x0157, KEY_MUTE },
+       { 0x010d, KEY_STOP },
+       { 0x0101, KEY_RECORD },
+       { 0x014e, KEY_POWER },
 };
 
 static struct rc_map_list dvico_mce_map = {
        .map = {
                .scan    = rc_map_dvico_mce_table,
                .size    = ARRAY_SIZE(rc_map_dvico_mce_table),
-               .rc_type = RC_TYPE_UNKNOWN,     /* Legacy IR type */
+               .rc_type = RC_TYPE_NEC,
                .name    = RC_MAP_DVICO_MCE,
        }
 };
index 94ceeee94b3f83f30517eb619fd29ec32437d41d..ac4cb515cbf14b8e98346fd2ff21f7eda002424e 100644 (file)
 #include <linux/module.h>
 
 static struct rc_map_table rc_map_dvico_portable_table[] = {
-       { 0xfc02, KEY_SETUP },       /* Profile */
-       { 0xfc43, KEY_POWER2 },
-       { 0xfc06, KEY_EPG },
-       { 0xfc5a, KEY_BACK },
-       { 0xfc05, KEY_MENU },
-       { 0xfc47, KEY_INFO },
-       { 0xfc01, KEY_TAB },
-       { 0xfc42, KEY_PREVIOUSSONG },/* Replay */
-       { 0xfc49, KEY_VOLUMEUP },
-       { 0xfc09, KEY_VOLUMEDOWN },
-       { 0xfc54, KEY_CHANNELUP },
-       { 0xfc0b, KEY_CHANNELDOWN },
-       { 0xfc16, KEY_CAMERA },
-       { 0xfc40, KEY_TUNER },  /* ATV/DTV */
-       { 0xfc45, KEY_OPEN },
-       { 0xfc19, KEY_1 },
-       { 0xfc18, KEY_2 },
-       { 0xfc1b, KEY_3 },
-       { 0xfc1a, KEY_4 },
-       { 0xfc58, KEY_5 },
-       { 0xfc59, KEY_6 },
-       { 0xfc15, KEY_7 },
-       { 0xfc14, KEY_8 },
-       { 0xfc17, KEY_9 },
-       { 0xfc44, KEY_ANGLE },  /* Aspect */
-       { 0xfc55, KEY_0 },
-       { 0xfc07, KEY_ZOOM },
-       { 0xfc0a, KEY_REWIND },
-       { 0xfc08, KEY_PLAYPAUSE },
-       { 0xfc4b, KEY_FASTFORWARD },
-       { 0xfc5b, KEY_MUTE },
-       { 0xfc04, KEY_STOP },
-       { 0xfc56, KEY_RECORD },
-       { 0xfc57, KEY_POWER },
-       { 0xfc41, KEY_UNKNOWN },    /* INPUT */
-       { 0xfc00, KEY_UNKNOWN },    /* HD */
+       { 0x0302, KEY_SETUP },       /* Profile */
+       { 0x0343, KEY_POWER2 },
+       { 0x0306, KEY_EPG },
+       { 0x035a, KEY_BACK },
+       { 0x0305, KEY_MENU },
+       { 0x0347, KEY_INFO },
+       { 0x0301, KEY_TAB },
+       { 0x0342, KEY_PREVIOUSSONG },/* Replay */
+       { 0x0349, KEY_VOLUMEUP },
+       { 0x0309, KEY_VOLUMEDOWN },
+       { 0x0354, KEY_CHANNELUP },
+       { 0x030b, KEY_CHANNELDOWN },
+       { 0x0316, KEY_CAMERA },
+       { 0x0340, KEY_TUNER },  /* ATV/DTV */
+       { 0x0345, KEY_OPEN },
+       { 0x0319, KEY_1 },
+       { 0x0318, KEY_2 },
+       { 0x031b, KEY_3 },
+       { 0x031a, KEY_4 },
+       { 0x0358, KEY_5 },
+       { 0x0359, KEY_6 },
+       { 0x0315, KEY_7 },
+       { 0x0314, KEY_8 },
+       { 0x0317, KEY_9 },
+       { 0x0344, KEY_ANGLE },  /* Aspect */
+       { 0x0355, KEY_0 },
+       { 0x0307, KEY_ZOOM },
+       { 0x030a, KEY_REWIND },
+       { 0x0308, KEY_PLAYPAUSE },
+       { 0x034b, KEY_FASTFORWARD },
+       { 0x035b, KEY_MUTE },
+       { 0x0304, KEY_STOP },
+       { 0x0356, KEY_RECORD },
+       { 0x0357, KEY_POWER },
+       { 0x0341, KEY_UNKNOWN },    /* INPUT */
+       { 0x0300, KEY_UNKNOWN },    /* HD */
 };
 
 static struct rc_map_list dvico_portable_map = {
        .map = {
                .scan    = rc_map_dvico_portable_table,
                .size    = ARRAY_SIZE(rc_map_dvico_portable_table),
-               .rc_type = RC_TYPE_UNKNOWN,     /* Legacy IR type */
+               .rc_type = RC_TYPE_NEC,
                .name    = RC_MAP_DVICO_PORTABLE,
        }
 };
index 9a7665fddc29d908ff27e5943c57b7b3bccf87c7..99a3f36259447077557da6920526716ee1e0ad96 100644 (file)
@@ -458,8 +458,8 @@ static int cxusb_rc_query(struct dvb_usb_device *d)
        cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
 
        if (ircode[2] || ircode[3])
-               rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
-                          RC_SCANCODE_RC5(ircode[2], ircode[3]), 0);
+               rc_keydown(d->rc_dev, RC_TYPE_NEC,
+                          RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0);
        return 0;
 }
 
@@ -473,8 +473,8 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
                return 0;
 
        if (ircode[1] || ircode[2])
-               rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
-                          RC_SCANCODE_RC5(ircode[1], ircode[2]), 0);
+               rc_keydown(d->rc_dev, RC_TYPE_NEC,
+                          RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0);
        return 0;
 }
 
@@ -1646,7 +1646,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
                .rc_codes       = RC_MAP_DVICO_PORTABLE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .generic_bulk_ctrl_endpoint = 0x01,
@@ -1703,7 +1703,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
                .rc_codes       = RC_MAP_DVICO_MCE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .generic_bulk_ctrl_endpoint = 0x01,
@@ -1768,7 +1768,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
                .rc_codes       = RC_MAP_DVICO_PORTABLE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .generic_bulk_ctrl_endpoint = 0x01,
@@ -1824,7 +1824,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
                .rc_codes       = RC_MAP_DVICO_PORTABLE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .generic_bulk_ctrl_endpoint = 0x01,
@@ -1879,7 +1879,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
                .rc_codes       = RC_MAP_DVICO_MCE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_bluebird2_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .num_device_descs = 1,
@@ -1933,7 +1933,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
                .rc_codes       = RC_MAP_DVICO_PORTABLE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_bluebird2_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .num_device_descs = 1,
@@ -1989,7 +1989,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
                .rc_codes       = RC_MAP_DVICO_PORTABLE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .num_device_descs = 1,
@@ -2088,7 +2088,7 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
                .rc_codes       = RC_MAP_DVICO_MCE,
                .module_name    = KBUILD_MODNAME,
                .rc_query       = cxusb_rc_query,
-               .allowed_protos = RC_BIT_UNKNOWN,
+               .allowed_protos = RC_BIT_NEC,
        },
 
        .num_device_descs = 1,