From patchwork Thu Nov 1 16:47:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vojtech Bocek X-Patchwork-Id: 1685501 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5FF793FE1F for ; Thu, 1 Nov 2012 16:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932447Ab2KAQrK (ORCPT ); Thu, 1 Nov 2012 12:47:10 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:40767 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934991Ab2KAQrH (ORCPT ); Thu, 1 Nov 2012 12:47:07 -0400 Received: by mail-ie0-f174.google.com with SMTP id k13so3837852iea.19 for ; Thu, 01 Nov 2012 09:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=AfOZ7PFXfOCrs2a5g1zNAosJwFSGTWml9V5AxGea+vc=; b=t9j7b9gR4Tm2mUIYaMw59JM1ELHUGOFgFIRIxgqxlAFTT0w1rRZAVI7Y3rjuHiS7wb 2goT3K011fxJjEw5TOpr0/4ZYlv9xYGQ1p9h/lWCJq6I9czKzRg0VfgAMsbRWVla7fdy Z9DLulk3PggQKNUtQZjQbyw/etW9vOGTkcdzplyIyqdUZjrYEWJbdUDzYGeePsJn4AFR Idd9Laa/RoAmlSfK/Bmt+UzmbNg0DFjNkMwcpnWf1SVxXs6dX6QZkwUOSJh8BRgyndpn q54MlFGq8qyZQQMBtPh1smis5NgiLoO8xyspUaRL+g3rW06G0CT9XRmNeiDnsII0X4hc y4bQ== MIME-Version: 1.0 Received: by 10.50.0.203 with SMTP id 11mr1843498igg.69.1351788427209; Thu, 01 Nov 2012 09:47:07 -0700 (PDT) Received: by 10.64.14.228 with HTTP; Thu, 1 Nov 2012 09:47:07 -0700 (PDT) In-Reply-To: References: <1344895914-32127-1-git-send-email-vbocek@gmail.com> <20120905055218.GA24715@core.coreip.homeip.net> <20120913045206.GB17105@core.coreip.homeip.net> Date: Thu, 1 Nov 2012 17:47:07 +0100 Message-ID: Subject: Re: [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event From: Vojtech Bocek To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Hi, sorry for the impatience, but it's been nearly two months since your last response, and I, trying to send patch to Linux for the first time, simply don't know if should I just wait more or not. Is the patch wrong/ugly, or are you simply too busy? Patch for current linux-next attached. ===================== From be5bbc627e5c8ccfea240deef6a68b10f7f1ff40 Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Thu, 1 Nov 2012 17:34:34 +0100 Subject: [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event Initial input ABS events can't reach joydev because it is not opened yet. This patch makes joydev reload ABS values on joydev_open_device. Signed-off-by: Vojtech Bocek --- drivers/input/joydev.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f362883..f53a7b1 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -156,6 +156,18 @@ static void joydev_event(struct input_handle *handle, wake_up_interruptible(&joydev->wait); } +/* joydev must be locked */ +static void joydev_reload_abs(struct joydev *joydev) +{ + int i, abs; + struct input_dev *input = joydev->handle.dev; + + for (i = 0; i < joydev->nabs; ++i) { + abs = input_abs_get_val(input, joydev->abspam[i]); + joydev->abs[i] = joydev_correct(abs, &joydev->corr[i]); + } +} + static int joydev_fasync(int fd, struct file *file, int on) { struct joydev_client *client = file->private_data; @@ -200,7 +212,9 @@ static int joydev_open_device(struct joydev *joydev) retval = -ENODEV; else if (!joydev->open++) { retval = input_open_device(&joydev->handle); - if (retval) + if (!retval) + joydev_reload_abs(joydev); + else joydev->open--; }