From 84c3a5816878f11fd794d35281a36d736d171e2c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 23 Sep 2011 15:17:12 +1000 Subject: Add syn() and key() to fakedev --- src/fakedev.c | 11 ++++++++++- src/fakedev.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/fakedev.c b/src/fakedev.c index b08c5ed..3a3756d 100644 --- a/src/fakedev.c +++ b/src/fakedev.c @@ -37,7 +37,6 @@ #include "fakedev.h" /* "public interfaces" */ - void send_event(int fd, int type, int code, int value) { struct input_event event; @@ -51,6 +50,10 @@ void send_event(int fd, int type, int code, int value) perror("Send event failed."); } +void syn(int fd) +{ + send_event(fd, EV_SYN, SYN_REPORT, 0); +} void move(int fd, int x, int y) { @@ -75,6 +78,12 @@ void click(int fd, int btn, int down) send_event(fd, EV_SYN, SYN_REPORT, 0); } +void key (int fd, int key, int down) +{ + send_event(fd, EV_MSC, MSC_SCAN, key); + send_event(fd, EV_KEY, key, down); + send_event(fd, EV_SYN, SYN_REPORT, 0); +} /* end public interfaces */ diff --git a/src/fakedev.h b/src/fakedev.h index 3599d72..f4c621d 100644 --- a/src/fakedev.h +++ b/src/fakedev.h @@ -45,9 +45,11 @@ struct test_device { }; extern void send_event(int fd, int type, int code, int value); +extern void syn (int fd); extern void move (int fd, int x, int y); extern void absmove (int fd, int x, int y); extern void click (int fd, int btn, int down); extern struct test_device* get_device(void); +extern void key (int fd, int key, int down); #endif -- cgit v1.2.3