From patchwork Thu Jun 23 17:58:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 7317 Return-path: Envelope-to: mchehab@pedra Delivery-date: Thu, 23 Jun 2011 22:15:50 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QZuzt-0000q1-NN for mchehab@pedra; Thu, 23 Jun 2011 22:15:49 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 23 Jun 2011 22:15:49 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QZoDt-00034r-TI; Thu, 23 Jun 2011 18:01:50 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933600Ab1FWR6g (ORCPT + 1 other); Thu, 23 Jun 2011 13:58:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933160Ab1FWR6e (ORCPT ); Thu, 23 Jun 2011 13:58:34 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5NHwSD0012354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Jun 2011 13:58:28 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5NHwRra015398; Thu, 23 Jun 2011 13:58:27 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson , Mauro Carvalho Chehab , Jeff Brown , Dmitry Torokhov Subject: [PATCH] [media] rc: call input_sync after scancode reports Date: Thu, 23 Jun 2011 13:58:06 -0400 Message-Id: <1308851886-4607-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Due to commit cdda911c34006f1089f3c87b1a1f31ab3a4722f2, evdev only becomes readable when the buffer contains an EV_SYN/SYN_REPORT event. If we get a repeat or a scancode we don't have a mapping for, we never call input_sync, and thus those events don't get reported in a timely fashion. For example, take an mceusb transceiver with a default rc6 keymap. Press buttons on an rc5 remote while monitoring with ir-keytable, and you'll see nothing. Now press a button on the rc6 remote matching the keymap. You'll suddenly get the rc5 key scancodes, the rc6 scancode and the rc6 key spit out all at the same time. Pressing and holding a button on a remote we do have a keymap for also works rather unreliably right now, due to repeat events also happening without a call to input_sync (we bail from ir_do_keydown before getting to the point where it calls input_sync). Easy fix though, just add two strategically placed input_sync calls right after our input_event calls for EV_MSC, and all is well again. Technically, we probably should have been doing this all along, its just that it never caused any function difference until the referenced change went into the input layer. Reported-by: Stephan Raue CC: Mauro Carvalho Chehab CC: Jeff Brown CC: Dmitry Torokhov Signed-off-by: Jarod Wilson --- drivers/media/rc/rc-main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f57cd56..c25c243 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -597,6 +597,7 @@ void rc_repeat(struct rc_dev *dev) spin_lock_irqsave(&dev->keylock, flags); input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode); + input_sync(dev->input_dev); if (!dev->keypressed) goto out; @@ -623,6 +624,7 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, u32 keycode, u8 toggle) { input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); + input_sync(dev->input_dev); /* Repeat event? */ if (dev->keypressed &&