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
Subject: Re: [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event
Date: Thu, 1 Nov 2012 17:47:07 +0100	[thread overview]
Message-ID: <CAOeGmboymjw=s5Z4DbgC8EzcYoDVeJqxvAqyy40f57AVYSMZ6g@mail.gmail.com> (raw)
In-Reply-To: <CAOeGmbp9MYNnXn0RYdsR4cLSV-3KhDjVzRQnL0mKTrQG1_j9GQ@mail.gmail.com>

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

-- 
1.7.10.4

      reply	other threads:[~2012-11-01 16:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 22:11 [PATCH 1/1] Input: joydev - fix axes values sent in initial js_event Vojtech Bocek
2012-09-05  5:52 ` 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 [this message]

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='CAOeGmboymjw=s5Z4DbgC8EzcYoDVeJqxvAqyy40f57AVYSMZ6g@mail.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).