Lines Matching +full:event +full:- +full:touch
2 * Xen para-virtual input device
5 * Copyright (C) 2006-2008 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
66 if (unlikely(!info->ptr)) in xenkbd_handle_motion_event()
69 input_report_rel(info->ptr, REL_X, motion->rel_x); in xenkbd_handle_motion_event()
70 input_report_rel(info->ptr, REL_Y, motion->rel_y); in xenkbd_handle_motion_event()
71 if (motion->rel_z) in xenkbd_handle_motion_event()
72 input_report_rel(info->ptr, REL_WHEEL, -motion->rel_z); in xenkbd_handle_motion_event()
73 input_sync(info->ptr); in xenkbd_handle_motion_event()
79 if (unlikely(!info->ptr)) in xenkbd_handle_position_event()
82 input_report_abs(info->ptr, ABS_X, pos->abs_x); in xenkbd_handle_position_event()
83 input_report_abs(info->ptr, ABS_Y, pos->abs_y); in xenkbd_handle_position_event()
84 if (pos->rel_z) in xenkbd_handle_position_event()
85 input_report_rel(info->ptr, REL_WHEEL, -pos->rel_z); in xenkbd_handle_position_event()
86 input_sync(info->ptr); in xenkbd_handle_position_event()
93 int value = key->pressed; in xenkbd_handle_key_event()
95 if (test_bit(key->keycode, info->ptr->keybit)) { in xenkbd_handle_key_event()
96 dev = info->ptr; in xenkbd_handle_key_event()
97 } else if (test_bit(key->keycode, info->kbd->keybit)) { in xenkbd_handle_key_event()
98 dev = info->kbd; in xenkbd_handle_key_event()
99 if (key->pressed && test_bit(key->keycode, info->kbd->key)) in xenkbd_handle_key_event()
102 pr_warn("unhandled keycode 0x%x\n", key->keycode); in xenkbd_handle_key_event()
109 input_event(dev, EV_KEY, key->keycode, value); in xenkbd_handle_key_event()
116 if (unlikely(!info->mtouch)) in xenkbd_handle_mt_event()
119 if (mtouch->contact_id != info->mtouch_cur_contact_id) { in xenkbd_handle_mt_event()
120 info->mtouch_cur_contact_id = mtouch->contact_id; in xenkbd_handle_mt_event()
121 input_mt_slot(info->mtouch, mtouch->contact_id); in xenkbd_handle_mt_event()
124 switch (mtouch->event_type) { in xenkbd_handle_mt_event()
126 input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, true); in xenkbd_handle_mt_event()
130 input_report_abs(info->mtouch, ABS_MT_POSITION_X, in xenkbd_handle_mt_event()
131 mtouch->u.pos.abs_x); in xenkbd_handle_mt_event()
132 input_report_abs(info->mtouch, ABS_MT_POSITION_Y, in xenkbd_handle_mt_event()
133 mtouch->u.pos.abs_y); in xenkbd_handle_mt_event()
137 input_report_abs(info->mtouch, ABS_MT_TOUCH_MAJOR, in xenkbd_handle_mt_event()
138 mtouch->u.shape.major); in xenkbd_handle_mt_event()
139 input_report_abs(info->mtouch, ABS_MT_TOUCH_MINOR, in xenkbd_handle_mt_event()
140 mtouch->u.shape.minor); in xenkbd_handle_mt_event()
144 input_report_abs(info->mtouch, ABS_MT_ORIENTATION, in xenkbd_handle_mt_event()
145 mtouch->u.orientation); in xenkbd_handle_mt_event()
149 input_mt_report_slot_inactive(info->mtouch); in xenkbd_handle_mt_event()
153 input_mt_sync_frame(info->mtouch); in xenkbd_handle_mt_event()
154 input_sync(info->mtouch); in xenkbd_handle_mt_event()
160 union xenkbd_in_event *event) in xenkbd_handle_event() argument
162 switch (event->type) { in xenkbd_handle_event()
164 xenkbd_handle_motion_event(info, &event->motion); in xenkbd_handle_event()
168 xenkbd_handle_key_event(info, &event->key); in xenkbd_handle_event()
172 xenkbd_handle_position_event(info, &event->pos); in xenkbd_handle_event()
176 xenkbd_handle_mt_event(info, &event->mtouch); in xenkbd_handle_event()
184 struct xenkbd_page *page = info->page; in input_handler()
187 prod = page->in_prod; in input_handler()
188 if (prod == page->in_cons) in input_handler()
191 for (cons = page->in_cons; cons != prod; cons++) in input_handler()
194 page->in_cons = cons; in input_handler()
195 notify_remote_via_irq(info->irq); in input_handler()
210 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); in xenkbd_probe()
211 return -ENOMEM; in xenkbd_probe()
213 dev_set_drvdata(&dev->dev, info); in xenkbd_probe()
214 info->xbdev = dev; in xenkbd_probe()
215 info->irq = -1; in xenkbd_probe()
216 info->gref = -1; in xenkbd_probe()
217 snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename); in xenkbd_probe()
219 info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); in xenkbd_probe()
220 if (!info->page) in xenkbd_probe()
227 with_kbd = !xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
230 with_ptr = !xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
233 /* Direct logic: if set, then create multi-touch device. */ in xenkbd_probe()
234 with_mtouch = xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
237 ret = xenbus_write(XBT_NIL, dev->nodename, in xenkbd_probe()
240 pr_warn("xenkbd: can't request multi-touch"); in xenkbd_probe()
250 kbd->name = "Xen Virtual Keyboard"; in xenkbd_probe()
251 kbd->phys = info->phys; in xenkbd_probe()
252 kbd->id.bustype = BUS_PCI; in xenkbd_probe()
253 kbd->id.vendor = 0x5853; in xenkbd_probe()
254 kbd->id.product = 0xffff; in xenkbd_probe()
256 __set_bit(EV_KEY, kbd->evbit); in xenkbd_probe()
258 __set_bit(i, kbd->keybit); in xenkbd_probe()
260 __set_bit(i, kbd->keybit); in xenkbd_probe()
269 info->kbd = kbd; in xenkbd_probe()
277 abs = xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
279 ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
282 ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, in xenkbd_probe()
286 ret = xenbus_write(XBT_NIL, dev->nodename, in xenkbd_probe()
289 pr_warn("xenkbd: can't request abs-pointer\n"); in xenkbd_probe()
297 ptr->name = "Xen Virtual Pointer"; in xenkbd_probe()
298 ptr->phys = info->phys; in xenkbd_probe()
299 ptr->id.bustype = BUS_PCI; in xenkbd_probe()
300 ptr->id.vendor = 0x5853; in xenkbd_probe()
301 ptr->id.product = 0xfffe; in xenkbd_probe()
304 __set_bit(EV_ABS, ptr->evbit); in xenkbd_probe()
315 __set_bit(EV_KEY, ptr->evbit); in xenkbd_probe()
317 __set_bit(i, ptr->keybit); in xenkbd_probe()
326 info->ptr = ptr; in xenkbd_probe()
329 /* multi-touch device */ in xenkbd_probe()
337 num_cont = xenbus_read_unsigned(info->xbdev->otherend, in xenkbd_probe()
340 width = xenbus_read_unsigned(info->xbdev->otherend, in xenkbd_probe()
343 height = xenbus_read_unsigned(info->xbdev->otherend, in xenkbd_probe()
347 mtouch->name = "Xen Virtual Multi-touch"; in xenkbd_probe()
348 mtouch->phys = info->phys; in xenkbd_probe()
349 mtouch->id.bustype = BUS_PCI; in xenkbd_probe()
350 mtouch->id.vendor = 0x5853; in xenkbd_probe()
351 mtouch->id.product = 0xfffd; in xenkbd_probe()
363 xenbus_dev_fatal(info->xbdev, ret, in xenkbd_probe()
371 xenbus_dev_fatal(info->xbdev, ret, in xenkbd_probe()
375 info->mtouch_cur_contact_id = -1; in xenkbd_probe()
376 info->mtouch = mtouch; in xenkbd_probe()
380 ret = -ENXIO; in xenkbd_probe()
391 ret = -ENOMEM; in xenkbd_probe()
400 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); in xenkbd_resume()
403 memset(info->page, 0, PAGE_SIZE); in xenkbd_resume()
409 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); in xenkbd_remove()
412 if (info->kbd) in xenkbd_remove()
413 input_unregister_device(info->kbd); in xenkbd_remove()
414 if (info->ptr) in xenkbd_remove()
415 input_unregister_device(info->ptr); in xenkbd_remove()
416 if (info->mtouch) in xenkbd_remove()
417 input_unregister_device(info->mtouch); in xenkbd_remove()
418 free_page((unsigned long)info->page); in xenkbd_remove()
429 ret = gnttab_grant_foreign_access(dev->otherend_id, in xenkbd_connect_backend()
430 virt_to_gfn(info->page), 0); in xenkbd_connect_backend()
433 info->gref = ret; in xenkbd_connect_backend()
439 0, dev->devicetype, info); in xenkbd_connect_backend()
444 info->irq = ret; in xenkbd_connect_backend()
452 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu", in xenkbd_connect_backend()
453 virt_to_gfn(info->page)); in xenkbd_connect_backend()
456 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF, in xenkbd_connect_backend()
457 "%u", info->gref); in xenkbd_connect_backend()
460 ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u", in xenkbd_connect_backend()
466 if (ret == -EAGAIN) in xenkbd_connect_backend()
479 unbind_from_irqhandler(info->irq, info); in xenkbd_connect_backend()
480 info->irq = -1; in xenkbd_connect_backend()
484 gnttab_end_foreign_access(info->gref, 0, 0UL); in xenkbd_connect_backend()
485 info->gref = -1; in xenkbd_connect_backend()
491 if (info->irq >= 0) in xenkbd_disconnect_backend()
492 unbind_from_irqhandler(info->irq, info); in xenkbd_disconnect_backend()
493 info->irq = -1; in xenkbd_disconnect_backend()
494 if (info->gref >= 0) in xenkbd_disconnect_backend()
495 gnttab_end_foreign_access(info->gref, 0, 0UL); in xenkbd_disconnect_backend()
496 info->gref = -1; in xenkbd_disconnect_backend()
520 if (dev->state != XenbusStateConnected) in xenkbd_backend_changed()
525 if (dev->state == XenbusStateClosed) in xenkbd_backend_changed()
550 return -ENODEV; in xenkbd_init()
554 return -ENODEV; in xenkbd_init()
557 return -ENODEV; in xenkbd_init()