Commit 6b931089 authored by Vojtech Pavlik's avatar Vojtech Pavlik

Update the input handler modules to latest versions.

parent 29886383
/* /*
* $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 * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
struct evdev { struct evdev {
int exist; int exist;
int open; int open;
int open_for_write;
int minor; int minor;
char name[16]; char name[16];
struct input_handle handle; struct input_handle handle;
...@@ -91,7 +90,9 @@ static int evdev_fasync(int fd, struct file *file, int on) ...@@ -91,7 +90,9 @@ static int evdev_fasync(int fd, struct file *file, int on)
static int evdev_flush(struct file * file) 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) 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 ...@@ -158,6 +159,8 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
struct input_event event; struct input_event event;
int retval = 0; int retval = 0;
if (!list->evdev->exist) return -ENODEV;
while (retval < count) { while (retval < count) {
if (copy_from_user(&event, buffer + retval, sizeof(struct input_event))) 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, ...@@ -232,6 +235,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct input_dev *dev = evdev->handle.dev; struct input_dev *dev = evdev->handle.dev;
int retval, t, u; int retval, t, u;
if (!evdev->exist) return -ENODEV;
switch (cmd) { switch (cmd) {
case EVIOCGVERSION: case EVIOCGVERSION:
...@@ -284,11 +289,11 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -284,11 +289,11 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int err; int err;
if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) { if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) {
return -EINVAL; return -EFAULT;
} }
err = dev->upload_effect(dev, &effect); err = dev->upload_effect(dev, &effect);
if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) { if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) {
return -EINVAL; return -EFAULT;
} }
return err; return err;
} }
...@@ -301,7 +306,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -301,7 +306,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
else return -ENOSYS; else return -ENOSYS;
case EVIOCGEFFECTS: case EVIOCGEFFECTS:
put_user(dev->ff_effects_max, (int*) arg); if (retval = put_user(dev->ff_effects_max, (int*) arg))
return -EFAULT;
return 0; return 0;
default: default:
......
...@@ -61,8 +61,6 @@ static struct input_dev *input_dev; ...@@ -61,8 +61,6 @@ static struct input_dev *input_dev;
static struct input_handler *input_handler; static struct input_handler *input_handler;
static struct input_handler *input_table[8]; static struct input_handler *input_table[8];
static devfs_handle_t input_devfs_handle; static devfs_handle_t input_devfs_handle;
static int input_number;
static long input_devices[NBITS(INPUT_DEVICES)];
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_bus_input_dir; static struct proc_dir_entry *proc_bus_input_dir;
...@@ -454,17 +452,8 @@ void input_register_device(struct input_dev *dev) ...@@ -454,17 +452,8 @@ void input_register_device(struct input_dev *dev)
* Add the device. * 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; dev->next = input_dev;
input_dev = dev; input_dev = dev;
input_number++;
/* /*
* Notify handlers. * Notify handlers.
...@@ -493,7 +482,6 @@ void input_register_device(struct input_dev *dev) ...@@ -493,7 +482,6 @@ void input_register_device(struct input_dev *dev)
input_devices_state++; input_devices_state++;
wake_up(&input_devices_poll_wait); wake_up(&input_devices_poll_wait);
#endif #endif
} }
void input_unregister_device(struct input_dev *dev) void input_unregister_device(struct input_dev *dev)
...@@ -509,7 +497,6 @@ void input_unregister_device(struct input_dev *dev) ...@@ -509,7 +497,6 @@ void input_unregister_device(struct input_dev *dev)
if (dev->pm_dev) if (dev->pm_dev)
pm_unregister(dev->pm_dev); pm_unregister(dev->pm_dev);
/* /*
* Kill any pending repeat timers. * Kill any pending repeat timers.
*/ */
...@@ -540,7 +527,6 @@ void input_unregister_device(struct input_dev *dev) ...@@ -540,7 +527,6 @@ void input_unregister_device(struct input_dev *dev)
*/ */
input_find_and_remove(struct input_dev, input_dev, dev, next); input_find_and_remove(struct input_dev, input_dev, dev, next);
input_number--;
/* /*
* Notify /proc. * Notify /proc.
*/ */
......
/* /*
* $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-2001 Vojtech Pavlik
* Copyright (c) 1999 Colin Van Dyke * Copyright (c) 1999 Colin Van Dyke
...@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("input/js"); ...@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("input/js");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define JOYDEV_MINOR_BASE 0 #define JOYDEV_MINOR_BASE 0
#define JOYDEV_MINORS 32 #define JOYDEV_MINORS 16
#define JOYDEV_BUFFER_SIZE 64 #define JOYDEV_BUFFER_SIZE 64
#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) #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 ...@@ -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) { while (list->head == list->tail) {
if (!joydev->exist) {
retval = -ENODEV;
break;
}
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN; retval = -EAGAIN;
break; break;
...@@ -325,6 +329,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -325,6 +329,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
struct input_dev *dev = joydev->handle.dev; struct input_dev *dev = joydev->handle.dev;
int i; int i;
if (!joydev->exist) return -ENODEV;
switch (cmd) { switch (cmd) {
case JS_SET_CAL: case JS_SET_CAL:
......
/* /*
* $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 * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -179,7 +179,7 @@ void panic_blink(void) ...@@ -179,7 +179,7 @@ void panic_blink(void)
static unsigned long last_jiffie; static unsigned long last_jiffie;
static char led; static char led;
/* Roughly 1/2s frequency. KDB uses about 1s. Make sure it is different. */ /* 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; led ^= 0x01 | 0x04;
keybdev_ledfunc(led); keybdev_ledfunc(led);
last_jiffie = jiffies; last_jiffie = jiffies;
......
/* /*
* $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 * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/random.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_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces");
...@@ -225,7 +229,14 @@ static int mousedev_release(struct inode * inode, struct file * file) ...@@ -225,7 +229,14 @@ static int mousedev_release(struct inode * inode, struct file * file)
static int mousedev_open(struct inode * inode, struct file * file) static int mousedev_open(struct inode * inode, struct file * file)
{ {
struct mousedev_list *list; 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]) if (i >= MOUSEDEV_MINORS || !mousedev_table[i])
return -ENODEV; return -ENODEV;
...@@ -494,6 +505,12 @@ static struct input_handler mousedev_handler = { ...@@ -494,6 +505,12 @@ static struct input_handler mousedev_handler = {
id_table: mousedev_ids, 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) static int __init mousedev_init(void)
{ {
input_register_handler(&mousedev_handler); input_register_handler(&mousedev_handler);
...@@ -504,6 +521,9 @@ static int __init mousedev_init(void) ...@@ -504,6 +521,9 @@ static int __init mousedev_init(void)
mousedev_mix.exist = 1; mousedev_mix.exist = 1;
mousedev_mix.minor = MOUSEDEV_MIX; mousedev_mix.minor = MOUSEDEV_MIX;
mousedev_mix.devfs = input_register_minor("mice", MOUSEDEV_MIX, MOUSEDEV_MINOR_BASE); 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"); printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
...@@ -512,6 +532,9 @@ static int __init mousedev_init(void) ...@@ -512,6 +532,9 @@ static int __init mousedev_init(void)
static void __exit mousedev_exit(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_minor(mousedev_mix.devfs);
input_unregister_handler(&mousedev_handler); input_unregister_handler(&mousedev_handler);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment