@@ -370,12 +370,19 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
{
struct evdev_client *client = file->private_data;
struct evdev *evdev = client->evdev;
+ struct input_dev *dev = evdev->handle.dev;
struct input_event event;
int retval;
if (count < input_event_size())
return -EINVAL;
+ if (client->head == client->tail && dev->read) {
+ retval = dev->read(dev);
+ if (retval)
+ return retval;
+ }
+
if (client->head == client->tail && evdev->exist &&
(file->f_flags & O_NONBLOCK))
return -EAGAIN;
@@ -407,6 +414,9 @@ static unsigned int evdev_poll(struct file *file, poll_table *wait)
struct evdev *evdev = client->evdev;
unsigned int mask;
+ if (client->head == client->tail && dev->read)
+ dev->read(dev);
+
poll_wait(file, &evdev->wait, wait);
mask = evdev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR;
@@ -1264,6 +1264,7 @@ struct input_dev {
int (*open)(struct input_dev *dev);
void (*close)(struct input_dev *dev);
+ int (*read)(struct input_dev *dev);
int (*flush)(struct input_dev *dev, struct file *file);
int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);