9 #include <linux/kernel.h>
10 #include <linux/slab.h>
11 #include <linux/input.h>
12 #include <linux/module.h>
22 struct input_dev *
dev;
26 static void dc_mouse_callback(
struct mapleq *
mq)
31 struct input_dev *
dev = mse->
dev;
35 relx = *(
unsigned short *)(res + 12) - 512;
36 rely = *(
unsigned short *)(res + 14) - 512;
37 relz = *(
unsigned short *)(res + 16) - 512;
39 input_report_key(dev,
BTN_LEFT, buttons & 4);
40 input_report_key(dev,
BTN_MIDDLE, buttons & 9);
41 input_report_key(dev,
BTN_RIGHT, buttons & 2);
42 input_report_rel(dev,
REL_X, relx);
43 input_report_rel(dev,
REL_Y, rely);
48 static int dc_mouse_open(
struct input_dev *
dev)
58 static void dc_mouse_close(
struct input_dev *dev)
72 struct input_dev *input_dev;
81 input_dev = input_allocate_device();
90 input_set_drvdata(input_dev, mse);
96 input_dev->open = dc_mouse_open;
97 input_dev->close = dc_mouse_close;
100 error = input_register_device(input_dev);
110 input_free_device(input_dev);
123 input_unregister_device(mse->
dev);
133 .name =
"Dreamcast_mouse",
134 .probe = probe_maple_mouse,
139 static int __init dc_mouse_init(
void)
144 static void __exit dc_mouse_exit(
void)