From 70e3a043a59c01f4b8e5809e6131b83e9de97a8a Mon Sep 17 00:00:00 2001 From: sungmin ha Date: Wed, 16 Apr 2014 19:09:30 +0900 Subject: hwkey: Device init check routine was added. Change-Id: Icc246b14dacb59d55a466ea6a5c282720f77fe07 Signed-off-by: sungmin ha --- tizen/src/hw/maru_virtio_hwkey.c | 15 ++++++++++----- 1 file 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; } -- cgit v1.2.3