summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsungmin ha <sungmin82.ha@samsung.com>2014-04-16 19:09:30 +0900
committersungmin ha <sungmin82.ha@samsung.com>2014-04-17 11:00:27 +0900
commit70e3a043a59c01f4b8e5809e6131b83e9de97a8a (patch)
tree45e6e07e6bd6484482403c4432eb2913b6268cc3
parenta07192eb5cae5f398f5bcd0992446dd8e6cc58d9 (diff)
downloadqemu-70e3a043a59c01f4b8e5809e6131b83e9de97a8a.tar.gz
qemu-70e3a043a59c01f4b8e5809e6131b83e9de97a8a.tar.bz2
qemu-70e3a043a59c01f4b8e5809e6131b83e9de97a8a.zip
hwkey: Device init check routine was added.
Change-Id: Icc246b14dacb59d55a466ea6a5c282720f77fe07 Signed-off-by: sungmin ha <sungmin82.ha@samsung.com>
-rw-r--r--tizen/src/hw/maru_virtio_hwkey.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tizen/src/hw/maru_virtio_hwkey.c b/tizen/src/hw/maru_virtio_hwkey.c
index e1891ac3df..29a7cd1786 100644
--- a/tizen/src/hw/maru_virtio_hwkey.c
+++ b/tizen/src/hw/maru_virtio_hwkey.c
@@ -37,8 +37,7 @@ MULTI_DEBUG_CHANNEL(qemu, hwkey);
#define DEVICE_NAME "virtio-hwkey"
#define MAX_BUF_COUNT 64
-static int vqidx = 0;
-
+static int vqidx;
/*
* HW key event queue
*/
@@ -86,6 +85,11 @@ void maru_hwkey_event(int event_type, int keycode)
{
HwKeyEventEntry *entry = NULL;
+ if (!vhk) {
+ INFO("Hwkey device can not be used.\n");
+ return;
+ }
+
if (unlikely(event_queue_cnt >= MAX_HWKEY_EVENT_CNT)) {
INFO("full hwkey event queue, lose event\n", event_queue_cnt);
@@ -103,7 +107,8 @@ void maru_hwkey_event(int event_type, int keycode)
event_ringbuf_cnt++;
- entry->index = ++event_queue_cnt; // 1 ~
+ /* 1 ~ */
+ entry->index = ++event_queue_cnt;
QTAILQ_INSERT_TAIL(&events_queue, entry, node);
@@ -158,7 +163,8 @@ void maru_virtio_hwkey_notify(void)
event_queue_cnt, vqidx);
/* copy event into virtio buffer */
- memcpy(elem_vhk.in_sg[vqidx++].iov_base, &(event_entry->hwkey), sizeof(EmulHWKeyEvent));
+ memcpy(elem_vhk.in_sg[vqidx++].iov_base, &(event_entry->hwkey),
+ sizeof(EmulHWKeyEvent));
if (vqidx == MAX_BUF_COUNT) {
vqidx = 0;
}
@@ -179,7 +185,6 @@ void maru_virtio_hwkey_notify(void)
static uint32_t virtio_hwkey_get_features(
VirtIODevice *vdev, uint32_t request_features)
{
- // TODO:
return request_features;
}