aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-08-11 17:36:34 -0700
committerXavier Ducrohet <xav@android.com>2011-08-11 18:03:19 -0700
commitcccd28ca5064a7bd14282cd774ee5bb7126d5845 (patch)
treef0a4eaf1afbbe1d3fd2eac93ea6b9a8e018cb942 /hw
parentf490aee025b3bab5bcdb065e5fc1b1abecf16b97 (diff)
downloadexternal_qemu-cccd28ca5064a7bd14282cd774ee5bb7126d5845.zip
external_qemu-cccd28ca5064a7bd14282cd774ee5bb7126d5845.tar.gz
external_qemu-cccd28ca5064a7bd14282cd774ee5bb7126d5845.tar.bz2
Revert "Merge c80340 from master to r13: Move charmap to hardware properties". do not merge.
This reverts commit f490aee025b3bab5bcdb065e5fc1b1abecf16b97. Change-Id: I59a0b2aebc8ab2b788a820a206c6eb4fc6e6e6d2
Diffstat (limited to 'hw')
-rw-r--r--hw/goldfish_events_device.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/hw/goldfish_events_device.c b/hw/goldfish_events_device.c
index a5b2a21..3072e3b 100644
--- a/hw/goldfish_events_device.c
+++ b/hw/goldfish_events_device.c
@@ -102,6 +102,8 @@ static int events_state_load(QEMUFile* f, void* opaque, int version_id)
return qemu_get_struct(f, events_state_fields, s);
}
+extern const char* android_skin_keycharmap;
+
static void enqueue_event(events_state *s, unsigned int type, unsigned int code, int value)
{
int enqueued = s->last - s->first;
@@ -167,11 +169,22 @@ static unsigned dequeue_event(events_state *s)
return n;
}
+static const char*
+get_charmap_name(events_state *s)
+{
+ if (s->name != NULL)
+ return s->name;
+
+ s->name = android_get_charmap_name();
+ return s->name;
+}
+
+
static int get_page_len(events_state *s)
{
int page = s->page;
if (page == PAGE_NAME) {
- const char* name = s->name;
+ const char* name = get_charmap_name(s);
return strlen(name);
} if (page >= PAGE_EVBITS && page <= PAGE_EVBITS + EV_MAX)
return s->ev_bits[page - PAGE_EVBITS].len;
@@ -187,7 +200,7 @@ static int get_page_data(events_state *s, int offset)
if (offset > page_len)
return 0;
if (page == PAGE_NAME) {
- const char* name = s->name;
+ const char* name = get_charmap_name(s);
return name[offset];
} if (page >= PAGE_EVBITS && page <= PAGE_EVBITS + EV_MAX)
return s->ev_bits[page - PAGE_EVBITS].bits[offset];
@@ -334,6 +347,9 @@ void events_dev_init(uint32_t base, qemu_irq irq)
s = (events_state *) qemu_mallocz(sizeof(events_state));
+ // charmap name will be determined on demand
+ s->name = NULL;
+
/* now set the events capability bits depending on hardware configuration */
/* apparently, the EV_SYN array is used to indicate which other
* event classes to consider.
@@ -498,7 +514,6 @@ void events_dev_init(uint32_t base, qemu_irq irq)
s->first = 0;
s->last = 0;
s->state = STATE_INIT;
- s->name = qemu_strdup(config->hw_keyboard_charmap);
/* This function migh fire buffered events to the device, so
* ensure that it is called after initialization is complete