From patchwork Mon Aug 13 22:11:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vojtech Bocek X-Patchwork-Id: 1316671 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6EC84DF25A for ; Mon, 13 Aug 2012 22:12:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754753Ab2HMWMj (ORCPT ); Mon, 13 Aug 2012 18:12:39 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35533 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753898Ab2HMWMh (ORCPT ); Mon, 13 Aug 2012 18:12:37 -0400 Received: by wibhr14 with SMTP id hr14so3945678wib.1 for ; Mon, 13 Aug 2012 15:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=abKbTE1etb+j1vt2cPKXHLadYWYLpRl4WHOY/n5MqLM=; b=DotQCcsqhntDGd4IxWhxtSgTc0jdZgyNIFTCVIX3PInpCrqYBaeZOCJ48ZMizdZ2yx lS1UCGUa+pkcNBJ3nRg4o87pWBhHULgVpLoJOj3Pis7C/cE21X0dT/WR2bCdxQd98GpQ VUc35UEMz3aE5PrATYHNVVSCNxkL7KoR4Lx82b9YnST8yA6Q030a17XQz6BglA2VnKEy CAKu24ePkllWX9rt9D9bIvO5iKmnYzQu/BL03EFVJcj82elliTqOO3WzRpRKKnqwdQPc dzK6Ns2UGRKAJP1P6u4ZF2gOcIh/cTMRYq6GAVV2s1a5EC6/cQRGTgj6Q2d+ooHHhIRu 8JXQ== Received: by 10.180.78.135 with SMTP id b7mr21941921wix.11.1344895955704; Mon, 13 Aug 2012 15:12:35 -0700 (PDT) Received: from nymeria.cust.nbox.cz (ip4-83-240-110-90.cust.nbox.cz. [83.240.110.90]) by mx.google.com with ESMTPS id h9sm18867632wiz.1.2012.08.13.15.12.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 15:12:34 -0700 (PDT) From: Vojtech Bocek To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Vojtech Bocek Subject: [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event Date: Tue, 14 Aug 2012 00:11:54 +0200 Message-Id: <1344895914-32127-1-git-send-email-vbocek@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Initial input event has not yet arrived in joydev_connect() where values are set, which means default values of input_absinfo are used for init event, not the actual values from joystick. Signed-off-by: Vojtech Bocek --- drivers/input/joydev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 26043cc..11f24b4 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -318,9 +318,14 @@ static int joydev_generate_startup_event(struct joydev_client *client, event->value = !!test_bit(joydev->keypam[event->number], input->key); } else { + int evnum = client->startup - joydev->nkey; + int val = input_abs_get_val(input, joydev->abspam[evnum]); + + joydev->abs[evnum] = joydev_correct(val, &joydev->corr[evnum]); + event->type = JS_EVENT_AXIS | JS_EVENT_INIT; - event->number = client->startup - joydev->nkey; - event->value = joydev->abs[event->number]; + event->number = evnum; + event->value = joydev->abs[evnum]; } client->startup++; }