From 81ab8585c7e54d3d0c7eeac06e2b5ad034a7c335 Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Fri, 31 Aug 2012 14:50:38 +0900 Subject: [PATCH] [Title] added some log to usb touchscreen [Type] enhancement [Module] Emulator / touch [Priority] major [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- drivers/maru/maru_touchscreen.c | 19 +++++++++++++++++-- drivers/maru/maru_virtio_touchscreen.c | 12 ++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/maru/maru_touchscreen.c b/drivers/maru/maru_touchscreen.c index d77a0cbb1222..4861280287b8 100644 --- a/drivers/maru/maru_touchscreen.c +++ b/drivers/maru/maru_touchscreen.c @@ -122,6 +122,8 @@ static int emul_touchscreen_open(struct input_dev *dev) { struct emul_touchscreen *usb_ts = input_get_drvdata(dev); + printk(KERN_INFO "usb touchscreen device is opened\n"); + mutex_lock(&usb_ts->lock); usb_ts->irq->dev = usb_ts->usbdev; @@ -147,6 +149,8 @@ static void emul_touchscreen_close(struct input_dev *dev) { struct emul_touchscreen *usb_ts = input_get_drvdata(dev); + printk(KERN_INFO "usb touchscreen device is closed\n"); + mutex_lock(&usb_ts->lock); usb_kill_urb(usb_ts->irq); usb_ts->open = 0; @@ -160,6 +164,8 @@ static int emul_touchscreen_probe(struct usb_interface *intf, const struct usb_d struct emul_touchscreen *usb_ts; int error = -ENOMEM; + printk(KERN_INFO "usb touchscreen driver is probed\n"); + usb_ts = kzalloc(sizeof(struct emul_touchscreen), GFP_KERNEL); if (!usb_ts) { goto fail1; @@ -238,6 +244,8 @@ static void emul_touchscreen_disconnect(struct usb_interface *intf) { struct emul_touchscreen *usb_ts = usb_get_intfdata(intf); + printk(KERN_INFO "usb touchscreen device is disconnected\n"); + usb_set_intfdata(intf, NULL); if (usb_ts) { usb_kill_urb(usb_ts->irq); @@ -252,6 +260,8 @@ static int emul_touchscreen_suspend(struct usb_interface *intf, pm_message_t mes { struct emul_touchscreen *usb_ts = usb_get_intfdata(intf); + printk(KERN_INFO "usb touchscreen device is suspended\n"); + mutex_lock(&usb_ts->lock); usb_kill_urb(usb_ts->irq); mutex_unlock(&usb_ts->lock); @@ -262,7 +272,9 @@ static int emul_touchscreen_suspend(struct usb_interface *intf, pm_message_t mes static int emul_touchscreen_resume(struct usb_interface *intf) { struct emul_touchscreen *usb_ts = usb_get_intfdata(intf); - int rv; + int rv = 0; + + printk(KERN_INFO "usb touchscreen device is resumed\n"); mutex_lock(&usb_ts->lock); if (usb_ts->open) { @@ -295,8 +307,10 @@ static struct usb_driver emul_touchscreen_driver = { static int __init emul_touchscreen_init(void) { + printk(KERN_INFO "usb touchscreen device is initialized\n"); + int result = usb_register(&emul_touchscreen_driver); - if (result == 0) { + if (result != 0) { printk(KERN_ERR "emul_touchscreen_init: usb_register=%d\n", result); } @@ -305,6 +319,7 @@ static int __init emul_touchscreen_init(void) static void __exit emul_touchscreen_exit(void) { + printk(KERN_INFO "usb touchscreen device is destroyed\n"); usb_deregister(&emul_touchscreen_driver); } diff --git a/drivers/maru/maru_virtio_touchscreen.c b/drivers/maru/maru_virtio_touchscreen.c index 50acd0fcd930..225c852bb319 100644 --- a/drivers/maru/maru_virtio_touchscreen.c +++ b/drivers/maru/maru_virtio_touchscreen.c @@ -48,10 +48,10 @@ MODULE_DESCRIPTION("Emulator Virtio Touchscreen driver"); #define DEVICE_NAME "virtio-touchscreen" /* This structure must match the qemu definitions */ -typedef struct EmulTouchState { +typedef struct EmulTouchEvent { uint16_t x, y, z; uint8_t state; -} EmulTouchState; +} EmulTouchEvent; typedef struct virtio_touchscreen { @@ -81,21 +81,21 @@ static struct virtio_device_id id_table[] = { static int run_touchscreen(void *_vtouchscreen) { virtio_touchscreen *vt = NULL; - EmulTouchState *vbuf = NULL; - EmulTouchState *event = NULL; + EmulTouchEvent *vbuf = NULL; + EmulTouchEvent *event = NULL; struct scatterlist sg; int count = 0; // remaining capacity of queue struct input_dev *input_dev = NULL; vt = _vtouchscreen; - vbuf = kzalloc(sizeof(EmulTouchState), GFP_KERNEL); + vbuf = kzalloc(sizeof(EmulTouchEvent), GFP_KERNEL); vbuf->x = MAX_TRKID; // max touch point input_dev = vt->idev; while (!kthread_should_stop()) { - sg_init_one(&sg, vbuf, sizeof(EmulTouchState)); + sg_init_one(&sg, vbuf, sizeof(EmulTouchEvent)); if (virtqueue_add_buf(vt->vq, &sg, 0, 1, (void*)vbuf, GFP_ATOMIC) >= 0) { virtqueue_kick(vt->vq); -- 2.34.1