All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input,
@ 2005-12-09 14:16 Mauro Carvalho Chehab
  2005-12-09 15:22 ` Dmitry Torokhov
  2005-12-09 19:24 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2005-12-09 14:16 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, mchehab, js, akpm, linux-dvb-maintainer,
	Oliver Endriss, Mauro Carvalho Chehab

From: Noone Important <nxhxzi702 at sneakemail.com>

- Adds a time-delay to IR remote button presses for av7110_ir input,
such that it acts more like a keyboard. A short press will be treated
as a single button press. Holding down a button on the remote will
respond like holding down a key on the keyboard, and result in a
key-repeat. This just introduces a delay between the 1st press, and
going into key-repeat so that it is possible to get a single 'up'.

Signed-off-by: Noone Important <nxhxzi702 at sneakemail.com>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>

---

 drivers/media/dvb/ttpci/av7110_ir.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

--- git.orig/drivers/media/dvb/ttpci/av7110_ir.c
+++ git/drivers/media/dvb/ttpci/av7110_ir.c
@@ -17,6 +17,8 @@ static int av_cnt;
 static struct av7110 *av_list[4];
 static struct input_dev *input_dev;
 
+static u8 delay_timer_finished;
+
 static u16 key_map [256] = {
 	KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7,
 	KEY_8, KEY_9, KEY_BACK, 0, KEY_POWER, KEY_MUTE, 0, KEY_INFO,
@@ -112,13 +114,16 @@ static void av7110_emit_key(unsigned lon
 	if (timer_pending(&keyup_timer)) {
 		del_timer(&keyup_timer);
 		if (keyup_timer.data != keycode || new_toggle != old_toggle) {
+			delay_timer_finished = 0;
 			input_event(input_dev, EV_KEY, keyup_timer.data, !!0);
 			input_event(input_dev, EV_KEY, keycode, !0);
 		} else
-			input_event(input_dev, EV_KEY, keycode, 2);
-
-	} else
+			if (delay_timer_finished)
+				input_event(input_dev, EV_KEY, keycode, 2);
+	} else {
+		delay_timer_finished = 0;
 		input_event(input_dev, EV_KEY, keycode, !0);
+	}
 
 	keyup_timer.expires = jiffies + UP_TIMEOUT;
 	keyup_timer.data = keycode;
@@ -145,7 +150,8 @@ static void input_register_keys(void)
 
 static void input_repeat_key(unsigned long data)
 {
-       /* dummy routine to disable autorepeat in the input driver */
+	/* called by the input driver after rep[REP_DELAY] ms */
+	delay_timer_finished = 1;
 }
 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input,
  2005-12-09 14:16 [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input, Mauro Carvalho Chehab
@ 2005-12-09 15:22 ` Dmitry Torokhov
  2005-12-09 17:24   ` Johannes Stezenbach
  2005-12-09 19:24 ` Andrew Morton
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2005-12-09 15:22 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: akpm, linux-kernel, mchehab, js, linux-dvb-maintainer,
	Oliver Endriss

On 12/9/05, Mauro Carvalho Chehab <mchehab@brturbo.com.br> wrote:
>  static void input_repeat_key(unsigned long data)
>  {
> -       /* dummy routine to disable autorepeat in the input driver */
> +       /* called by the input driver after rep[REP_DELAY] ms */
> +       delay_timer_finished = 1;
>  }
>

Hi,

I always wondered why many IR drivers re-implement autorepeat code
instead of using autorepeat in the inptu core. Is it because of forced
(by timer) keyup events?

--
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input,
  2005-12-09 15:22 ` Dmitry Torokhov
@ 2005-12-09 17:24   ` Johannes Stezenbach
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Stezenbach @ 2005-12-09 17:24 UTC (permalink / raw)
  To: dtor_core
  Cc: Mauro Carvalho Chehab, akpm, linux-kernel, mchehab,
	linux-dvb-maintainer, Oliver Endriss

On Fri, Dec 09, 2005, Dmitry Torokhov wrote:
> On 12/9/05, Mauro Carvalho Chehab <mchehab@brturbo.com.br> wrote:
> >  static void input_repeat_key(unsigned long data)
> >  {
> > -       /* dummy routine to disable autorepeat in the input driver */
> > +       /* called by the input driver after rep[REP_DELAY] ms */
> > +       delay_timer_finished = 1;
> >  }
> 
> I always wondered why many IR drivers re-implement autorepeat code
> instead of using autorepeat in the inptu core. Is it because of forced
> (by timer) keyup events?

Remote controls don't generate key-up events (think what would
happen if you press a button and then someone walks in between
while you release the key). Instead they generate key-down
and repeated key-still-down events. The repeat rate generated
by remote controls varies roughly between 100...300 msecs and
even depends on battery level for many remotes.

If you use a timer to simulate key-up after you received no
key-still-down for some time, and use input core autorepeat,
then you get this annoying effect that input core generates
key repeats after you released the key on the remote control.


Johannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input,
  2005-12-09 14:16 [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input, Mauro Carvalho Chehab
  2005-12-09 15:22 ` Dmitry Torokhov
@ 2005-12-09 19:24 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2005-12-09 19:24 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Noone Important
  Cc: linux-kernel, mchehab, js, linux-dvb-maintainer, o.endriss,
	mchehab

Mauro Carvalho Chehab <mchehab@brturbo.com.br> wrote:
>
> Signed-off-by: Noone Important <nxhxzi702 at sneakemail.com>
>

Anonymous contributions rather defeat the purpose of signing off patches. 
I'm OK with it for small patches like this, but I'd be reluctant to accept
a more subsantial piece of work on such a basis.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-09 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 14:16 [PATCH 29/56] DVB (2390) Adds a time-delay to IR remote button presses for av7110 ir input, Mauro Carvalho Chehab
2005-12-09 15:22 ` Dmitry Torokhov
2005-12-09 17:24   ` Johannes Stezenbach
2005-12-09 19:24 ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.