linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: WEN Pingbo <pingbo.wen@linaro.org>
To: linux-input@vger.kernel.org
Cc: y2038@lists.linaro.org, arnd@arndb.de, dmitry.torokhov@gmail.com,
	WEN Pingbo <pingbo.wen@linaro.org>
Subject: [PATCH 2/3] evdev: add new ioctl EVIOCSEVENT / EVIOCGEVENT
Date: Mon,  2 Nov 2015 21:35:38 +0800	[thread overview]
Message-ID: <1446471339-25464-3-git-send-email-pingbo.wen@linaro.org> (raw)
In-Reply-To: <1446471339-25464-1-git-send-email-pingbo.wen@linaro.org>

The two ioctl command is used to set is_input_event64 flag.

All userspace programs must set this flag to true, before using the
new input_event64 structure.

Signed-off-by: WEN Pingbo <pingbo.wen@linaro.org>
---
 drivers/input/evdev.c      | 9 +++++++++
 include/uapi/linux/input.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 815487f..990a083 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -863,6 +863,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 	int __user *ip = (int __user *)p;
 	unsigned int i, t, u, v;
 	unsigned int size;
+	int event_flag;
 	int error;
 
 	/* First we check for fixed-length commands */
@@ -937,6 +938,14 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 
 	case EVIOCSKEYCODE_V2:
 		return evdev_handle_set_keycode_v2(dev, p);
+	case EVIOCSEVENT:
+		if (get_user(event_flag, ip))
+			return -EFAULT;
+		client->is_input_event64 = !!event_flag;
+
+		return 0;
+	case EVIOCGEVENT:
+		return put_user(client->is_input_event64, ip);
 	}
 
 	size = _IOC_SIZE(cmd);
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 1e252ff..966ce8f 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -171,6 +171,9 @@ struct input_keymap_entry {
 
 #define EVIOCSCLOCKID		_IOW('E', 0xa0, int)			/* Set clockid to be used for timestamps */
 
+#define EVIOCSEVENT		_IOW('E', 0xa1, int)			/* Set input_event64 flag*/
+#define EVIOCGEVENT		_IOR('E', 0xa2, int)			/* Get input_event64 flag*/
+
 /*
  * Device properties and quirks
  */
-- 
1.9.1


  parent reply	other threads:[~2015-11-02 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 13:35 [PATCH 0/3] fix y2038 problem in input_event WEN Pingbo
2015-11-02 13:35 ` [PATCH 1/3] evdev: convert input_event to input_event64 WEN Pingbo
2015-11-02 13:35 ` WEN Pingbo [this message]
2015-11-02 13:35 ` [PATCH 3/3] uinput: " WEN Pingbo
2015-11-03  1:43 ` [PATCH 0/3] fix y2038 problem in input_event Dmitry Torokhov
2015-11-04  3:35   ` Pingbo Wen
2015-11-06 13:11     ` [Y2038] " Arnd Bergmann

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=1446471339-25464-3-git-send-email-pingbo.wen@linaro.org \
    --to=pingbo.wen@linaro.org \
    --cc=arnd@arndb.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=y2038@lists.linaro.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).