linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@gmail.com>
To: linux-input@vger.kernel.org
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Dmitry Torokhov <dtor@google.com>,
	David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH RESEND 3/5] Input: uinput - add UI_GET_VERSION ioctl
Date: Sat, 19 Jul 2014 15:10:43 +0200	[thread overview]
Message-ID: <1405775445-4454-4-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1405775445-4454-1-git-send-email-dh.herrmann@gmail.com>

This ioctl is the counterpart to EVIOCGVERSION and returns the
uinput-version the kernel was compiled with.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/input/misc/uinput.c | 6 ++++++
 include/uapi/linux/uinput.h | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 615324c..a2a3895 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -722,6 +722,12 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
 	}
 
 	switch (cmd) {
+		case UI_GET_VERSION:
+			if (put_user(UINPUT_VERSION,
+				     (unsigned int __user*)p))
+				retval = -EFAULT;
+			goto out;
+
 		case UI_DEV_CREATE:
 			retval = uinput_create_device(udev);
 			goto out;
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index 0389b48..19339cf 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -84,6 +84,15 @@ struct uinput_ff_erase {
  */
 #define UI_GET_SYSNAME(len)	_IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
 
+/**
+ * UI_GET_VERSION - Return uinput version of the kernel
+ *
+ * This writes the kernel's uinput version into the integer pointed to by the
+ * ioctl argument. The uinput-version is hard-coded in the kernel and
+ * independent of the uinput device.
+ */
+#define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 301, unsigned int)
+
 /*
  * To write a force-feedback-capable driver, the upload_effect
  * and erase_effect callbacks in input_dev must be implemented.
-- 
2.0.2


  parent reply	other threads:[~2014-07-19 13:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 13:10 [PATCH RESEND 0/5] Evdev Extensions David Herrmann
2014-07-19 13:10 ` [PATCH RESEND 1/5] Input: evdev - add event-mask API David Herrmann
2014-07-19 13:10 ` [PATCH RESEND 2/5] Input: uinput - uinput_validate_absbits() cleanup David Herrmann
2014-07-21  0:34   ` Dmitry Torokhov
2014-07-19 13:10 ` David Herrmann [this message]
2014-07-21  0:34   ` [PATCH RESEND 3/5] Input: uinput - add UI_GET_VERSION ioctl Dmitry Torokhov
2014-07-19 13:10 ` [PATCH RESEND 4/5] Input: uinput - add new UINPUT_DEV_SETUP ioctl David Herrmann
2014-07-21  1:01   ` Dmitry Torokhov
2014-07-21  6:22     ` David Herrmann
2014-07-21 20:11       ` Dmitry Torokhov
2014-07-21 21:08         ` David Herrmann
2014-07-19 13:10 ` [RFC RESEND 5/5] Input: evdev - add new EVIOCGABSRANGE ioctl David Herrmann
2014-08-06  1:35   ` Peter Hutterer
2014-08-08 13:26     ` David Herrmann
2014-08-08 17:47       ` Dmitry Torokhov
2014-08-10 15:21         ` David Herrmann
2014-08-10 23:17           ` Peter Hutterer
2014-08-11  0:01             ` Dmitry Torokhov
2014-08-11  2:13               ` Peter Hutterer
2014-08-11 10:02                 ` David Herrmann
2014-08-11 10:00             ` David Herrmann
2014-07-21  0:37 ` [PATCH RESEND 0/5] Evdev Extensions Dmitry Torokhov

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=1405775445-4454-4-git-send-email-dh.herrmann@gmail.com \
    --to=dh.herrmann@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dtor@google.com \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    /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).