diff options
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c | 119 |
1 files changed, 53 insertions, 66 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c index d51dfaf5e..86f697495 100644 --- a/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -18,68 +18,60 @@ MODULE_PARM_DESC(debug, "set debugging level (1=rc (|-able))." DVB_USB_DEBUG_STA #define deb_rc(args...) dprintk(debug,0x01,args) /* Hauppauge NOVA-T USB2 keys */ -static const struct { u8 raw; uint32_t key; } haupp_rc_keys [] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_KPASTERISK }, - { 0x0b, KEY_RED }, - { 0x0c, KEY_RADIO }, - { 0x0d, KEY_MENU }, - { 0x0e, KEY_GRAVE }, /* # */ - { 0x0f, KEY_MUTE }, - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x12, KEY_CHANNEL }, - { 0x14, KEY_UP }, - { 0x15, KEY_DOWN }, - { 0x16, KEY_LEFT }, - { 0x17, KEY_RIGHT }, - { 0x18, KEY_VIDEO }, - { 0x19, KEY_AUDIO }, - { 0x1a, KEY_MEDIA }, - { 0x1b, KEY_EPG }, - { 0x1c, KEY_TV }, - { 0x1e, KEY_NEXT }, - { 0x1f, KEY_BACK }, - { 0x20, KEY_CHANNELUP }, - { 0x21, KEY_CHANNELDOWN }, - { 0x24, KEY_LAST }, /* Skip backwards */ - { 0x25, KEY_OK }, - { 0x29, KEY_BLUE}, - { 0x2e, KEY_GREEN }, - { 0x30, KEY_PAUSE }, - { 0x32, KEY_REWIND }, - { 0x34, KEY_FASTFORWARD }, - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, - { 0x38, KEY_YELLOW }, - { 0x3b, KEY_GOTO }, - { 0x3d, KEY_POWER }, +static struct dvb_usb_rc_key haupp_rc_keys [] = { + { 0x1e, 0x00, KEY_0 }, + { 0x1e, 0x01, KEY_1 }, + { 0x1e, 0x02, KEY_2 }, + { 0x1e, 0x03, KEY_3 }, + { 0x1e, 0x04, KEY_4 }, + { 0x1e, 0x05, KEY_5 }, + { 0x1e, 0x06, KEY_6 }, + { 0x1e, 0x07, KEY_7 }, + { 0x1e, 0x08, KEY_8 }, + { 0x1e, 0x09, KEY_9 }, + { 0x1e, 0x0a, KEY_KPASTERISK }, + { 0x1e, 0x0b, KEY_RED }, + { 0x1e, 0x0c, KEY_RADIO }, + { 0x1e, 0x0d, KEY_MENU }, + { 0x1e, 0x0e, KEY_GRAVE }, /* # */ + { 0x1e, 0x0f, KEY_MUTE }, + { 0x1e, 0x10, KEY_VOLUMEUP }, + { 0x1e, 0x11, KEY_VOLUMEDOWN }, + { 0x1e, 0x12, KEY_CHANNEL }, + { 0x1e, 0x14, KEY_UP }, + { 0x1e, 0x15, KEY_DOWN }, + { 0x1e, 0x16, KEY_LEFT }, + { 0x1e, 0x17, KEY_RIGHT }, + { 0x1e, 0x18, KEY_VIDEO }, + { 0x1e, 0x19, KEY_AUDIO }, + { 0x1e, 0x1a, KEY_MEDIA }, + { 0x1e, 0x1b, KEY_EPG }, + { 0x1e, 0x1c, KEY_TV }, + { 0x1e, 0x1e, KEY_NEXT }, + { 0x1e, 0x1f, KEY_BACK }, + { 0x1e, 0x20, KEY_CHANNELUP }, + { 0x1e, 0x21, KEY_CHANNELDOWN }, + { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */ + { 0x1e, 0x25, KEY_OK }, + { 0x1e, 0x29, KEY_BLUE}, + { 0x1e, 0x2e, KEY_GREEN }, + { 0x1e, 0x30, KEY_PAUSE }, + { 0x1e, 0x32, KEY_REWIND }, + { 0x1e, 0x34, KEY_FASTFORWARD }, + { 0x1e, 0x35, KEY_PLAY }, + { 0x1e, 0x36, KEY_STOP }, + { 0x1e, 0x37, KEY_RECORD }, + { 0x1e, 0x38, KEY_YELLOW }, + { 0x1e, 0x3b, KEY_GOTO }, + { 0x1e, 0x3d, KEY_POWER }, }; -static int nova_t_rc_init(struct dvb_usb_device *d) -{ - int i; - for (i=0; i<sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) - set_bit(haupp_rc_keys[i].key, d->rc_input_dev.keybit); - return 0; -} - /* Firmware bug? sometimes, when a new key is pressed, the previous pressed key - * is delivered. No workaround yet. + * is delivered. No workaround yet, maybe a new firmware. */ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle; + u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle,custom; u16 raw; int i; struct dibusb_state *st = d->priv; @@ -92,17 +84,14 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) raw = ((key[1] << 8) | key[2]) >> 3; toggle = !!(raw & 0x800); data = raw & 0x3f; + custom = (raw >> 6) & 0x1f; deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %02x toggle: %d\n",key[1],key[2],key[3],data,toggle); - if (((raw >> 6) & 0x1f) != 0x1e) { - deb_rc("key received - but ignored (%x)\n",(raw >> 6) & 0x1f); - break; - } - for (i = 0; i < sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) { - if (haupp_rc_keys[i].raw == data) { - *event = haupp_rc_keys[i].key; + if (haupp_rc_keys[i].data == data && + haupp_rc_keys[i].custom == custom) { + *event = haupp_rc_keys[i].event; *state = REMOTE_KEY_PRESSED; if (st->old_toggle == toggle) { if (st->last_repeat_count++ < 2) @@ -111,7 +100,6 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) st->last_repeat_count = 0; st->old_toggle = toggle; } - break; } } @@ -122,7 +110,6 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) break; } - return 0; } @@ -161,7 +148,7 @@ static struct dvb_usb_properties nova_t_properties = { .read_mac_address = NULL, .rc_interval = 100, - .init_rc = nova_t_rc_init, + .rc_key_map = haupp_rc_keys, .query_rc = nova_t_rc_query, .i2c_algo = &dibusb_i2c_algo, |