Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: vp7045: port TwinhanDTV Alpha to rc-core

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>

authored by

Sean Young and committed by
Mauro Carvalho Chehab
771f8726 b9f407e3

+18 -74
+1 -1
drivers/media/rc/keymaps/rc-twinhan1027.c
··· 66 66 .map = { 67 67 .scan = twinhan_vp1027, 68 68 .size = ARRAY_SIZE(twinhan_vp1027), 69 - .rc_proto = RC_PROTO_UNKNOWN, /* Legacy IR type */ 69 + .rc_proto = RC_PROTO_NEC, 70 70 .name = RC_MAP_TWINHAN_VP1027_DVBS, 71 71 } 72 72 };
+1
drivers/media/usb/dvb-usb/dvb-usb-remote.c
··· 283 283 dev->input_phys = d->rc_phys; 284 284 dev->dev.parent = &d->udev->dev; 285 285 dev->priv = d; 286 + dev->scancode_mask = d->props.rc.core.scancode_mask; 286 287 287 288 err = rc_register_device(dev); 288 289 if (err < 0) {
+1
drivers/media/usb/dvb-usb/dvb-usb.h
··· 207 207 int (*rc_query) (struct dvb_usb_device *d); 208 208 int rc_interval; 209 209 bool bulk_mode; /* uses bulk mode */ 210 + u32 scancode_mask; 210 211 }; 211 212 212 213 /**
+15 -73
drivers/media/usb/dvb-usb/vp7045.c
··· 97 97 return vp7045_usb_op(d,SET_TUNER_POWER,&v,1,NULL,0,150); 98 98 } 99 99 100 - /* remote control stuff */ 101 - 102 - /* The keymapping struct. Somehow this should be loaded to the driver, but 103 - * currently it is hardcoded. */ 104 - static struct rc_map_table rc_map_vp7045_table[] = { 105 - { 0x0016, KEY_POWER }, 106 - { 0x0010, KEY_MUTE }, 107 - { 0x0003, KEY_1 }, 108 - { 0x0001, KEY_2 }, 109 - { 0x0006, KEY_3 }, 110 - { 0x0009, KEY_4 }, 111 - { 0x001d, KEY_5 }, 112 - { 0x001f, KEY_6 }, 113 - { 0x000d, KEY_7 }, 114 - { 0x0019, KEY_8 }, 115 - { 0x001b, KEY_9 }, 116 - { 0x0015, KEY_0 }, 117 - { 0x0005, KEY_CHANNELUP }, 118 - { 0x0002, KEY_CHANNELDOWN }, 119 - { 0x001e, KEY_VOLUMEUP }, 120 - { 0x000a, KEY_VOLUMEDOWN }, 121 - { 0x0011, KEY_RECORD }, 122 - { 0x0017, KEY_FAVORITES }, /* Heart symbol - Channel list. */ 123 - { 0x0014, KEY_PLAY }, 124 - { 0x001a, KEY_STOP }, 125 - { 0x0040, KEY_REWIND }, 126 - { 0x0012, KEY_FASTFORWARD }, 127 - { 0x000e, KEY_PREVIOUS }, /* Recall - Previous channel. */ 128 - { 0x004c, KEY_PAUSE }, 129 - { 0x004d, KEY_SCREEN }, /* Full screen mode. */ 130 - { 0x0054, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ 131 - { 0x000c, KEY_CANCEL }, /* Cancel */ 132 - { 0x001c, KEY_EPG }, /* EPG */ 133 - { 0x0000, KEY_TAB }, /* Tab */ 134 - { 0x0048, KEY_INFO }, /* Preview */ 135 - { 0x0004, KEY_LIST }, /* RecordList */ 136 - { 0x000f, KEY_TEXT }, /* Teletext */ 137 - { 0x0041, KEY_PREVIOUSSONG }, 138 - { 0x0042, KEY_NEXTSONG }, 139 - { 0x004b, KEY_UP }, 140 - { 0x0051, KEY_DOWN }, 141 - { 0x004e, KEY_LEFT }, 142 - { 0x0052, KEY_RIGHT }, 143 - { 0x004f, KEY_ENTER }, 144 - { 0x0013, KEY_CANCEL }, 145 - { 0x004a, KEY_CLEAR }, 146 - { 0x0054, KEY_PRINT }, /* Capture */ 147 - { 0x0043, KEY_SUBTITLE }, /* Subtitle/CC */ 148 - { 0x0008, KEY_VIDEO }, /* A/V */ 149 - { 0x0007, KEY_SLEEP }, /* Hibernate */ 150 - { 0x0045, KEY_ZOOM }, /* Zoom+ */ 151 - { 0x0018, KEY_RED}, 152 - { 0x0053, KEY_GREEN}, 153 - { 0x005e, KEY_YELLOW}, 154 - { 0x005f, KEY_BLUE} 155 - }; 156 - 157 - static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 100 + static int vp7045_rc_query(struct dvb_usb_device *d) 158 101 { 159 102 u8 key; 160 - int i; 161 103 vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); 162 104 163 105 deb_rc("remote query key: %x %d\n",key,key); 164 106 165 - if (key == 0x44) { 166 - *state = REMOTE_NO_KEY_PRESSED; 167 - return 0; 107 + if (key != 0x44) { 108 + /* 109 + * The 8 bit address isn't available, but since the remote uses 110 + * address 0 we'll use that. nec repeats are ignored too, even 111 + * though the remote sends them. 112 + */ 113 + rc_keydown(d->rc_dev, RC_PROTO_NEC, RC_SCANCODE_NEC(0, key), 0); 168 114 } 169 115 170 - for (i = 0; i < ARRAY_SIZE(rc_map_vp7045_table); i++) 171 - if (rc5_data(&rc_map_vp7045_table[i]) == key) { 172 - *state = REMOTE_KEY_PRESSED; 173 - *event = rc_map_vp7045_table[i].keycode; 174 - break; 175 - } 176 116 return 0; 177 117 } 178 118 ··· 205 265 .power_ctrl = vp7045_power_ctrl, 206 266 .read_mac_address = vp7045_read_mac_addr, 207 267 208 - .rc.legacy = { 209 - .rc_interval = 400, 210 - .rc_map_table = rc_map_vp7045_table, 211 - .rc_map_size = ARRAY_SIZE(rc_map_vp7045_table), 212 - .rc_query = vp7045_rc_query, 268 + .rc.core = { 269 + .rc_interval = 400, 270 + .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS, 271 + .module_name = KBUILD_MODNAME, 272 + .rc_query = vp7045_rc_query, 273 + .allowed_protos = RC_PROTO_BIT_NEC, 274 + .scancode_mask = 0xff, 213 275 }, 214 276 215 277 .num_device_descs = 2,