]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
[media] media: vp7045: port TwinhanDTV Alpha to rc-core
authorSean Young <sean@mess.org>
Wed, 6 Sep 2017 11:19:06 +0000 (08:19 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 4 Oct 2017 18:25:13 +0000 (15:25 -0300)
Only the nec protocol is understood, but then it doesn't pass on
the full scancode and it ignores the nec repeats its own remote
sends, so holding buttons does not work.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/rc/keymaps/rc-twinhan1027.c
drivers/media/usb/dvb-usb/dvb-usb-remote.c
drivers/media/usb/dvb-usb/dvb-usb.h
drivers/media/usb/dvb-usb/vp7045.c

index 2275b37c61d2a31c2ea46169d19d52f04f5d8118..78bb3143a1a8574afec9df4d2a65807b100d6865 100644 (file)
@@ -66,7 +66,7 @@ static struct rc_map_list twinhan_vp1027_map = {
        .map = {
                .scan     = twinhan_vp1027,
                .size     = ARRAY_SIZE(twinhan_vp1027),
-               .rc_proto = RC_PROTO_UNKNOWN,   /* Legacy IR type */
+               .rc_proto = RC_PROTO_NEC,
                .name     = RC_MAP_TWINHAN_VP1027_DVBS,
        }
 };
index b027d378102aacbbfa0a23de97c422444de912e3..bf7dcd6b03e056276ced9dab5d5aa8a3ea75e9a4 100644 (file)
@@ -283,6 +283,7 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
        dev->input_phys = d->rc_phys;
        dev->dev.parent = &d->udev->dev;
        dev->priv = d;
+       dev->scancode_mask = d->props.rc.core.scancode_mask;
 
        err = rc_register_device(dev);
        if (err < 0) {
index 72468fdffa18497e2234d71f21ca463560a27320..1da9e47553f525bf3a4eb4205c2242a8805b4a00 100644 (file)
@@ -207,6 +207,7 @@ struct dvb_rc {
        int (*rc_query) (struct dvb_usb_device *d);
        int rc_interval;
        bool bulk_mode;                         /* uses bulk mode */
+       u32 scancode_mask;
 };
 
 /**
index 13340af0d39c34bee810a8b225da511e950dcfc5..2527b88beb872daf49b82bd42be6d4300d75dec2 100644 (file)
@@ -97,82 +97,22 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff)
        return vp7045_usb_op(d,SET_TUNER_POWER,&v,1,NULL,0,150);
 }
 
-/* remote control stuff */
-
-/* The keymapping struct. Somehow this should be loaded to the driver, but
- * currently it is hardcoded. */
-static struct rc_map_table rc_map_vp7045_table[] = {
-       { 0x0016, KEY_POWER },
-       { 0x0010, KEY_MUTE },
-       { 0x0003, KEY_1 },
-       { 0x0001, KEY_2 },
-       { 0x0006, KEY_3 },
-       { 0x0009, KEY_4 },
-       { 0x001d, KEY_5 },
-       { 0x001f, KEY_6 },
-       { 0x000d, KEY_7 },
-       { 0x0019, KEY_8 },
-       { 0x001b, KEY_9 },
-       { 0x0015, KEY_0 },
-       { 0x0005, KEY_CHANNELUP },
-       { 0x0002, KEY_CHANNELDOWN },
-       { 0x001e, KEY_VOLUMEUP },
-       { 0x000a, KEY_VOLUMEDOWN },
-       { 0x0011, KEY_RECORD },
-       { 0x0017, KEY_FAVORITES }, /* Heart symbol - Channel list. */
-       { 0x0014, KEY_PLAY },
-       { 0x001a, KEY_STOP },
-       { 0x0040, KEY_REWIND },
-       { 0x0012, KEY_FASTFORWARD },
-       { 0x000e, KEY_PREVIOUS }, /* Recall - Previous channel. */
-       { 0x004c, KEY_PAUSE },
-       { 0x004d, KEY_SCREEN }, /* Full screen mode. */
-       { 0x0054, KEY_AUDIO }, /* MTS - Switch to secondary audio. */
-       { 0x000c, KEY_CANCEL }, /* Cancel */
-       { 0x001c, KEY_EPG }, /* EPG */
-       { 0x0000, KEY_TAB }, /* Tab */
-       { 0x0048, KEY_INFO }, /* Preview */
-       { 0x0004, KEY_LIST }, /* RecordList */
-       { 0x000f, KEY_TEXT }, /* Teletext */
-       { 0x0041, KEY_PREVIOUSSONG },
-       { 0x0042, KEY_NEXTSONG },
-       { 0x004b, KEY_UP },
-       { 0x0051, KEY_DOWN },
-       { 0x004e, KEY_LEFT },
-       { 0x0052, KEY_RIGHT },
-       { 0x004f, KEY_ENTER },
-       { 0x0013, KEY_CANCEL },
-       { 0x004a, KEY_CLEAR },
-       { 0x0054, KEY_PRINT }, /* Capture */
-       { 0x0043, KEY_SUBTITLE }, /* Subtitle/CC */
-       { 0x0008, KEY_VIDEO }, /* A/V */
-       { 0x0007, KEY_SLEEP }, /* Hibernate */
-       { 0x0045, KEY_ZOOM }, /* Zoom+ */
-       { 0x0018, KEY_RED},
-       { 0x0053, KEY_GREEN},
-       { 0x005e, KEY_YELLOW},
-       { 0x005f, KEY_BLUE}
-};
-
-static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int vp7045_rc_query(struct dvb_usb_device *d)
 {
        u8 key;
-       int i;
        vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20);
 
        deb_rc("remote query key: %x %d\n",key,key);
 
-       if (key == 0x44) {
-               *state = REMOTE_NO_KEY_PRESSED;
-               return 0;
+       if (key != 0x44) {
+               /*
+                * The 8 bit address isn't available, but since the remote uses
+                * address 0 we'll use that. nec repeats are ignored too, even
+                * though the remote sends them.
+                */
+               rc_keydown(d->rc_dev, RC_PROTO_NEC, RC_SCANCODE_NEC(0, key), 0);
        }
 
-       for (i = 0; i < ARRAY_SIZE(rc_map_vp7045_table); i++)
-               if (rc5_data(&rc_map_vp7045_table[i]) == key) {
-                       *state = REMOTE_KEY_PRESSED;
-                       *event = rc_map_vp7045_table[i].keycode;
-                       break;
-               }
        return 0;
 }
 
@@ -265,11 +205,13 @@ static struct dvb_usb_device_properties vp7045_properties = {
        .power_ctrl       = vp7045_power_ctrl,
        .read_mac_address = vp7045_read_mac_addr,
 
-       .rc.legacy = {
-               .rc_interval      = 400,
-               .rc_map_table       = rc_map_vp7045_table,
-               .rc_map_size  = ARRAY_SIZE(rc_map_vp7045_table),
-               .rc_query         = vp7045_rc_query,
+       .rc.core = {
+               .rc_interval    = 400,
+               .rc_codes       = RC_MAP_TWINHAN_VP1027_DVBS,
+               .module_name    = KBUILD_MODNAME,
+               .rc_query       = vp7045_rc_query,
+               .allowed_protos = RC_PROTO_BIT_NEC,
+               .scancode_mask  = 0xff,
        },
 
        .num_device_descs = 2,