aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/opera1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb/opera1.c')
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c82
1 files changed, 45 insertions, 37 deletions
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c
index f896337b4535..2e4fab7215f5 100644
--- a/drivers/media/dvb/dvb-usb/opera1.c
+++ b/drivers/media/dvb/dvb-usb/opera1.c
@@ -35,7 +35,7 @@
35struct opera1_state { 35struct opera1_state {
36 u32 last_key_pressed; 36 u32 last_key_pressed;
37}; 37};
38struct ir_codes_opera_table { 38struct rc_map_opera_table {
39 u32 keycode; 39 u32 keycode;
40 u32 event; 40 u32 event;
41}; 41};
@@ -53,27 +53,36 @@ static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value,
53 u8 * data, u16 len, int flags) 53 u8 * data, u16 len, int flags)
54{ 54{
55 int ret; 55 int ret;
56 u8 r; 56 u8 tmp;
57 u8 u8buf[len]; 57 u8 *buf;
58
59 unsigned int pipe = (flags == OPERA_READ_MSG) ? 58 unsigned int pipe = (flags == OPERA_READ_MSG) ?
60 usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0); 59 usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0);
61 u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; 60 u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
62 61
62 buf = kmalloc(len, GFP_KERNEL);
63 if (!buf)
64 return -ENOMEM;
65
63 if (flags == OPERA_WRITE_MSG) 66 if (flags == OPERA_WRITE_MSG)
64 memcpy(u8buf, data, len); 67 memcpy(buf, data, len);
65 ret = 68 ret = usb_control_msg(dev, pipe, request,
66 usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, 69 request_type | USB_TYPE_VENDOR, value, 0x0,
67 value, 0x0, u8buf, len, 2000); 70 buf, len, 2000);
68 71
69 if (request == OPERA_TUNER_REQ) { 72 if (request == OPERA_TUNER_REQ) {
73 tmp = buf[0];
70 if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 74 if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
71 OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, 75 OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR,
72 0x01, 0x0, &r, 1, 2000)<1 || r!=0x08) 76 0x01, 0x0, buf, 1, 2000) < 1 || buf[0] != 0x08) {
73 return 0; 77 ret = 0;
78 goto out;
79 }
80 buf[0] = tmp;
74 } 81 }
75 if (flags == OPERA_READ_MSG) 82 if (flags == OPERA_READ_MSG)
76 memcpy(data, u8buf, len); 83 memcpy(data, buf, len);
84out:
85 kfree(buf);
77 return ret; 86 return ret;
78} 87}
79 88
@@ -189,7 +198,7 @@ static int opera1_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate,
189static u8 opera1_inittab[] = { 198static u8 opera1_inittab[] = {
190 0x00, 0xa1, 199 0x00, 0xa1,
191 0x01, 0x15, 200 0x01, 0x15,
192 0x02, 0x00, 201 0x02, 0x30,
193 0x03, 0x00, 202 0x03, 0x00,
194 0x04, 0x7d, 203 0x04, 0x7d,
195 0x05, 0x05, 204 0x05, 0x05,
@@ -331,7 +340,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff)
331 return 0; 340 return 0;
332} 341}
333 342
334static struct ir_scancode ir_codes_opera1_table[] = { 343static struct rc_map_table rc_map_opera1_table[] = {
335 {0x5fa0, KEY_1}, 344 {0x5fa0, KEY_1},
336 {0x51af, KEY_2}, 345 {0x51af, KEY_2},
337 {0x5da2, KEY_3}, 346 {0x5da2, KEY_3},
@@ -342,23 +351,22 @@ static struct ir_scancode ir_codes_opera1_table[] = {
342 {0x49b6, KEY_8}, 351 {0x49b6, KEY_8},
343 {0x05fa, KEY_9}, 352 {0x05fa, KEY_9},
344 {0x45ba, KEY_0}, 353 {0x45ba, KEY_0},
345 {0x09f6, KEY_UP}, /*chanup */ 354 {0x09f6, KEY_CHANNELUP}, /*chanup */
346 {0x1be5, KEY_DOWN}, /*chandown */ 355 {0x1be5, KEY_CHANNELDOWN}, /*chandown */
347 {0x5da3, KEY_LEFT}, /*voldown */ 356 {0x5da3, KEY_VOLUMEDOWN}, /*voldown */
348 {0x5fa1, KEY_RIGHT}, /*volup */ 357 {0x5fa1, KEY_VOLUMEUP}, /*volup */
349 {0x07f8, KEY_SPACE}, /*tab */ 358 {0x07f8, KEY_SPACE}, /*tab */
350 {0x1fe1, KEY_ENTER}, /*play ok */ 359 {0x1fe1, KEY_OK}, /*play ok */
351 {0x1be4, KEY_Z}, /*zoom */ 360 {0x1be4, KEY_ZOOM}, /*zoom */
352 {0x59a6, KEY_M}, /*mute */ 361 {0x59a6, KEY_MUTE}, /*mute */
353 {0x5ba5, KEY_F}, /*tv/f */ 362 {0x5ba5, KEY_RADIO}, /*tv/f */
354 {0x19e7, KEY_R}, /*rec */ 363 {0x19e7, KEY_RECORD}, /*rec */
355 {0x01fe, KEY_S}, /*Stop */ 364 {0x01fe, KEY_STOP}, /*Stop */
356 {0x03fd, KEY_P}, /*pause */ 365 {0x03fd, KEY_PAUSE}, /*pause */
357 {0x03fc, KEY_W}, /*<- -> */ 366 {0x03fc, KEY_SCREEN}, /*<- -> */
358 {0x07f9, KEY_C}, /*capture */ 367 {0x07f9, KEY_CAMERA}, /*capture */
359 {0x47b9, KEY_Q}, /*exit */ 368 {0x47b9, KEY_ESC}, /*exit */
360 {0x43bc, KEY_O}, /*power */ 369 {0x43bc, KEY_POWER2}, /*power */
361
362}; 370};
363 371
364static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) 372static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state)
@@ -404,12 +412,12 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state)
404 412
405 send_key = (send_key & 0xffff) | 0x0100; 413 send_key = (send_key & 0xffff) | 0x0100;
406 414
407 for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { 415 for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) {
408 if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { 416 if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) {
409 *state = REMOTE_KEY_PRESSED; 417 *state = REMOTE_KEY_PRESSED;
410 *event = ir_codes_opera1_table[i].keycode; 418 *event = rc_map_opera1_table[i].keycode;
411 opst->last_key_pressed = 419 opst->last_key_pressed =
412 ir_codes_opera1_table[i].keycode; 420 rc_map_opera1_table[i].keycode;
413 break; 421 break;
414 } 422 }
415 opst->last_key_pressed = 0; 423 opst->last_key_pressed = 0;
@@ -497,8 +505,8 @@ static struct dvb_usb_device_properties opera1_properties = {
497 .i2c_algo = &opera1_i2c_algo, 505 .i2c_algo = &opera1_i2c_algo,
498 506
499 .rc.legacy = { 507 .rc.legacy = {
500 .rc_key_map = ir_codes_opera1_table, 508 .rc_map_table = rc_map_opera1_table,
501 .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), 509 .rc_map_size = ARRAY_SIZE(rc_map_opera1_table),
502 .rc_interval = 200, 510 .rc_interval = 200,
503 .rc_query = opera1_rc_query, 511 .rc_query = opera1_rc_query,
504 }, 512 },