diff options
author | Patrick Boettcher <devnull@localhost> | 2005-02-19 19:07:15 +0000 |
---|---|---|
committer | Patrick Boettcher <devnull@localhost> | 2005-02-19 19:07:15 +0000 |
commit | fb04b1e717d9cc37f23f37a5b3544a564494c83f (patch) | |
tree | 17c96175491802997210dcdcb50bcd40f7483e1e /linux/drivers/media/dvb | |
parent | 04b0f4bfbebfbbb8d899e0e329215651f8b2e62c (diff) | |
download | mediapointer-dvb-s2-fb04b1e717d9cc37f23f37a5b3544a564494c83f.tar.gz mediapointer-dvb-s2-fb04b1e717d9cc37f23f37a5b3544a564494c83f.tar.bz2 |
- corrected some rc keys
- added a key repeat mechanism
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c | 9 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dibusb/dvb-dibusb-remote.c | 55 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dibusb/dvb-dibusb.h | 4 |
3 files changed, 47 insertions, 21 deletions
diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c b/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c index 9e0d3e6e4..a6d1f1bfb 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c @@ -41,10 +41,14 @@ static int pid_parse; module_param(pid_parse, int, 0644); MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0"); -static int rc_query_interval; +static int rc_query_interval = 100; module_param(rc_query_interval, int, 0644); MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)"); +static int rc_key_repeat_count = 2; +module_param(rc_key_repeat_count, int, 0644); +MODULE_PARM_DESC(rc_key_repeat_count, "how many key repeats will be dropped before passing the key event again (default: 2)"); + /* Vendor IDs */ #define USB_VID_ADSTECH 0x06e1 #define USB_VID_ANCHOR 0x0547 @@ -224,7 +228,7 @@ static struct dibusb_device_class dibusb_device_classes[] = { { DIBUSB2_0,&dibusb_usb_ctrl[2], "dvb-dibusb-6.0.0.5.fw", 0x01, 0x06, - 3, 188*210, + 7, 4096, DIBUSB_RC_NEC_PROTOCOL, &dibusb_demod[DIBUSB_DIB3000MC], &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5], @@ -482,6 +486,7 @@ static int dibusb_probe(struct usb_interface *intf, /* store parameters to structures */ dib->rc_query_interval = rc_query_interval; dib->pid_parse = pid_parse; + dib->rc_key_repeat_count = rc_key_repeat_count; usb_set_intfdata(intf, dib); diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb-remote.c b/linux/drivers/media/dvb/dibusb/dvb-dibusb-remote.c index 8baaef1c7..cdc4067e3 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb-remote.c +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb-remote.c @@ -90,7 +90,7 @@ static const struct { u16 raw; uint32_t key; } haupp_rc_keys [] = { { 0xce7, KEY_TV }, { 0xcc7, KEY_VIDEO }, { 0xccf, KEY_AUDIO }, - { 0x32f, KEY_MEDIA }, + { 0xcd7, KEY_MEDIA }, { 0xcdf, KEY_EPG }, { 0xca7, KEY_UP }, { 0xc67, KEY_RADIO }, @@ -99,7 +99,7 @@ static const struct { u16 raw; uint32_t key; } haupp_rc_keys [] = { { 0xcbf, KEY_RIGHT }, { 0xcff, KEY_BACK }, { 0xcaf, KEY_DOWN }, - { 0xc67, KEY_MENU }, + { 0xc6f, KEY_MENU }, { 0xc87, KEY_VOLUMEUP }, { 0xc8f, KEY_VOLUMEDOWN }, { 0xc97, KEY_CHANNEL }, @@ -151,39 +151,46 @@ static int dibusb_key2event_nec(struct usb_dibusb *dib,u8 rb[5]) if (nec_rc_keys[i].c0 == rb[1] && nec_rc_keys[i].c1 == rb[2] && nec_rc_keys[i].c2 == rb[3]) { - return nec_rc_keys[i].key; + + dib->last_event = nec_rc_keys[i].key; + return 1; } } break; case DIBUSB_RC_NEC_KEY_REPEATED: /* rb[1]..rb[4] are always zero.*/ /* Repeats often seem to occur so for the moment just ignore this. */ - deb_rc("Key repeat\n"); - break; + return 0; case DIBUSB_RC_NEC_EMPTY: /* No (more) remote control keys. */ default: break; } - return 0; + return -1; } static int dibusb_key2event_hauppauge(struct usb_dibusb *dib,u8 rb[4]) { u16 raw; - int i; + int i,state; switch (rb[0]) { case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: raw = ((rb[1] & 0x0f) << 8) | rb[2]; - -/* if (rb[1] & 0x40) - deb_rc("first key press\n"); - else - deb_rc("key repeat\n");*/ - deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %04x\n",rb[1],rb[2],rb[3],raw); + state = !!(rb[1] & 0x40); + + deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %04x state: %d\n",rb[1],rb[2],rb[3],raw,state); for (i = 0; i < sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) { - if (haupp_rc_keys[i].raw == raw) - return haupp_rc_keys[i].key; + if (haupp_rc_keys[i].raw == raw) { + if (dib->last_event == haupp_rc_keys[i].key && + dib->last_state == state) { + deb_rc("key repeat\n"); + return 0; + } else { + dib->last_event = haupp_rc_keys[i].key; + dib->last_state = state; + return 1; + } + } } break; @@ -191,7 +198,7 @@ static int dibusb_key2event_hauppauge(struct usb_dibusb *dib,u8 rb[4]) default: break; } - return 0; + return -1; } /* @@ -216,13 +223,23 @@ static int dibusb_read_remote_control(struct usb_dibusb *dib) break; } - if (event > 0) { + /* key repeat */ + if (event == 0) + if (++dib->repeat_key_count < dib->rc_key_repeat_count) { + deb_rc("key repeat dropped. (%d)\n",dib->repeat_key_count); + event = -1; /* skip this key repeat */ + } + + if (event == 1 || event == 0) { deb_rc("Translated key 0x%04x\n",event); /* Signal down and up events for this key. */ - input_report_key(&dib->rc_input_dev, event, 1); - input_report_key(&dib->rc_input_dev, event, 0); + input_report_key(&dib->rc_input_dev, dib->last_event, 1); + input_report_key(&dib->rc_input_dev, dib->last_event, 0); input_sync(&dib->rc_input_dev); + + if (event == 1) + dib->repeat_key_count = 0; } return 0; } diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h index 8c01bc785..6ccdc3fe3 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h @@ -190,6 +190,10 @@ struct usb_dibusb { /* remote control */ struct input_dev rc_input_dev; struct work_struct rc_query_work; + int last_event; + int last_state; /* for Hauppauge RC protocol */ + int repeat_key_count; + int rc_key_repeat_count; /* module parameter */ /* module parameters */ int pid_parse; |