The joydev driver for USB-joysticks hasn't got devfs support. Here is a
patch to drivers/usb/joydev.c which fixes this. Obviously keybdev.c and
mousedev.c should be updated too, but since I don't have any USB
keyboards or mice I left that for someone else.
--- joydev.c.old Thu Mar 30 20:45:00 2000
+++ joydev.c Thu Mar 30 20:44:07 2000
@@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/joystick.h>
+#include <linux/devfs_fs_kernel.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/major.h>
@@ -50,6 +51,7 @@
struct joydev {
char name[32];
+ devfs_handle_t devfs_handle;
int used;
struct input_handle handle;
int minor;
@@ -78,6 +80,7 @@
static unsigned long joydev_minors = 0;
static struct joydev *joydev_base[BITS_PER_LONG];
+static devfs_handle_t devfs_handle = NULL;
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_SUPPORTED_DEVICE("js");
@@ -373,6 +376,7 @@
static int joydev_connect(struct input_handler *handler, struct input_dev *dev)
{
struct joydev *joydev;
+ char devfs_name[8];
int i, j;
if (!(test_bit(EV_KEY, dev->evbit) && test_bit(EV_ABS, dev->evbit) &&
@@ -393,6 +397,13 @@
}
sprintf(joydev->name, "joydev%d", joydev->minor);
+ sprintf(devfs_name, "js%d", joydev->minor);
+
+ joydev->devfs_handle = devfs_register(devfs_handle, devfs_name, 0,
+ DEVFS_FL_DEFAULT,
+ JOYDEV_MAJOR, joydev->minor,
+ S_IFCHR | S_IRUGO | S_IWUSR, 0, 0,
+ &joydev_fops, NULL);
joydev->handle.dev = dev;
joydev->handle.handler = handler;
@@ -451,6 +462,7 @@
struct joydev *joydev = handle->private;
input_close_device(handle);
+ devfs_unregister(joydev->devfs_handle);
if (!--joydev->used) {
clear_bit(joydev->minor, &joydev_minors);
@@ -466,10 +478,12 @@
static int __init joydev_init(void)
{
- if (register_chrdev(JOYDEV_MAJOR, "js", &joydev_fops)) {
+ if (devfs_register_chrdev(JOYDEV_MAJOR, "js", &joydev_fops)) {
printk(KERN_ERR "joydev: unable to get major %d for joystick\n", JOYDEV_MAJOR);
return -EBUSY;
}
+ devfs_handle = devfs_mk_dir(NULL, "joysticks", 9, NULL);
+
input_register_handler(&joydev_handler);
return 0;
}
@@ -477,7 +491,9 @@
static void __exit joydev_exit(void)
{
input_unregister_handler(&joydev_handler);
- if (unregister_chrdev(JOYSTICK_MAJOR, "js"))
+
+ devfs_unregister(devfs_handle);
+ if (devfs_unregister_chrdev(JOYDEV_MAJOR, "js"))
printk(KERN_ERR "js: can't unregister device\n");
}
And I've got a devfs related question too. I have got the following and
the generic section from the sample config from devfsd in
/etc/modules.conf:
alias /dev/sound mad16
And in my devfsd.conf I have got "LOOKUP .* MODLOAD", but the module
doesn't load. If I do a "LOOKUP dsp EXECUTE modprobe -k mad16" on the
other hand, it does work. Why is that? I thought that MODLOAD was
supposed to work just like "EXECUTE modprobe".
Any help is very appreciated.
Jimmy - jimmy@producks.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:27 EST