36 #include <linux/module.h>
40 #include <linux/input.h>
50 #define LOGIBM_BASE 0x23c
51 #define LOGIBM_EXTENT 4
53 #define LOGIBM_DATA_PORT LOGIBM_BASE + 0
54 #define LOGIBM_SIGNATURE_PORT LOGIBM_BASE + 1
55 #define LOGIBM_CONTROL_PORT LOGIBM_BASE + 2
56 #define LOGIBM_CONFIG_PORT LOGIBM_BASE + 3
58 #define LOGIBM_ENABLE_IRQ 0x00
59 #define LOGIBM_DISABLE_IRQ 0x10
60 #define LOGIBM_READ_X_LOW 0x80
61 #define LOGIBM_READ_X_HIGH 0xa0
62 #define LOGIBM_READ_Y_LOW 0xc0
63 #define LOGIBM_READ_Y_HIGH 0xe0
65 #define LOGIBM_DEFAULT_MODE 0x90
66 #define LOGIBM_CONFIG_BYTE 0x91
67 #define LOGIBM_SIGNATURE_BYTE 0xa5
75 static struct input_dev *logibm_dev;
90 dy |= (buttons & 0xf) << 4;
91 buttons = ~buttons >> 5;
93 input_report_rel(logibm_dev,
REL_X, dx);
94 input_report_rel(logibm_dev,
REL_Y, dy);
95 input_report_key(logibm_dev,
BTN_RIGHT, buttons & 1);
96 input_report_key(logibm_dev,
BTN_MIDDLE, buttons & 2);
97 input_report_key(logibm_dev,
BTN_LEFT, buttons & 4);
98 input_sync(logibm_dev);
104 static int logibm_open(
struct input_dev *
dev)
114 static void logibm_close(
struct input_dev *dev)
120 static int __init logibm_init(
void)
136 goto err_release_region;
142 logibm_dev = input_allocate_device();
144 printk(
KERN_ERR "logibm.c: Not enough memory for input device\n");
146 goto err_release_region;
149 logibm_dev->name =
"Logitech bus mouse";
150 logibm_dev->phys =
"isa023c/input0";
151 logibm_dev->id.bustype =
BUS_ISA;
152 logibm_dev->id.vendor = 0x0003;
153 logibm_dev->id.product = 0x0001;
154 logibm_dev->id.version = 0x0100;
161 logibm_dev->open = logibm_open;
162 logibm_dev->close = logibm_close;
164 err = input_register_device(logibm_dev);
171 input_free_device(logibm_dev);
178 static void __exit logibm_exit(
void)
180 input_unregister_device(logibm_dev);