linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vojtech Bocek <vbocek@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Vojtech Bocek <vbocek@gmail.com>
Subject: [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event
Date: Tue, 14 Aug 2012 00:11:54 +0200	[thread overview]
Message-ID: <1344895914-32127-1-git-send-email-vbocek@gmail.com> (raw)

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 <vbocek@gmail.com>
---
 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++;
 	}
-- 
1.7.10.4


             reply	other threads:[~2012-08-13 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 22:11 Vojtech Bocek [this message]
2012-09-05  5:52 ` [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event Dmitry Torokhov
2012-09-05 20:09   ` Vojtěch Boček
2012-09-13  4:52     ` Dmitry Torokhov
2012-09-13 10:55       ` Vojtech Bocek
2012-11-01 16:47         ` Vojtech Bocek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344895914-32127-1-git-send-email-vbocek@gmail.com \
    --to=vbocek@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).