diff options
author | Patrick Boettcher <devnull@localhost> | 2005-04-29 10:44:48 +0000 |
---|---|---|
committer | Patrick Boettcher <devnull@localhost> | 2005-04-29 10:44:48 +0000 |
commit | e86aed48d36edbea2385cab090e464064c5620d5 (patch) | |
tree | 85f5a5c2b35c173d653954f20e97499f9f3c92c4 /linux/drivers/media | |
parent | 4335870fc9921e4c690eff9df3be152aa2e3e606 (diff) | |
download | mediapointer-dvb-s2-e86aed48d36edbea2385cab090e464064c5620d5.tar.gz mediapointer-dvb-s2-e86aed48d36edbea2385cab090e464064c5620d5.tar.bz2 |
added key-mapping for the a800 (Thanks to Glen Harris)
changed remote-control-key-types and functions (saved about 80 lines code)
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/a800.c | 51 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb-common.c | 16 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb-mb.c | 9 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb-mc.c | 3 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dibusb.h | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/digitv.c | 15 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dtt200u.c | 19 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 14 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb.h | 15 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c | 119 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/umt-010.c | 6 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/vp7045.c | 30 |
12 files changed, 130 insertions, 169 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/a800.c b/linux/drivers/media/dvb/dvb-usb/a800.c index cc3f9dd9e..4c9a62320 100644 --- a/linux/drivers/media/dvb/dvb-usb/a800.c +++ b/linux/drivers/media/dvb/dvb-usb/a800.c @@ -25,18 +25,43 @@ static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) return 0; } -static struct dvb_usb_nec_rc_key a800_rc_keys[] = { - { 0x00, 0x16, KEY_POWER }, /* dummy key */ +static struct dvb_usb_rc_key a800_rc_keys[] = { + { 0x02, 0x01, KEY_PROG1 }, /* SOURCE */ + { 0x02, 0x00, KEY_POWER }, /* POWER */ + { 0x02, 0x05, KEY_1 }, /* 1 */ + { 0x02, 0x06, KEY_2 }, /* 2 */ + { 0x02, 0x07, KEY_3 }, /* 3 */ + { 0x02, 0x09, KEY_4 }, /* 4 */ + { 0x02, 0x0a, KEY_5 }, /* 5 */ + { 0x02, 0x0b, KEY_6 }, /* 6 */ + { 0x02, 0x0d, KEY_7 }, /* 7 */ + { 0x02, 0x0e, KEY_8 }, /* 8 */ + { 0x02, 0x0f, KEY_9 }, /* 9 */ + { 0x02, 0x12, KEY_LEFT }, /* L / DISPLAY */ + { 0x02, 0x11, KEY_0 }, /* 0 */ + { 0x02, 0x13, KEY_RIGHT }, /* R / CH RTN */ + { 0x02, 0x17, KEY_PROG2 }, /* SNAP SHOT */ + { 0x02, 0x10, KEY_PROG3 }, /* 16-CH PREV */ + { 0x02, 0x03, KEY_CHANNELUP }, /* CH UP */ + { 0x02, 0x1e, KEY_VOLUMEDOWN }, /* VOL DOWN */ + { 0x02, 0x0c, KEY_ZOOM }, /* FULL SCREEN */ + { 0x02, 0x1f, KEY_VOLUMEUP }, /* VOL UP */ + { 0x02, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ + { 0x02, 0x14, KEY_MUTE }, /* MUTE */ + { 0x02, 0x08, KEY_AUDIO }, /* AUDIO */ + { 0x02, 0x19, KEY_RECORD }, /* RECORD */ + { 0x02, 0x18, KEY_PLAY }, /* PLAY */ + { 0x02, 0x1b, KEY_STOP }, /* STOP */ + { 0x02, 0x1a, KEY_PLAYPAUSE }, /* TIMESHIFT / PAUSE */ + { 0x02, 0x1d, KEY_BACK }, /* << / RED */ + { 0x02, 0x1c, KEY_FORWARD }, /* >> / YELLOW */ + { 0x02, 0x03, KEY_TEXT }, /* TELETEXT */ + { 0x02, 0x01, KEY_FIRST }, /* |<< / GREEN */ + { 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */ + { 0x02, 0x04, KEY_EPG }, /* EPG */ + { 0x02, 0x15, KEY_MENU }, /* MENU */ }; -int a800_rc_init(struct dvb_usb_device *d) -{ - int i; - for (i = 0; i < sizeof(a800_rc_keys)/sizeof(struct dvb_usb_nec_rc_key); i++) - set_bit(a800_rc_keys[i].event, d->rc_input_dev.keybit); - return 0; -} - /*1. Make a vendor request with the following parameters: * Request = 0x04 * Index = 0; @@ -57,8 +82,7 @@ int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return -ENODEV; /* call the universal NEC remote processor, to find out the key's state and event */ - dvb_usb_nec_rc_key_to_event(d,a800_rc_keys,sizeof(a800_rc_keys)/sizeof(struct dvb_usb_nec_rc_key), - key,event,state); + dvb_usb_nec_rc_key_to_event(d,key,event,state); if (key[0] != 0) deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); return 0; @@ -97,10 +121,9 @@ static struct dvb_usb_properties a800_properties = { .power_ctrl = a800_power_ctrl, .frontend_attach = dibusb_dib3000mc_frontend_attach, .tuner_attach = dibusb_dib3000mc_tuner_attach, - .read_mac_address = NULL, .rc_interval = DEFAULT_RC_INTERVAL, - .init_rc = a800_rc_init, + .rc_key_map = a800_rc_keys, .query_rc = a800_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c index 11f9128e8..d98e694bc 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -236,7 +236,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); /* * common remote control stuff */ -static struct dvb_usb_nec_rc_key dibusb_rc_keys[] = { +struct dvb_usb_rc_key dibusb_rc_keys[] = { /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ { 0x00, 0x16, KEY_POWER }, { 0x00, 0x10, KEY_MUTE }, @@ -304,23 +304,13 @@ static struct dvb_usb_nec_rc_key dibusb_rc_keys[] = { { 0x86, 0x1f, KEY_LEFT }, { 0x86, 0x1b, KEY_RIGHT }, }; - - -int dibusb_rc_init(struct dvb_usb_device *d) -{ - int i; - for (i = 0; i < sizeof(dibusb_rc_keys)/sizeof(struct dvb_usb_nec_rc_key); i++) - set_bit(dibusb_rc_keys[i].event, d->rc_input_dev.keybit); - return 0; -} -EXPORT_SYMBOL(dibusb_rc_init); +EXPORT_SYMBOL(dibusb_rc_keys); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 key[5],cmd = DIBUSB_REQ_POLL_REMOTE; dvb_usb_generic_rw(d,&cmd,1,key,5,0); - dvb_usb_nec_rc_key_to_event(d,dibusb_rc_keys,sizeof(dibusb_rc_keys)/sizeof(struct dvb_usb_nec_rc_key), - key,event,state); + dvb_usb_nec_rc_key_to_event(d,key,event,state); if (key[0] != 0) deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); return 0; diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c b/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c index 09c5cb687..42da4cb72 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -132,10 +132,9 @@ static struct dvb_usb_properties dibusb1_1_properties = { .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_dib3000mb_tuner_attach, - .read_mac_address = NULL, .rc_interval = DEFAULT_RC_INTERVAL, - .init_rc = dibusb_rc_init, + .rc_key_map = dibusb_rc_keys, .query_rc = dibusb_rc_query, .i2c_algo = &dibusb_i2c_algo, @@ -204,10 +203,9 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_dib3000mb_tuner_attach, - .read_mac_address = NULL, .rc_interval = DEFAULT_RC_INTERVAL, - .init_rc = dibusb_rc_init, + .rc_key_map = dibusb_rc_keys, .query_rc = dibusb_rc_query, .i2c_algo = &dibusb_i2c_algo, @@ -248,10 +246,9 @@ static struct dvb_usb_properties dibusb2_0b_properties = { .power_ctrl = dibusb2_0_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_dib3000mb_tuner_attach, - .read_mac_address = NULL, .rc_interval = DEFAULT_RC_INTERVAL, - .init_rc = dibusb_rc_init, + .rc_key_map = dibusb_rc_keys, .query_rc = dibusb_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c b/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c index 1754e7f60..e434029f1 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -47,10 +47,9 @@ static struct dvb_usb_properties dibusb_mc_properties = { .power_ctrl = dibusb2_0_power_ctrl, .frontend_attach = dibusb_dib3000mc_frontend_attach, .tuner_attach = dibusb_dib3000mc_tuner_attach, - .read_mac_address = NULL, .rc_interval = DEFAULT_RC_INTERVAL, - .init_rc = dibusb_rc_init, + .rc_key_map = dibusb_rc_keys, .query_rc = dibusb_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/linux/drivers/media/dvb/dvb-usb/dibusb.h b/linux/drivers/media/dvb/dvb-usb/dibusb.h index 40a36e2e5..d6871f19f 100644 --- a/linux/drivers/media/dvb/dvb-usb/dibusb.h +++ b/linux/drivers/media/dvb/dvb-usb/dibusb.h @@ -123,7 +123,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *d, int onoff); #define DEFAULT_RC_INTERVAL 150 //#define DEFAULT_RC_INTERVAL 100000 -extern int dibusb_rc_init(struct dvb_usb_device *d); +extern struct dvb_usb_rc_key dibusb_rc_keys[]; extern int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state); #endif diff --git a/linux/drivers/media/dvb/dvb-usb/digitv.c b/linux/drivers/media/dvb/dvb-usb/digitv.c index 649a5cd80..9846ed272 100644 --- a/linux/drivers/media/dvb/dvb-usb/digitv.c +++ b/linux/drivers/media/dvb/dvb-usb/digitv.c @@ -163,17 +163,13 @@ static int digitv_frontend_attach(struct dvb_usb_device *d) return -EIO; } - -static struct dvb_usb_nec_rc_key digitv_rc_keys[] = { +static struct dvb_usb_rc_key digitv_rc_keys[] = { { 0x00, 0x16, KEY_POWER }, /* dummy key */ }; -int digitv_rc_init(struct dvb_usb_device *d) +static int digitv_rc_init(struct dvb_usb_device *d) { - int i; - u8 b[4]; - for (i = 0; i < sizeof(digitv_rc_keys)/sizeof(struct dvb_usb_nec_rc_key); i++) - set_bit(digitv_rc_keys[i].event, d->rc_input_dev.keybit); + u8 b[4] = { 0 }; b[0] = 1; digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0); @@ -195,8 +191,7 @@ int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) key[0] = 0x01; /* if something is inside the buffer, simulate key press */ /* call the universal NEC remote processor, to find out the key's state and event */ - dvb_usb_nec_rc_key_to_event(d,digitv_rc_keys,sizeof(digitv_rc_keys)/sizeof(struct dvb_usb_nec_rc_key), - key,event,state); + dvb_usb_nec_rc_key_to_event(d,key,event,state); if (key[0] != 0) deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); return 0; @@ -235,7 +230,7 @@ static struct dvb_usb_properties digitv_properties = { .read_mac_address = NULL, .rc_interval = 1000, - .init_rc = digitv_rc_init, + .rc_key_map = digitv_rc_keys, .query_rc = digitv_rc_query, .identify_state = digitv_identify_state, diff --git a/linux/drivers/media/dvb/dvb-usb/dtt200u.c b/linux/drivers/media/dvb/dvb-usb/dtt200u.c index 5fcde0538..75bd054d2 100644 --- a/linux/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/linux/drivers/media/dvb/dvb-usb/dtt200u.c @@ -43,7 +43,7 @@ static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int /* remote control */ /* key list for the tiny remote control (Yakumo, don't know about the others) */ -static struct dvb_usb_nec_rc_key dtt200u_rc_keys[] = { +static struct dvb_usb_rc_key dtt200u_rc_keys[] = { { 0x80, 0x01, KEY_MUTE }, { 0x80, 0x02, KEY_CHANNELDOWN }, { 0x80, 0x03, KEY_VOLUMEDOWN }, @@ -64,20 +64,11 @@ static struct dvb_usb_nec_rc_key dtt200u_rc_keys[] = { { 0x80, 0x1f, KEY_9 }, }; -static int dtt200u_rc_init(struct dvb_usb_device *d) -{ - int i; - for (i = 0; i < sizeof(dtt200u_rc_keys)/sizeof(struct dvb_usb_nec_rc_key); i++) - set_bit(dtt200u_rc_keys[i].event, d->rc_input_dev.keybit); - return 0; -} - static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 key[5],cmd = GET_RC_KEY; dvb_usb_generic_rw(d,&cmd,1,key,5,0); - dvb_usb_nec_rc_key_to_event(d,dtt200u_rc_keys,sizeof(dtt200u_rc_keys)/sizeof(struct dvb_usb_nec_rc_key), - key,event,state); + dvb_usb_nec_rc_key_to_event(d,key,event,state); if (key[0] != 0) deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); return 0; @@ -113,13 +104,11 @@ static struct dvb_usb_properties dtt200u_properties = { .streaming_ctrl = dtt200u_streaming_ctrl, .pid_filter = dtt200u_pid_filter, - .pid_filter_ctrl = NULL, - .power_ctrl = NULL, .frontend_attach = dtt200u_frontend_attach, .rc_interval = 200, + .rc_key_map = dtt200u_rc_keys, .query_rc = dtt200u_rc_query, - .init_rc = dtt200u_rc_init, .generic_bulk_ctrl_endpoint = 0x01, @@ -177,5 +166,5 @@ module_exit(dtt200u_usb_module_exit); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for the Yakumo/Hama/Typhoon DVB-T USB2.0 device"); -MODULE_VERSION("0.2"); +MODULE_VERSION("1.0"); MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index e1db0352e..b3c65224f 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -82,7 +82,8 @@ schedule: int dvb_usb_remote_init(struct dvb_usb_device *d) { - if (d->props.query_rc == NULL) + int i; + if (d->props.rc_key_map == NULL) return 0; /* Initialise the remote-control structures.*/ @@ -94,7 +95,8 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) d->rc_input_dev.name = "Remote control inside an USB DVB receiver"; /* set the bits for the keys */ - d->props.init_rc(d); + for (i = 0; i < sizeof(d->props.rc_key_map)/sizeof(struct dvb_usb_rc_key); i++) + set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); /* Start the remote-control polling. */ if (d->props.rc_interval < 40) @@ -130,11 +132,11 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d) #define DVB_USB_RC_NEC_EMPTY 0x00 #define DVB_USB_RC_NEC_KEY_PRESSED 0x01 #define DVB_USB_RC_NEC_KEY_REPEATED 0x02 -int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, struct - dvb_usb_nec_rc_key keymap[],int key_count, u8 keybuf[5], u32 *event, - int *state) +int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, + u8 keybuf[5], u32 *event, int *state) { int i; + struct dvb_usb_rc_key *keymap = d->props.rc_key_map; *event = 0; *state = REMOTE_NO_KEY_PRESSED; switch (keybuf[0]) { @@ -147,7 +149,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, struct break; } /* See if we can match the raw key code. */ - for (i = 0; i < key_count; i++) + for (i = 0; i < sizeof(keymap)/sizeof(struct dvb_usb_rc_key); i++) if (keymap[i].custom == keybuf[1] && keymap[i].data == keybuf[3]) { *event = keymap[i].event; diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h index e5ae34fe5..ae779b659 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -58,6 +58,11 @@ struct dvb_usb_device_description { struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */ }; +struct dvb_usb_rc_key { + u8 custom,data; + u32 event; +}; + struct dvb_usb_device; /* properties of an dvb-usb-device */ @@ -93,10 +98,11 @@ struct dvb_usb_properties { /* if the state (cold or warm) is not distinguishable by the USB IDs, * the dvb-usb-device has to provie this callback to determine it*/ +/* remote control properties */ #define REMOTE_NO_KEY_PRESSED 0x00 #define REMOTE_KEY_PRESSED 0x01 #define REMOTE_KEY_REPEAT 0x02 - int (*init_rc) (struct dvb_usb_device *); /* remote query callback - NULL no ir-receiver */ + struct dvb_usb_rc_key *rc_key_map; int (*query_rc) (struct dvb_usb_device *, u32 *, int *); /* remote query callback - NULL no ir-receiver */ int rc_interval; @@ -190,11 +196,6 @@ extern int dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16,int) extern int dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16); /* common used remote control parsing */ -struct dvb_usb_nec_rc_key { - u8 custom,data; - u32 event; -}; - -extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, struct dvb_usb_nec_rc_key[],int, u8[], u32 *, int *); +extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); #endif 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, diff --git a/linux/drivers/media/dvb/dvb-usb/umt-010.c b/linux/drivers/media/dvb/dvb-usb/umt-010.c index 6fae66eaa..55bd34c29 100644 --- a/linux/drivers/media/dvb/dvb-usb/umt-010.c +++ b/linux/drivers/media/dvb/dvb-usb/umt-010.c @@ -100,15 +100,9 @@ static struct dvb_usb_properties umt_properties = { .size_of_priv = sizeof(struct dibusb_state), .streaming_ctrl = dibusb2_0_streaming_ctrl, - .pid_filter = NULL, - .pid_filter_ctrl = NULL, .power_ctrl = dibusb_power_ctrl, .frontend_attach = umt_mt352_frontend_attach, .tuner_attach = umt_tuner_attach, - .read_mac_address = NULL, - - .init_rc = NULL, - .query_rc = NULL, .i2c_algo = &dibusb_i2c_algo, diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045.c b/linux/drivers/media/dvb/dvb-usb/vp7045.c index b603f1e43..e385bdbc0 100644 --- a/linux/drivers/media/dvb/dvb-usb/vp7045.c +++ b/linux/drivers/media/dvb/dvb-usb/vp7045.c @@ -93,29 +93,16 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) /* The keymapping struct. Somehow this should be loaded to the driver, but * currently it is hardcoded. */ -struct { - u8 raw; - u32 key; -} vp7045_rc_key_mapping[] = { - +static struct dvb_usb_rc_key vp7045_rc_keys[] = { /* insert the keys like this. to make the raw keys visible, enable * debug=0x04 when loading dvb-usb-vp7045. */ /* these keys are probably wrong. I don't have a working IR-receiver on my * vp7045, so I can't test it. Patches are welcome. */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, + { 0x00, 0x01, KEY_1 }, + { 0x00, 0x02, KEY_2 }, }; -static int vp7045_rc_init(struct dvb_usb_device *d) -{ - int i; - for (i = 0; i < sizeof(vp7045_rc_key_mapping)/sizeof(vp7045_rc_key_mapping[0]); i++) - set_bit(vp7045_rc_key_mapping[i].key, d->rc_input_dev.keybit); - - return 0; -} - static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) { u8 key; @@ -129,10 +116,10 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) return 0; } - for (i = 0; i < sizeof(vp7045_rc_key_mapping)/sizeof(vp7045_rc_key_mapping); i++) - if (vp7045_rc_key_mapping[i].raw == key) { + for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) + if (vp7045_rc_keys[i].data == key) { *state = REMOTE_KEY_PRESSED; - *key_buf = vp7045_rc_key_mapping[i].key; + *key_buf = vp7045_rc_keys[i].event; break; } return 0; @@ -205,15 +192,12 @@ static struct dvb_usb_properties vp7045_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-vp7045-01.fw", - .streaming_ctrl = NULL, - .pid_filter = NULL, - .pid_filter_ctrl = NULL, .power_ctrl = vp7045_power_ctrl, .frontend_attach = vp7045_frontend_attach, .read_mac_address = vp7045_read_mac_addr, .rc_interval = 400, - .init_rc = vp7045_rc_init, + .rc_key_map = vp7045_rc_keys, .query_rc = vp7045_rc_query, /* parameter for the MPEG2-data transfer */ |