linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: evdev - add ioctl cmd EVIOCGBUFSIZE to get buffer size
@ 2016-01-08 15:23 Aniroop Mathur
  2016-01-08 15:29 ` David Herrmann
  0 siblings, 1 reply; 19+ messages in thread
From: Aniroop Mathur @ 2016-01-08 15:23 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, aniroop.mathur, Aniroop Mathur

Add ioctl cmd EVIOCGBUFSIZE to get kernel buffer size of device so that
clients can accordingly set the size of userspace buffer and can know
maximum number of events that they are required to read in worst case.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
---
 drivers/input/evdev.c      |    3 +++
 include/uapi/linux/input.h |    2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index e9ae3d5..8b16f08 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -1103,6 +1103,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 
 		return 0;
 
+	case EVIOCGBUFSIZE:
+		return put_user(client->bufsize, (unsigned int __user *)p);
+
 	case EVIOCRMFF:
 		return input_ff_erase(dev, (int)(unsigned long) p, file);
 
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 2758687..51d66aa 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -114,6 +114,8 @@ struct input_mask {
 #define EVIOCSKEYCODE		_IOW('E', 0x04, unsigned int[2])        /* set keycode */
 #define EVIOCSKEYCODE_V2	_IOW('E', 0x04, struct input_keymap_entry)
 
+#define EVIOCGBUFSIZE		_IOR('E', 0x05, unsigned int)		/* get device buffer size */
+
 #define EVIOCGNAME(len)		_IOC(_IOC_READ, 'E', 0x06, len)		/* get device name */
 #define EVIOCGPHYS(len)		_IOC(_IOC_READ, 'E', 0x07, len)		/* get physical location */
 #define EVIOCGUNIQ(len)		_IOC(_IOC_READ, 'E', 0x08, len)		/* get unique identifier */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-01-12  7:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-08 15:23 [PATCH] Input: evdev - add ioctl cmd EVIOCGBUFSIZE to get buffer size Aniroop Mathur
2016-01-08 15:29 ` David Herrmann
2016-01-08 19:53   ` Aniroop Mathur
2016-01-08 20:13     ` One Thousand Gnomes
2016-01-08 20:20       ` Aniroop Mathur
2016-01-08 20:33         ` One Thousand Gnomes
2016-01-08 20:51           ` Aniroop Mathur
2016-01-08 21:02             ` Dmitry Torokhov
2016-01-08 22:16               ` Aniroop Mathur
2016-01-08 22:27                 ` Dmitry Torokhov
2016-01-08 22:43                   ` Aniroop Mathur
2016-01-09 16:21                     ` Aniroop Mathur
2016-01-09 18:51                       ` Dmitry Torokhov
2016-01-09 23:03                         ` Aniroop Mathur
2016-01-10 22:43                           ` Peter Hutterer
2016-01-11 18:13                             ` Aniroop Mathur
2016-01-11 23:46                               ` Dmitry Torokhov
2016-01-12  7:14                                 ` Aniroop Mathur
2016-01-12  0:21                               ` Peter Hutterer

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).