patch-1.3.26 linux/drivers/char/busmouse.c
Next file: linux/drivers/char/mouse.c
Previous file: linux/drivers/char/atixlmouse.c
Back to the patch index
Back to the overall index
- Lines: 108
- Date:
Wed Sep 13 10:08:39 1995
- Orig file:
v1.3.25/linux/drivers/char/busmouse.c
- Orig date:
Wed Aug 2 13:21:00 1995
diff -u --recursive --new-file v1.3.25/linux/drivers/char/busmouse.c linux/drivers/char/busmouse.c
@@ -21,8 +21,21 @@
* removed assignment chr_fops[10] = &mouse_fops; see mouse.c
* renamed mouse_fops => bus_mouse_fops, made bus_mouse_fops public.
* renamed this file mouse.c => busmouse.c
+ *
+ * Minor addition by Cliff Matthews
+ * added fasync support
+ *
+ * Modularised 6-Sep-95 Philip Blundell <pjb27@cam.ac.uk>
*/
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/busmouse.h>
@@ -81,10 +94,23 @@
mouse.dy = -2048;
if (mouse.dy > 2048)
mouse.dy = 2048;
+
+ if (mouse.fasyncptr)
+ kill_fasync(mouse.fasyncptr, SIGIO);
}
MSE_INT_ON();
}
+static int fasync_mouse(struct inode *inode, struct file *filp, int on)
+{
+ int retval;
+
+ retval = fasync_helper(inode, filp, on, &mouse.fasyncptr);
+ if (retval < 0)
+ return retval;
+ return 0;
+}
+
/*
* close access to the mouse (can deal with multiple
* opens if allowed in the future)
@@ -96,6 +122,7 @@
MSE_INT_OFF();
free_irq(mouse_irq);
}
+ fasync_mouse(inode, file, 0);
}
/*
@@ -212,9 +239,21 @@
NULL, /* mouse_mmap */
open_mouse,
close_mouse,
+ NULL,
+ fasync_mouse,
};
+static struct mouse bus_mous = {
+ LOGITECH_BUSMOUSE, "busmouse", &bus_mouse_fops
+};
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+
+int init_module(void)
+#else
unsigned long bus_mouse_init(unsigned long kmem_start)
+#endif
{
int i;
@@ -224,7 +263,11 @@
/* busy loop */;
if (inb(MSE_SIGNATURE_PORT) != MSE_SIGNATURE_BYTE) {
mouse.present = 0;
+#ifdef MODULE
+ return -EIO;
+#else
return kmem_start;
+#endif
}
outb(MSE_DEFAULT_MODE, MSE_CONFIG_PORT);
MSE_INT_OFF();
@@ -237,5 +280,19 @@
mouse.wait = NULL;
printk("Logitech Bus mouse detected and installed with IRQ %d.\n",
mouse_irq);
+ mouse_register(&bus_mouse);
+#ifdef MODULE
+ return 0;
+#else
return kmem_start;
+#endif
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("busmouse: in use - remove delayed\n");
+ mouse_deregister(&bus_mouse);
}
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this