From: WEN Pingbo <pingbo.wen@linaro.org>
To: y2038@list.linaro.org, dmitry.torokhov@gmail.com,
aksgarg1989@gmail.com, arnd@arndb.de
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org, WEN Pingbo <pingbo.wen@linaro.org>
Subject: [PATCH 3/3] uinput: convert input_event to input_value
Date: Fri, 27 Nov 2015 18:00:32 +0800 [thread overview]
Message-ID: <1448618432-32357-4-git-send-email-pingbo.wen@linaro.org> (raw)
In-Reply-To: <1448618432-32357-1-git-send-email-pingbo.wen@linaro.org>
This patch depends on 'add new evdev interface'.
We should not use input_event in kernel any more. Convert it in
uinput, and adapt to new api changes.
Signed-off-by: WEN Pingbo <pingbo.wen@linaro.org>
---
drivers/input/misc/uinput.c | 23 +++++++++++------------
include/linux/uinput.h | 2 +-
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 5adbced..d84c6d4 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -50,7 +50,6 @@ static int uinput_dev_event(struct input_dev *dev,
udev->buff[udev->head].type = type;
udev->buff[udev->head].code = code;
udev->buff[udev->head].value = value;
- do_gettimeofday(&udev->buff[udev->head].time);
udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE;
wake_up_interruptible(&udev->waitq);
@@ -436,24 +435,24 @@ static int uinput_setup_device(struct uinput_device *udev,
static ssize_t uinput_inject_events(struct uinput_device *udev,
const char __user *buffer, size_t count)
{
- struct input_event ev;
+ struct input_value ev;
size_t bytes = 0;
- if (count != 0 && count < input_event_size())
+ if (count != 0 && count < input_event_size(EV_IF_LEGACY))
return -EINVAL;
- while (bytes + input_event_size() <= count) {
+ while (bytes + input_event_size(EV_IF_LEGACY) <= count) {
/*
* Note that even if some events were fetched successfully
* we are still going to return EFAULT instead of partial
* count to let userspace know that it got it's buffers
* all wrong.
*/
- if (input_event_from_user(buffer + bytes, &ev))
+ if (input_event_from_user(buffer + bytes, &ev, EV_IF_LEGACY))
return -EFAULT;
input_event(udev->dev, ev.type, ev.code, ev.value);
- bytes += input_event_size();
+ bytes += input_event_size(EV_IF_LEGACY);
}
return bytes;
@@ -482,7 +481,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer,
}
static bool uinput_fetch_next_event(struct uinput_device *udev,
- struct input_event *event)
+ struct input_value *event)
{
bool have_event;
@@ -502,16 +501,16 @@ static bool uinput_fetch_next_event(struct uinput_device *udev,
static ssize_t uinput_events_to_user(struct uinput_device *udev,
char __user *buffer, size_t count)
{
- struct input_event event;
+ struct input_value event;
size_t read = 0;
- while (read + input_event_size() <= count &&
+ while (read + input_event_size(EV_IF_LEGACY) <= count &&
uinput_fetch_next_event(udev, &event)) {
- if (input_event_to_user(buffer + read, &event))
+ if (input_value_to_user(buffer + read, &event, EV_IF_LEGACY))
return -EFAULT;
- read += input_event_size();
+ read += input_event_size(EV_IF_LEGACY);
}
return read;
@@ -523,7 +522,7 @@ static ssize_t uinput_read(struct file *file, char __user *buffer,
struct uinput_device *udev = file->private_data;
ssize_t retval;
- if (count != 0 && count < input_event_size())
+ if (count != 0 && count < input_event_size(EV_IF_LEGACY))
return -EINVAL;
do {
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 0994c0d..bdb6fca 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -66,7 +66,7 @@ struct uinput_device {
unsigned char ready;
unsigned char head;
unsigned char tail;
- struct input_event buff[UINPUT_BUFFER_SIZE];
+ struct input_value buff[UINPUT_BUFFER_SIZE];
unsigned int ff_effects_max;
struct uinput_request *requests[UINPUT_NUM_REQUESTS];
--
1.9.1
next prev parent reply other threads:[~2015-11-27 10:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 10:00 [PATCH 0/3] introduce new evdev interface type WEN Pingbo
2015-11-27 10:00 ` [PATCH 1/3] input: evdev: introduce new evdev interface WEN Pingbo
[not found] ` <1448618432-32357-2-git-send-email-pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-27 10:37 ` kbuild test robot
2015-11-27 10:00 ` [PATCH 2/3] input: evdev: add new ioctl EVIOCSIFTYPE / EVIOCGIFTYPE WEN Pingbo
2015-11-27 16:59 ` Arnd Bergmann
2015-11-29 9:19 ` Pingbo Wen
2015-11-27 10:00 ` WEN Pingbo [this message]
[not found] ` <1448618432-32357-1-git-send-email-pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-27 16:58 ` [PATCH 0/3] introduce new evdev interface type Arnd Bergmann
2015-11-29 9:13 ` Pingbo Wen
2015-11-30 15:13 ` Arnd Bergmann
2015-12-01 8:34 ` Pingbo Wen
2015-12-01 8:34 ` Pingbo Wen
[not found] ` <CB4E5A6F-D514-4D3B-9C95-13A52C509EC9-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-12-01 10:47 ` Arnd Bergmann
2015-12-03 12:49 ` Pingbo Wen
[not found] ` <1BB6B3AD-F547-49F8-886A-56EF80CE62FE-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-12-03 12:54 ` [Y2038] " Arnd Bergmann
2015-12-03 12:56 ` 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=1448618432-32357-4-git-send-email-pingbo.wen@linaro.org \
--to=pingbo.wen@linaro.org \
--cc=aksgarg1989@gmail.com \
--cc=arnd@arndb.de \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=y2038@list.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).