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>2014-12-19 12:29:39 +0000
commitb99dd60c13bc2b8e54998241b41d6cb282071b0f (patch)
treeabe68f665ad907c5e06f405124e375fec5651456
parentc0137e380776eee05d0b8a689eda571cbf4606bb (diff)
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 16325b651..3e234036c 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 be426d599..bff8a7b3d 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