From c0cae3784a6535760fce053bb1df01caf6ea69cb Mon Sep 17 00:00:00 2001 From: Patrik Dufresne Date: Sun, 29 Jun 2014 16:52:43 -0400 Subject: [PATCH] Ignore diagonals for iMON PAD in keyboard mode For user with an iMON PAD Remote control, the keyboard mode is very touchy and almost useless with XBMC. Event with stabilized() algorithm the behaviour is unexpected. To make it less touchy, I make it ignore any value too close to the diagonals. --- drivers/media/rc/imon.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 6f24e77b1488aa..49f1c3e1329c08 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1406,6 +1406,17 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) buf[3] = (dir >> 8) & 0xFF; scancode = be32_to_cpu(*((u32 *)buf)); } else { + /* + * For users without stabilized, just ignore any value getting + * to close to the diagonal. + */ + if ((abs(rel_y) < 2 && abs(rel_x) < 2) || + abs(abs(rel_y) - abs(rel_x)) < 2 ) { + spin_lock_irqsave(&ictx->kc_lock, flags); + ictx->kc = KEY_UNKNOWN; + spin_unlock_irqrestore(&ictx->kc_lock, flags); + return; + } /* * Hack alert: instead of using keycodes, we have * to use hard-coded scancodes here...