Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: cinergyT2 remote, repeat handling, keycodes



On Montag, 20. Dezember 2004 10:28, Holger Waechtler wrote:

> Better choose a "no event in 3 times the repeat rate" as 
> key-up condition. The repeat rate for the NEC protocol is (according to 
> http://www.vishay.com/docs/80071/80071.pdf) is about 108ms.
> 

So I took the other approach. As the signal is about 67.5ms I selected a query
intervall of 70ms and allow one interval without signals. So that makes me happy
see attached diff.

One remark to evtest:
pressing PLAY key reports "Next" and
pressing NEXT key reports "Digits" 
;-) .


stefan lucke
? cinergyT2.c.test01
? cinergy_key_repeat_handling-02.diff
? cinergy_key_repeat_handling-03.diff
? cinergy_key_repeat_handling.diff
? event_fake.diff
? loop.diff
Index: cinergyT2.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/cinergyT2/cinergyT2.c,v
retrieving revision 1.15.2.5
diff -r1.15.2.5 cinergyT2.c
50c50
< 	#define RC_QUERY_INTERVAL (100)	/* milliseconds */
---
> 	#define RC_QUERY_INTERVAL (70)	/* milliseconds */
188a189
> 	int rc_key_state;
763c764
< printk("got key (type %d, value 0x%08x\n", rc_events[n].type, rc_events[n].value);
---
> printk("got key n=%d (type %d, value 0x%08x)\n", n, rc_events[n].type, rc_events[n].value);
774a776,782
> 
> 			/**
> 			 * Ignore repeat events. input system handles these.
> 			 * Reset our key_state to 'keypressed'
> 			 */
> 			cinergyt2->rc_key_state = 1;
> 			continue;
787a796,802
> 			/**
> 			 * new keypress: so report key release, if already pressed.
> 			 * remember state 'keypressed'
> 			 */
> 			if (cinergyt2->rc_key_state)
> 				input_report_key(&cinergyt2->rc_input_dev, cinergyt2->rc_input_event, 0);
> 
789c804
< 			input_report_key(&cinergyt2->rc_input_dev, cinergyt2->rc_input_event, 0);
---
> 			cinergyt2->rc_key_state = 1;
793a809,822
> 	/**
> 	 * no key was pressed in this intervall, but key press was previously set
> 	 * so report 'keyrelease' if there was at least one query with no
> 	 * key event send (rc_key_state == 2).
> 	 */
> 	if (!len && cinergyt2->rc_key_state) {
> 		if (cinergyt2->rc_key_state == 1) {
> 			cinergyt2->rc_key_state = 2;
> 		} else {
> 			input_report_key(&cinergyt2->rc_input_dev, cinergyt2->rc_input_event, 0);
> 			cinergyt2->rc_key_state = 0;
> 			input_sync(&cinergyt2->rc_input_dev);
> 		}
> 	}
895c924,927
< 	cinergyt2->rc_input_dev.evbit[0] = BIT(EV_KEY);
---
> 	/**
> 	 * let the input system handle keyrepeat
> 	 */
> 	cinergyt2->rc_input_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
905a938
> 	cinergyt2->rc_key_state = 0;

Home | Main Index | Thread Index