2 * Input driver to ExplorerPS/2 device driver module.
4 * Copyright (c) 1999-2002 Vojtech Pavlik
5 * Copyright (c) 2004 Dmitry Torokhov
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
12 #define MOUSEDEV_MINOR_BASE 32
13 #define MOUSEDEV_MINORS 32
14 #define MOUSEDEV_MIX 31
16 #include <linux/slab.h>
17 #include <linux/poll.h>
18 #include <linux/module.h>
19 #include <linux/moduleparam.h>
20 #include <linux/init.h>
21 #include <linux/input.h>
22 #include <linux/random.h>
23 #include <linux/major.h>
24 #include <linux/device.h>
25 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
26 #include <linux/miscdevice.h>
29 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
30 MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces");
31 MODULE_LICENSE("GPL");
33 #ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X
34 #define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
36 #ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_Y
37 #define CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768
40 static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X;
41 module_param(xres, uint, 0644);
42 MODULE_PARM_DESC(xres, "Horizontal screen resolution");
44 static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y;
45 module_param(yres, uint, 0644);
46 MODULE_PARM_DESC(yres, "Vertical screen resolution");
48 static unsigned tap_time = 200;
49 module_param(tap_time, uint, 0644);
50 MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)");
52 struct mousedev_hw_data {
56 unsigned long buttons;
64 wait_queue_head_t wait;
65 struct list_head client_list;
66 struct input_handle handle;
69 struct list_head mixdev_node;
72 struct mousedev_hw_data packet;
73 unsigned int pkt_count;
74 int old_x[4], old_y[4];
85 struct mousedev_motion {
87 unsigned long buttons;
90 #define PACKET_QUEUE_LEN 16
91 struct mousedev_client {
92 struct fasync_struct *fasync;
93 struct mousedev *mousedev;
94 struct list_head node;
96 struct mousedev_motion packets[PACKET_QUEUE_LEN];
97 unsigned int head, tail;
98 spinlock_t packet_lock;
102 unsigned char ready, buffer, bufsiz;
103 unsigned char imexseq, impsseq;
104 enum mousedev_emul mode;
105 unsigned long last_buttons;
108 #define MOUSEDEV_SEQ_LEN 6
110 static unsigned char mousedev_imps_seq[] = { 0xf3, 200, 0xf3, 100, 0xf3, 80 };
111 static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 };
113 static struct input_handler mousedev_handler;
115 static struct mousedev *mousedev_table[MOUSEDEV_MINORS];
116 static struct mousedev *mousedev_mix;
117 static LIST_HEAD(mousedev_mix_list);
119 #define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
120 #define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
122 static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value)
125 enum { FRACTION_DENOM = 128 };
130 if (mousedev->touch && mousedev->pkt_count >= 2) {
131 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
134 tmp = ((value - fx(2)) * (256 * FRACTION_DENOM)) / size;
135 tmp += mousedev->frac_dx;
136 mousedev->packet.dx = tmp / FRACTION_DENOM;
137 mousedev->frac_dx = tmp - mousedev->packet.dx * FRACTION_DENOM;
143 if (mousedev->touch && mousedev->pkt_count >= 2) {
144 /* use X size to keep the same scale */
145 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
148 tmp = -((value - fy(2)) * (256 * FRACTION_DENOM)) / size;
149 tmp += mousedev->frac_dy;
150 mousedev->packet.dy = tmp / FRACTION_DENOM;
151 mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM;
157 static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value)
163 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
166 if (value > dev->absmax[ABS_X])
167 value = dev->absmax[ABS_X];
168 if (value < dev->absmin[ABS_X])
169 value = dev->absmin[ABS_X];
170 mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size;
171 mousedev->packet.abs_event = 1;
175 size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y];
178 if (value > dev->absmax[ABS_Y])
179 value = dev->absmax[ABS_Y];
180 if (value < dev->absmin[ABS_Y])
181 value = dev->absmin[ABS_Y];
182 mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size;
183 mousedev->packet.abs_event = 1;
188 static void mousedev_rel_event(struct mousedev *mousedev, unsigned int code, int value)
191 case REL_X: mousedev->packet.dx += value; break;
192 case REL_Y: mousedev->packet.dy -= value; break;
193 case REL_WHEEL: mousedev->packet.dz -= value; break;
197 static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int value)
204 case BTN_LEFT: index = 0; break;
207 case BTN_RIGHT: index = 1; break;
211 case BTN_MIDDLE: index = 2; break;
214 case BTN_SIDE: index = 3; break;
216 case BTN_EXTRA: index = 4; break;
221 set_bit(index, &mousedev->packet.buttons);
222 set_bit(index, &mousedev_mix->packet.buttons);
224 clear_bit(index, &mousedev->packet.buttons);
225 clear_bit(index, &mousedev_mix->packet.buttons);
229 static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet)
231 struct mousedev_client *client;
232 struct mousedev_motion *p;
234 int wake_readers = 0;
236 list_for_each_entry(client, &mousedev->client_list, node) {
237 spin_lock_irqsave(&client->packet_lock, flags);
239 p = &client->packets[client->head];
240 if (client->ready && p->buttons != mousedev->packet.buttons) {
241 unsigned int new_head = (client->head + 1) % PACKET_QUEUE_LEN;
242 if (new_head != client->tail) {
243 p = &client->packets[client->head = new_head];
244 memset(p, 0, sizeof(struct mousedev_motion));
248 if (packet->abs_event) {
249 p->dx += packet->x - client->pos_x;
250 p->dy += packet->y - client->pos_y;
251 client->pos_x = packet->x;
252 client->pos_y = packet->y;
255 client->pos_x += packet->dx;
256 client->pos_x = client->pos_x < 0 ? 0 : (client->pos_x >= xres ? xres : client->pos_x);
257 client->pos_y += packet->dy;
258 client->pos_y = client->pos_y < 0 ? 0 : (client->pos_y >= yres ? yres : client->pos_y);
263 p->buttons = mousedev->packet.buttons;
265 if (p->dx || p->dy || p->dz || p->buttons != client->last_buttons)
268 spin_unlock_irqrestore(&client->packet_lock, flags);
271 kill_fasync(&client->fasync, SIGIO, POLL_IN);
277 wake_up_interruptible(&mousedev->wait);
280 static void mousedev_touchpad_touch(struct mousedev *mousedev, int value)
283 if (mousedev->touch &&
284 time_before(jiffies, mousedev->touch + msecs_to_jiffies(tap_time))) {
286 * Toggle left button to emulate tap.
287 * We rely on the fact that mousedev_mix always has 0
288 * motion packet so we won't mess current position.
290 set_bit(0, &mousedev->packet.buttons);
291 set_bit(0, &mousedev_mix->packet.buttons);
292 mousedev_notify_readers(mousedev, &mousedev_mix->packet);
293 mousedev_notify_readers(mousedev_mix, &mousedev_mix->packet);
294 clear_bit(0, &mousedev->packet.buttons);
295 clear_bit(0, &mousedev_mix->packet.buttons);
297 mousedev->touch = mousedev->pkt_count = 0;
298 mousedev->frac_dx = 0;
299 mousedev->frac_dy = 0;
301 } else if (!mousedev->touch)
302 mousedev->touch = jiffies;
305 static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
307 struct mousedev *mousedev = handle->private;
311 /* Ignore joysticks */
312 if (test_bit(BTN_TRIGGER, handle->dev->keybit))
315 if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit))
316 mousedev_touchpad_event(handle->dev, mousedev, code, value);
318 mousedev_abs_event(handle->dev, mousedev, code, value);
323 mousedev_rel_event(mousedev, code, value);
328 if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit))
329 mousedev_touchpad_touch(mousedev, value);
331 mousedev_key_event(mousedev, code, value);
336 if (code == SYN_REPORT) {
337 if (mousedev->touch) {
338 mousedev->pkt_count++;
339 /* Input system eats duplicate events, but we need all of them
340 * to do correct averaging so apply present one forward
346 mousedev_notify_readers(mousedev, &mousedev->packet);
347 mousedev_notify_readers(mousedev_mix, &mousedev->packet);
349 mousedev->packet.dx = mousedev->packet.dy = mousedev->packet.dz = 0;
350 mousedev->packet.abs_event = 0;
356 static int mousedev_fasync(int fd, struct file *file, int on)
359 struct mousedev_client *client = file->private_data;
361 retval = fasync_helper(fd, file, on, &client->fasync);
363 return retval < 0 ? retval : 0;
366 static void mousedev_free(struct device *dev)
368 struct mousedev *mousedev = container_of(dev, struct mousedev, dev);
370 mousedev_table[mousedev->minor] = NULL;
374 static int mixdev_add_device(struct mousedev *mousedev)
378 if (mousedev_mix->open) {
379 error = input_open_device(&mousedev->handle);
384 mousedev->mixdev_open = 1;
387 get_device(&mousedev->dev);
388 list_add_tail(&mousedev->mixdev_node, &mousedev_mix_list);
393 static void mixdev_remove_device(struct mousedev *mousedev)
395 if (mousedev->mixdev_open) {
396 mousedev->mixdev_open = 0;
397 if (!--mousedev->open && mousedev->exist)
398 input_close_device(&mousedev->handle);
401 list_del_init(&mousedev->mixdev_node);
402 put_device(&mousedev->dev);
405 static void mixdev_open_devices(void)
407 struct mousedev *mousedev;
409 if (mousedev_mix->open++)
412 list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
413 if (!mousedev->mixdev_open) {
414 if (!mousedev->open && mousedev->exist)
415 if (input_open_device(&mousedev->handle))
419 mousedev->mixdev_open = 1;
424 static void mixdev_close_devices(void)
426 struct mousedev *mousedev;
428 if (--mousedev_mix->open)
431 list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
432 if (mousedev->mixdev_open) {
433 mousedev->mixdev_open = 0;
434 if (!--mousedev->open && mousedev->exist)
435 input_close_device(&mousedev->handle);
440 static int mousedev_release(struct inode *inode, struct file *file)
442 struct mousedev_client *client = file->private_data;
443 struct mousedev *mousedev = client->mousedev;
445 mousedev_fasync(-1, file, 0);
447 list_del(&client->node);
450 if (mousedev->minor == MOUSEDEV_MIX)
451 mixdev_close_devices();
452 else if (!--mousedev->open && mousedev->exist)
453 input_close_device(&mousedev->handle);
455 put_device(&mousedev->dev);
461 static int mousedev_open(struct inode *inode, struct file *file)
463 struct mousedev_client *client;
464 struct mousedev *mousedev;
468 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
469 if (imajor(inode) == MISC_MAJOR)
473 i = iminor(inode) - MOUSEDEV_MINOR_BASE;
475 if (i >= MOUSEDEV_MINORS)
478 mousedev = mousedev_table[i];
482 get_device(&mousedev->dev);
484 client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
487 goto err_put_mousedev;
490 spin_lock_init(&client->packet_lock);
491 client->pos_x = xres / 2;
492 client->pos_y = yres / 2;
493 client->mousedev = mousedev;
494 list_add_tail(&client->node, &mousedev->client_list);
496 if (mousedev->minor == MOUSEDEV_MIX)
497 mixdev_open_devices();
498 else if (!mousedev->open++ && mousedev->exist) {
499 error = input_open_device(&mousedev->handle);
501 goto err_free_client;
504 file->private_data = client;
508 list_del(&client->node);
511 put_device(&mousedev->dev);
515 static inline int mousedev_limit_delta(int delta, int limit)
517 return delta > limit ? limit : (delta < -limit ? -limit : delta);
520 static void mousedev_packet(struct mousedev_client *client, signed char *ps2_data)
522 struct mousedev_motion *p;
525 spin_lock_irqsave(&client->packet_lock, flags);
526 p = &client->packets[client->tail];
528 ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07);
529 ps2_data[1] = mousedev_limit_delta(p->dx, 127);
530 ps2_data[2] = mousedev_limit_delta(p->dy, 127);
531 p->dx -= ps2_data[1];
532 p->dy -= ps2_data[2];
534 switch (client->mode) {
535 case MOUSEDEV_EMUL_EXPS:
536 ps2_data[3] = mousedev_limit_delta(p->dz, 7);
537 p->dz -= ps2_data[3];
538 ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1);
542 case MOUSEDEV_EMUL_IMPS:
543 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1);
544 ps2_data[3] = mousedev_limit_delta(p->dz, 127);
545 p->dz -= ps2_data[3];
549 case MOUSEDEV_EMUL_PS2:
551 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1);
557 if (!p->dx && !p->dy && !p->dz) {
558 if (client->tail == client->head) {
560 client->last_buttons = p->buttons;
562 client->tail = (client->tail + 1) % PACKET_QUEUE_LEN;
565 spin_unlock_irqrestore(&client->packet_lock, flags);
569 static ssize_t mousedev_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
571 struct mousedev_client *client = file->private_data;
575 for (i = 0; i < count; i++) {
577 if (get_user(c, buffer + i))
580 if (c == mousedev_imex_seq[client->imexseq]) {
581 if (++client->imexseq == MOUSEDEV_SEQ_LEN) {
583 client->mode = MOUSEDEV_EMUL_EXPS;
588 if (c == mousedev_imps_seq[client->impsseq]) {
589 if (++client->impsseq == MOUSEDEV_SEQ_LEN) {
591 client->mode = MOUSEDEV_EMUL_IMPS;
596 client->ps2[0] = 0xfa;
600 case 0xeb: /* Poll */
601 mousedev_packet(client, &client->ps2[1]);
602 client->bufsiz++; /* account for leading ACK */
605 case 0xf2: /* Get ID */
606 switch (client->mode) {
607 case MOUSEDEV_EMUL_PS2: client->ps2[1] = 0; break;
608 case MOUSEDEV_EMUL_IMPS: client->ps2[1] = 3; break;
609 case MOUSEDEV_EMUL_EXPS: client->ps2[1] = 4; break;
614 case 0xe9: /* Get info */
615 client->ps2[1] = 0x60; client->ps2[2] = 3; client->ps2[3] = 200;
619 case 0xff: /* Reset */
620 client->impsseq = client->imexseq = 0;
621 client->mode = MOUSEDEV_EMUL_PS2;
622 client->ps2[1] = 0xaa; client->ps2[2] = 0x00;
631 client->buffer = client->bufsiz;
634 kill_fasync(&client->fasync, SIGIO, POLL_IN);
636 wake_up_interruptible(&client->mousedev->wait);
641 static ssize_t mousedev_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
643 struct mousedev_client *client = file->private_data;
646 if (!client->ready && !client->buffer && (file->f_flags & O_NONBLOCK))
649 retval = wait_event_interruptible(client->mousedev->wait,
650 !client->mousedev->exist || client->ready || client->buffer);
655 if (!client->mousedev->exist)
658 if (!client->buffer && client->ready) {
659 mousedev_packet(client, client->ps2);
660 client->buffer = client->bufsiz;
663 if (count > client->buffer)
664 count = client->buffer;
666 client->buffer -= count;
668 if (copy_to_user(buffer, client->ps2 + client->bufsiz - client->buffer - count, count))
674 /* No kernel lock - fine */
675 static unsigned int mousedev_poll(struct file *file, poll_table *wait)
677 struct mousedev_client *client = file->private_data;
678 struct mousedev *mousedev = client->mousedev;
680 poll_wait(file, &mousedev->wait, wait);
681 return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) |
682 (mousedev->exist ? 0 : (POLLHUP | POLLERR));
685 static const struct file_operations mousedev_fops = {
686 .owner = THIS_MODULE,
687 .read = mousedev_read,
688 .write = mousedev_write,
689 .poll = mousedev_poll,
690 .open = mousedev_open,
691 .release = mousedev_release,
692 .fasync = mousedev_fasync,
695 static struct mousedev *mousedev_create(struct input_dev *dev,
696 struct input_handler *handler,
699 struct mousedev *mousedev;
702 mousedev = kzalloc(sizeof(struct mousedev), GFP_KERNEL);
708 INIT_LIST_HEAD(&mousedev->client_list);
709 INIT_LIST_HEAD(&mousedev->mixdev_node);
710 init_waitqueue_head(&mousedev->wait);
712 if (minor == MOUSEDEV_MIX)
713 strlcpy(mousedev->name, "mice", sizeof(mousedev->name));
715 snprintf(mousedev->name, sizeof(mousedev->name),
718 mousedev->minor = minor;
720 mousedev->handle.dev = dev;
721 mousedev->handle.name = mousedev->name;
722 mousedev->handle.handler = handler;
723 mousedev->handle.private = mousedev;
725 strlcpy(mousedev->dev.bus_id, mousedev->name,
726 sizeof(mousedev->dev.bus_id));
727 mousedev->dev.class = &input_class;
729 mousedev->dev.parent = &dev->dev;
730 mousedev->dev.devt = MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor);
731 mousedev->dev.release = mousedev_free;
732 device_initialize(&mousedev->dev);
734 mousedev_table[minor] = mousedev;
736 error = device_add(&mousedev->dev);
738 goto err_free_mousedev;
743 put_device(&mousedev->dev);
745 return ERR_PTR(error);
748 static void mousedev_destroy(struct mousedev *mousedev)
750 struct mousedev_client *client;
752 device_del(&mousedev->dev);
755 if (mousedev->open) {
756 input_close_device(&mousedev->handle);
757 list_for_each_entry(client, &mousedev->client_list, node)
758 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
759 wake_up_interruptible(&mousedev->wait);
762 put_device(&mousedev->dev);
765 static int mousedev_connect(struct input_handler *handler, struct input_dev *dev,
766 const struct input_device_id *id)
768 struct mousedev *mousedev;
772 for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++);
773 if (minor == MOUSEDEV_MINORS) {
774 printk(KERN_ERR "mousedev: no more free mousedev devices\n");
778 mousedev = mousedev_create(dev, handler, minor);
779 if (IS_ERR(mousedev))
780 return PTR_ERR(mousedev);
782 error = input_register_handle(&mousedev->handle);
784 goto err_delete_mousedev;
786 error = mixdev_add_device(mousedev);
788 goto err_unregister_handle;
792 err_unregister_handle:
793 input_unregister_handle(&mousedev->handle);
795 device_unregister(&mousedev->dev);
799 static void mousedev_disconnect(struct input_handle *handle)
801 struct mousedev *mousedev = handle->private;
803 mixdev_remove_device(mousedev);
804 input_unregister_handle(handle);
805 mousedev_destroy(mousedev);
808 static const struct input_device_id mousedev_ids[] = {
810 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
811 .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
812 .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) },
813 .relbit = { BIT(REL_X) | BIT(REL_Y) },
814 }, /* A mouse like device, at least one button, two relative axes */
816 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
817 .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
818 .relbit = { BIT(REL_WHEEL) },
819 }, /* A separate scrollwheel */
821 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
822 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
823 .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) },
824 .absbit = { BIT(ABS_X) | BIT(ABS_Y) },
825 }, /* A tablet like device, at least touch detection, two absolute axes */
827 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
828 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
829 .keybit = { [LONG(BTN_TOOL_FINGER)] = BIT(BTN_TOOL_FINGER) },
830 .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) },
833 { }, /* Terminating entry */
836 MODULE_DEVICE_TABLE(input, mousedev_ids);
838 static struct input_handler mousedev_handler = {
839 .event = mousedev_event,
840 .connect = mousedev_connect,
841 .disconnect = mousedev_disconnect,
842 .fops = &mousedev_fops,
843 .minor = MOUSEDEV_MINOR_BASE,
845 .id_table = mousedev_ids,
848 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
849 static struct miscdevice psaux_mouse = {
850 PSMOUSE_MINOR, "psaux", &mousedev_fops
852 static int psaux_registered;
855 static int __init mousedev_init(void)
859 mousedev_mix = mousedev_create(NULL, &mousedev_handler, MOUSEDEV_MIX);
860 if (IS_ERR(mousedev_mix))
861 return PTR_ERR(mousedev_mix);
863 error = input_register_handler(&mousedev_handler);
865 mousedev_destroy(mousedev_mix);
869 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
870 error = misc_register(&psaux_mouse);
872 printk(KERN_WARNING "mice: could not register psaux device, "
873 "error: %d\n", error);
875 psaux_registered = 1;
878 printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
883 static void __exit mousedev_exit(void)
885 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
886 if (psaux_registered)
887 misc_deregister(&psaux_mouse);
889 input_unregister_handler(&mousedev_handler);
890 mousedev_destroy(mousedev_mix);
893 module_init(mousedev_init);
894 module_exit(mousedev_exit);