aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-11-17 11:14:42 -0600
committerAlex Bennée <alex.bennee@linaro.org>2015-01-07 11:36:06 +0000
commit533ee1d8ed414bf2bc407deb6bf84a56cedc476b (patch)
tree95baa24beb361cbf6966e071030d3111c79e3057
parenta03e7ee64a1dbe2b6e9d4c89750f7fd7cea84333 (diff)
downloadqemu-android-533ee1d8ed414bf2bc407deb6bf84a56cedc476b.tar.gz
android-console: Add GF event send function
Adds Android emulator console command for enqueuing a Goldfish/Ranchu event. The function takes the event type and code (symbol or value) along with an event value and adds it to the Goldfish event device work queue. Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r--hw/input/goldfish_events.c13
-rw-r--r--include/hw/input/goldfish_events.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/hw/input/goldfish_events.c b/hw/input/goldfish_events.c
index 16325b651a..3e234036c8 100644
--- a/hw/input/goldfish_events.c
+++ b/hw/input/goldfish_events.c
@@ -716,6 +716,19 @@ static int get_page_data(GoldfishEvDevState *s, int offset)
return 0;
}
+int gf_event_send(int type, int code, int value)
+{
+ DeviceState *s = qdev_find_recursive(sysbus_get_default(),
+ TYPE_GOLDFISHEVDEV);
+ GoldfishEvDevState *dev = GOLDFISHEVDEV(s);
+
+ if (dev) {
+ enqueue_event(dev, type, code, value);
+ }
+
+ return 0;
+}
+
static uint64_t events_read(void *opaque, hwaddr offset, unsigned size)
{
GoldfishEvDevState *s = (GoldfishEvDevState *)opaque;
diff --git a/include/hw/input/goldfish_events.h b/include/hw/input/goldfish_events.h
index be426d5991..bff8a7b3d0 100644
--- a/include/hw/input/goldfish_events.h
+++ b/include/hw/input/goldfish_events.h
@@ -19,5 +19,6 @@ extern int gf_get_event_code_count(const char *typename);
extern int gf_get_event_code_name(const char *typename, unsigned int code,
char *buf);
extern int gf_get_event_code_value(int typeval, char *codename);
+extern int gf_event_send(int type, int code, int value);
#endif