diff options
author | David 'Digit' Turner <digit@android.com> | 2011-03-18 14:45:01 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-03-18 14:45:01 -0700 |
commit | c5ff76d6fb3d9f96068b6ee641c4e87665811332 (patch) | |
tree | ef175683092cc6090cace7ca420ee23611293eab | |
parent | 3dc1248864c1cb1e77e9abdb7c9ae1f81b8675b5 (diff) | |
parent | dc2e1151f304b4526cc6b1e89cb01a3c2ead84f7 (diff) | |
download | external_qemu-c5ff76d6fb3d9f96068b6ee641c4e87665811332.zip external_qemu-c5ff76d6fb3d9f96068b6ee641c4e87665811332.tar.gz external_qemu-c5ff76d6fb3d9f96068b6ee641c4e87665811332.tar.bz2 |
Merge "Fix touchscreen emulation to return correct min/max coordinate bounds. DO NOT MERGE" into tools_r10
-rw-r--r-- | hw/goldfish_events_device.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/hw/goldfish_events_device.c b/hw/goldfish_events_device.c index 340dc76..89734e5 100644 --- a/hw/goldfish_events_device.c +++ b/hw/goldfish_events_device.c @@ -19,6 +19,10 @@ #define MAX_EVENTS 256*4 +/* Defined in vl-android.c */ +extern int android_display_width; +extern int android_display_height; + enum { REG_READ = 0x00, REG_SET_PAGE = 0x00, @@ -448,8 +452,44 @@ void events_dev_init(uint32_t base, qemu_irq irq) * EV_ABS events are sent when the touchscreen is pressed */ if (config->hw_touchScreen) { + int32_t* values; + events_set_bit (s, EV_SYN, EV_ABS ); events_set_bits(s, EV_ABS, ABS_X, ABS_Z); + /* Allocate the absinfo to report the min/max bounds for each + * absolute dimension. The array must contain 3 tuples + * of (min,max,fuzz,flat) 32-bit values. + * + * min and max are the bounds + * fuzz corresponds to the device's fuziness, we set it to 0 + * flat corresponds to the flat position for JOEYDEV devices, + * we also set it to 0. + * + * There is no need to save/restore this array in a snapshot + * since the values only depend on the hardware configuration. + */ + s->abs_info_count = 3*4; + s->abs_info = values = malloc(sizeof(uint32_t)*s->abs_info_count); + + /* ABS_X min/max/fuzz/flat */ + values[0] = 0; + values[1] = android_display_width-1; + values[2] = 0; + values[3] = 0; + values += 4; + + /* ABS_Y */ + values[0] = 0; + values[1] = android_display_height-1; + values[2] = 0; + values[3] = 0; + values += 4; + + /* ABS_Z */ + values[0] = 0; + values[1] = 1; + values[2] = 0; + values[3] = 0; } /* configure EV_SW array |