]> git.hungrycats.org Git - linux/commitdiff
Update the input handler modules to latest versions.
authorVojtech Pavlik <vojtech@twilight.ucw.cz>
Wed, 3 Jul 2002 17:26:19 +0000 (19:26 +0200)
committerVojtech Pavlik <vojtech@twilight.ucw.cz>
Wed, 3 Jul 2002 17:26:19 +0000 (19:26 +0200)
drivers/input/evdev.c
drivers/input/input.c
drivers/input/joydev.c
drivers/input/keybdev.c
drivers/input/mousedev.c

index 413002ffa57428a784d9a4d05727fdbd442e0e37..af76d0c921dfb3134bf7dd19a6c31b2b7f9d3af9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: evdev.c,v 1.42 2002/01/02 11:59:56 vojtech Exp $
+ * $Id: evdev.c,v 1.48 2002/05/26 14:28:26 jdeneux Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
  *
@@ -40,7 +40,6 @@
 struct evdev {
        int exist;
        int open;
-       int open_for_write;
        int minor;
        char name[16];
        struct input_handle handle;
@@ -91,7 +90,9 @@ static int evdev_fasync(int fd, struct file *file, int on)
 
 static int evdev_flush(struct file * file)
 {
-       return input_flush_device(&((struct evdev_list*)file->private_data)->evdev->handle, file);
+       struct evdev_list *list = (struct evdev_list*)file->private_data;
+       if (!list->evdev->exist) return -ENODEV;
+       return input_flush_device(&list->evdev->handle, file);
 }
 
 static int evdev_release(struct inode * inode, struct file * file)
@@ -158,6 +159,8 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
        struct input_event event;
        int retval = 0;
 
+       if (!list->evdev->exist) return -ENODEV;
+
        while (retval < count) {
 
                if (copy_from_user(&event, buffer + retval, sizeof(struct input_event)))
@@ -232,6 +235,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        struct input_dev *dev = evdev->handle.dev;
        int retval, t, u;
 
+       if (!evdev->exist) return -ENODEV;
+
        switch (cmd) {
 
                case EVIOCGVERSION:
@@ -284,11 +289,11 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                                int err;
 
                                if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) {
-                                       return -EINVAL;
+                                       return -EFAULT;
                                }
                                err = dev->upload_effect(dev, &effect);
                                if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) {
-                                       return -EINVAL;
+                                       return -EFAULT;
                                }
                                return err;
                        }
@@ -301,7 +306,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        else return -ENOSYS;
 
                case EVIOCGEFFECTS:
-                       put_user(dev->ff_effects_max, (int*) arg);
+                       if (retval = put_user(dev->ff_effects_max, (int*) arg))
+                               return -EFAULT;
                        return 0;
 
                default:
index e80f4a4c87327303cba739f57eac843dbf6d6bcd..93241c7d577e8f2ac575f4c32cdcd81d3e074a58 100644 (file)
@@ -61,8 +61,6 @@ static struct input_dev *input_dev;
 static struct input_handler *input_handler;
 static struct input_handler *input_table[8];
 static devfs_handle_t input_devfs_handle;
-static int input_number;
-static long input_devices[NBITS(INPUT_DEVICES)];
 
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *proc_bus_input_dir;
@@ -454,17 +452,8 @@ void input_register_device(struct input_dev *dev)
  * Add the device.
  */
 
-       if (input_number >= INPUT_DEVICES) {
-               printk(KERN_WARNING "input: ran out of input device numbers!\n");
-               dev->number = input_number;
-       } else {
-               dev->number = find_first_zero_bit(input_devices, INPUT_DEVICES);
-               set_bit(dev->number, input_devices);
-       }
-               
        dev->next = input_dev;  
        input_dev = dev;
-       input_number++;
 
 /*
  * Notify handlers.
@@ -493,7 +482,6 @@ void input_register_device(struct input_dev *dev)
        input_devices_state++;
        wake_up(&input_devices_poll_wait);
 #endif
-
 }
 
 void input_unregister_device(struct input_dev *dev)
@@ -509,7 +497,6 @@ void input_unregister_device(struct input_dev *dev)
        if (dev->pm_dev)
                pm_unregister(dev->pm_dev);
 
-
 /*
  * Kill any pending repeat timers.
  */
@@ -540,7 +527,6 @@ void input_unregister_device(struct input_dev *dev)
  */
        input_find_and_remove(struct input_dev, input_dev, dev, next);
 
-       input_number--;
 /*
  * Notify /proc.
  */
index e5b845e2946864f160c5d7895a180eb66169e4a1..416aace2a2a11d56ddd675aa13a6401e12cb828c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: joydev.c,v 1.38 2001/12/27 10:37:41 vojtech Exp $
+ * $Id: joydev.c,v 1.43 2002/04/09 23:59:01 jsimmons Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik 
  *  Copyright (c) 1999 Colin Van Dyke 
@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("input/js");
 MODULE_LICENSE("GPL");
 
 #define JOYDEV_MINOR_BASE      0
-#define JOYDEV_MINORS          32
+#define JOYDEV_MINORS          16      
 #define JOYDEV_BUFFER_SIZE     64
 
 #define MSECS(t)       (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
@@ -254,6 +254,10 @@ static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *p
 
                while (list->head == list->tail) {
 
+                       if (!joydev->exist) {
+                               retval = -ENODEV;
+                               break;
+                       }
                        if (file->f_flags & O_NONBLOCK) {
                                retval = -EAGAIN;
                                break;
@@ -325,6 +329,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
        struct input_dev *dev = joydev->handle.dev;
        int i;
 
+       if (!joydev->exist) return -ENODEV;
+
        switch (cmd) {
 
                case JS_SET_CAL:
index 6731dd2542c2cefebc83f857ec39d6493b0a132a..8a5a93b57f7adfc2f48d8b13bcedc1d2d4999eb9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: keybdev.c,v 1.16 2002/01/09 04:21:41 lethal Exp $
+ * $Id: keybdev.c,v 1.19 2002/03/13 10:09:20 vojtech Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
  *
@@ -179,7 +179,7 @@ void panic_blink(void)
        static unsigned long last_jiffie;
        static char led;
        /* Roughly 1/2s frequency. KDB uses about 1s. Make sure it is different. */
-       if (jiffies - last_jiffie > HZ/2) {
+       if (time_after(jiffies, last_jiffie + HZ/2)) {
                led ^= 0x01 | 0x04;
                keybdev_ledfunc(led);
                last_jiffie = jiffies;
index 01fb98c7f30fac0b2aa982b61bc54770456977e4..a5b4152e2c974e8f17424814b6e616e80e75b4cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mousedev.c,v 1.38 2001/12/26 21:08:33 jsimmons Exp $
+ * $Id: mousedev.c,v 1.42 2002/04/09 20:51:26 jdeneux Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
  *
 #include <linux/config.h>
 #include <linux/smp_lock.h>
 #include <linux/random.h>
+#include <linux/major.h>
+#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
+#include <linux/miscdevice.h>
+#endif
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
 MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces");
@@ -225,7 +229,14 @@ static int mousedev_release(struct inode * inode, struct file * file)
 static int mousedev_open(struct inode * inode, struct file * file)
 {
        struct mousedev_list *list;
-       int i = minor(inode->i_rdev) - MOUSEDEV_MINOR_BASE;
+       int i;
+
+#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
+       if (major(inode->i_rdev) == MISC_MAJOR)
+               i = MOUSEDEV_MIX;
+       else
+#endif
+               i = minor(inode->i_rdev) - MOUSEDEV_MINOR_BASE;
 
        if (i >= MOUSEDEV_MINORS || !mousedev_table[i])
                return -ENODEV;
@@ -494,6 +505,12 @@ static struct input_handler mousedev_handler = {
        id_table:       mousedev_ids,
 };
 
+#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
+static struct miscdevice psaux_mouse = {
+       PSMOUSE_MINOR, "psaux", &mousedev_fops
+};
+#endif
+
 static int __init mousedev_init(void)
 {
        input_register_handler(&mousedev_handler);
@@ -504,6 +521,9 @@ static int __init mousedev_init(void)
        mousedev_mix.exist = 1;
        mousedev_mix.minor = MOUSEDEV_MIX;
        mousedev_mix.devfs = input_register_minor("mice", MOUSEDEV_MIX, MOUSEDEV_MINOR_BASE);
+#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
+       misc_register(&psaux_mouse);
+#endif
 
        printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
 
@@ -512,6 +532,9 @@ static int __init mousedev_init(void)
 
 static void __exit mousedev_exit(void)
 {
+#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
+       misc_deregister(&psaux_mouse);
+#endif
        input_unregister_minor(mousedev_mix.devfs);
        input_unregister_handler(&mousedev_handler);
 }