[PATCH libevdev 2/3] Move read_more_events() up in the file
Peter Hutterer
peter.hutterer at who-t.net
Mon Apr 7 17:23:17 PDT 2014
No functional change
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
libevdev/libevdev.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 34413b2..7e8d3db 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -702,6 +702,31 @@ out:
}
static int
+read_more_events(struct libevdev *dev)
+{
+ int free_elem;
+ int len;
+ struct input_event *next;
+
+ free_elem = queue_num_free_elements(dev);
+ if (free_elem <= 0)
+ return 0;
+
+ next = queue_next_element(dev);
+ len = read(dev->fd, next, free_elem * sizeof(struct input_event));
+ if (len < 0) {
+ return -errno;
+ } else if (len > 0 && len % sizeof(struct input_event) != 0)
+ return -EINVAL;
+ else if (len > 0) {
+ int nev = len/sizeof(struct input_event);
+ queue_set_num_elements(dev, queue_num_elements(dev) + nev);
+ }
+
+ return 0;
+}
+
+static int
sync_state(struct libevdev *dev)
{
int i;
@@ -859,31 +884,6 @@ update_state(struct libevdev *dev, const struct input_event *e)
return rc;
}
-static int
-read_more_events(struct libevdev *dev)
-{
- int free_elem;
- int len;
- struct input_event *next;
-
- free_elem = queue_num_free_elements(dev);
- if (free_elem <= 0)
- return 0;
-
- next = queue_next_element(dev);
- len = read(dev->fd, next, free_elem * sizeof(struct input_event));
- if (len < 0) {
- return -errno;
- } else if (len > 0 && len % sizeof(struct input_event) != 0)
- return -EINVAL;
- else if (len > 0) {
- int nev = len/sizeof(struct input_event);
- queue_set_num_elements(dev, queue_num_elements(dev) + nev);
- }
-
- return 0;
-}
-
/**
* Sanitize/modify events where needed.
*/
--
1.9.0
More information about the Input-tools
mailing list