14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16 #include <linux/kernel.h>
17 #include <linux/errno.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/slab.h>
22 #include <asm/xen/hypervisor.h>
25 #include <xen/events.h>
34 struct input_dev *
kbd;
35 struct input_dev *
ptr;
45 static void xenkbd_disconnect_backend(
struct xenkbd_info *);
62 for (cons = page->
in_cons; cons != prod; cons++) {
64 struct input_dev *
dev;
68 switch (event->
type) {
83 input_report_key(dev, event->
key.keycode,
90 input_report_abs(dev,
ABS_X, event->
pos.abs_x);
91 input_report_abs(dev,
ABS_Y, event->
pos.abs_y);
112 struct input_dev *kbd, *
ptr;
135 kbd = input_allocate_device();
138 kbd->name =
"Xen Virtual Keyboard";
139 kbd->phys = info->
phys;
141 kbd->id.vendor = 0x5853;
142 kbd->id.product = 0xffff;
150 ret = input_register_device(kbd);
152 input_free_device(kbd);
159 ptr = input_allocate_device();
162 ptr->name =
"Xen Virtual Pointer";
163 ptr->phys = info->
phys;
165 ptr->id.vendor = 0x5853;
166 ptr->id.product = 0xfffe;
170 input_set_abs_params(ptr,
ABS_X, 0, XENFB_WIDTH, 0, 0);
171 input_set_abs_params(ptr,
ABS_Y, 0, XENFB_HEIGHT, 0, 0);
182 ret = input_register_device(ptr);
184 input_free_device(ptr);
190 ret = xenkbd_connect_backend(dev, info);
208 xenkbd_disconnect_backend(info);
210 return xenkbd_connect_backend(dev, info);
217 xenkbd_disconnect_backend(info);
219 input_unregister_device(info->
kbd);
221 input_unregister_device(info->
ptr);
292 static void xenkbd_disconnect_backend(
struct xenkbd_info *info)
302 static void xenkbd_backend_changed(
struct xenbus_device *dev,
308 switch (backend_state) {
319 "feature-abs-pointer",
"%d", &val);
324 "request-abs-pointer",
"1");
326 pr_warning(
"xenkbd: can't request abs-pointer");
343 "width",
"%d", &val) > 0)
344 input_set_abs_params(info->
ptr,
ABS_X, 0, val, 0, 0);
347 "height",
"%d", &val) > 0)
348 input_set_abs_params(info->
ptr,
ABS_Y, 0, val, 0, 0);
368 .probe = xenkbd_probe,
369 .
remove = xenkbd_remove,
371 .otherend_changed = xenkbd_backend_changed,
374 static int __init xenkbd_init(
void)
386 static void __exit xenkbd_cleanup(
void)