20 #include <linux/module.h>
22 #include <linux/input.h>
27 #include <asm/setup.h>
28 #include <asm/uaccess.h>
36 static int amimouse_lastx, amimouse_lasty;
41 unsigned short joy0dat, potgor;
49 dx = nx - amimouse_lastx;
50 dy = ny - amimouse_lasty;
52 if (dx < -127) dx = (256 + nx) - amimouse_lastx;
53 if (dx > 127) dx = (nx - 256) - amimouse_lastx;
54 if (dy < -127) dy = (256 + ny) - amimouse_lasty;
55 if (dy > 127) dy = (ny - 256) - amimouse_lasty;
62 input_report_rel(dev,
REL_X, dx);
63 input_report_rel(dev,
REL_Y, dy);
66 input_report_key(dev,
BTN_MIDDLE, potgor & 0x0100);
67 input_report_key(dev,
BTN_RIGHT, potgor & 0x0400);
74 static int amimouse_open(
struct input_dev *dev)
76 unsigned short joy0dat;
81 amimouse_lastx = joy0dat & 0xff;
82 amimouse_lasty = joy0dat >> 8;
92 static void amimouse_close(
struct input_dev *dev)
100 struct input_dev *
dev;
102 dev = input_allocate_device();
106 dev->name = pdev->
name;
107 dev->phys =
"amimouse/input0";
109 dev->id.vendor = 0x0001;
110 dev->id.product = 0x0002;
111 dev->id.version = 0x0100;
117 dev->open = amimouse_open;
118 dev->close = amimouse_close;
119 dev->dev.parent = &pdev->
dev;
121 err = input_register_device(dev);
123 input_free_device(dev);
127 platform_set_drvdata(pdev, dev);
134 struct input_dev *dev = platform_get_drvdata(pdev);
136 platform_set_drvdata(pdev,
NULL);
137 input_unregister_device(dev);
142 .remove =
__exit_p(amimouse_remove),
144 .name =
"amiga-mouse",
149 static int __init amimouse_init(
void)
156 static void __exit amimouse_exit(
void)