diff options
author | Antti Palosaari <crope@iki.fi> | 2010-10-17 17:25:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-22 19:24:57 -0400 |
commit | a84946895fa747a81c3b55a1398e03cdba4778d9 (patch) | |
tree | af40286313023e278e2f1cf5c9fbc5a633877b5c | |
parent | 4ae871088a9ddead041c9e91e01435e4ed5dda08 (diff) |
[media] anysee: switch to RC core
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-usb/anysee.c | 87 |
1 files changed, 21 insertions, 66 deletions
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 4685259e1614..1759d26bca42 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c | |||
@@ -354,7 +354,7 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) | |||
354 | static int anysee_tuner_attach(struct dvb_usb_adapter *adap) | 354 | static int anysee_tuner_attach(struct dvb_usb_adapter *adap) |
355 | { | 355 | { |
356 | struct anysee_state *state = adap->dev->priv; | 356 | struct anysee_state *state = adap->dev->priv; |
357 | deb_info("%s: \n", __func__); | 357 | deb_info("%s:\n", __func__); |
358 | 358 | ||
359 | switch (state->tuner) { | 359 | switch (state->tuner) { |
360 | case DVB_PLL_THOMSON_DTT7579: | 360 | case DVB_PLL_THOMSON_DTT7579: |
@@ -374,78 +374,32 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) | |||
374 | return 0; | 374 | return 0; |
375 | } | 375 | } |
376 | 376 | ||
377 | static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 377 | static int anysee_rc_query(struct dvb_usb_device *d) |
378 | { | 378 | { |
379 | u8 buf[] = {CMD_GET_IR_CODE}; | 379 | u8 buf[] = {CMD_GET_IR_CODE}; |
380 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; | ||
381 | u8 ircode[2]; | 380 | u8 ircode[2]; |
382 | int i, ret; | 381 | int ret; |
382 | |||
383 | /* Remote controller is basic NEC using address byte 0x08. | ||
384 | Anysee device RC query returns only two bytes, status and code, | ||
385 | address byte is dropped. Also it does not return any value for | ||
386 | NEC RCs having address byte other than 0x08. Due to that, we | ||
387 | cannot use that device as standard NEC receiver. | ||
388 | It could be possible make hack which reads whole code directly | ||
389 | from device memory... */ | ||
383 | 390 | ||
384 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), &ircode[0], 2); | 391 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), ircode, sizeof(ircode)); |
385 | if (ret) | 392 | if (ret) |
386 | return ret; | 393 | return ret; |
387 | 394 | ||
388 | *event = 0; | 395 | if (ircode[0]) { |
389 | *state = REMOTE_NO_KEY_PRESSED; | 396 | deb_rc("%s: key pressed %02x\n", __func__, ircode[1]); |
390 | 397 | ir_keydown(d->rc_input_dev, 0x08 << 8 | ircode[1], 0); | |
391 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | ||
392 | if (rc5_custom(&keymap[i]) == ircode[0] && | ||
393 | rc5_data(&keymap[i]) == ircode[1]) { | ||
394 | *event = keymap[i].keycode; | ||
395 | *state = REMOTE_KEY_PRESSED; | ||
396 | return 0; | ||
397 | } | ||
398 | } | 398 | } |
399 | |||
399 | return 0; | 400 | return 0; |
400 | } | 401 | } |
401 | 402 | ||
402 | static struct ir_scancode ir_codes_anysee_table[] = { | ||
403 | { 0x0100, KEY_0 }, | ||
404 | { 0x0101, KEY_1 }, | ||
405 | { 0x0102, KEY_2 }, | ||
406 | { 0x0103, KEY_3 }, | ||
407 | { 0x0104, KEY_4 }, | ||
408 | { 0x0105, KEY_5 }, | ||
409 | { 0x0106, KEY_6 }, | ||
410 | { 0x0107, KEY_7 }, | ||
411 | { 0x0108, KEY_8 }, | ||
412 | { 0x0109, KEY_9 }, | ||
413 | { 0x010a, KEY_POWER }, | ||
414 | { 0x010b, KEY_DOCUMENTS }, /* * */ | ||
415 | { 0x0119, KEY_FAVORITES }, | ||
416 | { 0x0120, KEY_SLEEP }, | ||
417 | { 0x0121, KEY_MODE }, /* 4:3 / 16:9 select */ | ||
418 | { 0x0122, KEY_ZOOM }, | ||
419 | { 0x0147, KEY_TEXT }, | ||
420 | { 0x0116, KEY_TV }, /* TV / radio select */ | ||
421 | { 0x011e, KEY_LANGUAGE }, /* Second Audio Program */ | ||
422 | { 0x011a, KEY_SUBTITLE }, | ||
423 | { 0x011b, KEY_CAMERA }, /* screenshot */ | ||
424 | { 0x0142, KEY_MUTE }, | ||
425 | { 0x010e, KEY_MENU }, | ||
426 | { 0x010f, KEY_EPG }, | ||
427 | { 0x0117, KEY_INFO }, | ||
428 | { 0x0110, KEY_EXIT }, | ||
429 | { 0x0113, KEY_VOLUMEUP }, | ||
430 | { 0x0112, KEY_VOLUMEDOWN }, | ||
431 | { 0x0111, KEY_CHANNELUP }, | ||
432 | { 0x0114, KEY_CHANNELDOWN }, | ||
433 | { 0x0115, KEY_OK }, | ||
434 | { 0x011d, KEY_RED }, | ||
435 | { 0x011f, KEY_GREEN }, | ||
436 | { 0x011c, KEY_YELLOW }, | ||
437 | { 0x0144, KEY_BLUE }, | ||
438 | { 0x010c, KEY_SHUFFLE }, /* snapshot */ | ||
439 | { 0x0148, KEY_STOP }, | ||
440 | { 0x0150, KEY_PLAY }, | ||
441 | { 0x0151, KEY_PAUSE }, | ||
442 | { 0x0149, KEY_RECORD }, | ||
443 | { 0x0118, KEY_PREVIOUS }, /* |<< */ | ||
444 | { 0x010d, KEY_NEXT }, /* >>| */ | ||
445 | { 0x0124, KEY_PROG1 }, /* F1 */ | ||
446 | { 0x0125, KEY_PROG2 }, /* F2 */ | ||
447 | }; | ||
448 | |||
449 | /* DVB USB Driver stuff */ | 403 | /* DVB USB Driver stuff */ |
450 | static struct dvb_usb_device_properties anysee_properties; | 404 | static struct dvb_usb_device_properties anysee_properties; |
451 | 405 | ||
@@ -520,11 +474,12 @@ static struct dvb_usb_device_properties anysee_properties = { | |||
520 | } | 474 | } |
521 | }, | 475 | }, |
522 | 476 | ||
523 | .rc.legacy = { | 477 | .rc.core = { |
524 | .rc_key_map = ir_codes_anysee_table, | 478 | .rc_codes = RC_MAP_ANYSEE, |
525 | .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), | 479 | .protocol = IR_TYPE_OTHER, |
480 | .module_name = "anysee", | ||
526 | .rc_query = anysee_rc_query, | 481 | .rc_query = anysee_rc_query, |
527 | .rc_interval = 200, /* windows driver uses 500ms */ | 482 | .rc_interval = 250, /* windows driver uses 500ms */ |
528 | }, | 483 | }, |
529 | 484 | ||
530 | .i2c_algo = &anysee_i2c_algo, | 485 | .i2c_algo = &anysee_i2c_algo, |