diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 01:25:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:55 -0400 |
commit | c9bcd582dfeec845b83bc948a430c9958bf839e6 (patch) | |
tree | d17bffdfc868aa355ebd9cc56d1eeb481c0b80d8 /drivers/input | |
parent | ea9f240bd819f9299703283e5326da606bbb4b05 (diff) |
[PATCH] INPUT: Create symlinks for backwards compatibility
This creates symlinks in /sys/class/input/ to the nested class devices
to help userspace cope with the nesting.
Unfortunatly udev still needs to be updated as it can't handle symlinks
properly here :(
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/evdev.c | 10 | ||||
-rw-r--r-- | drivers/input/joydev.c | 10 | ||||
-rw-r--r-- | drivers/input/mousedev.c | 10 | ||||
-rw-r--r-- | drivers/input/tsdev.c | 10 |
4 files changed, 32 insertions, 8 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 2a96b260a2a8..a4696cd0978c 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -661,6 +661,7 @@ static struct file_operations evdev_fops = { | |||
661 | static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) | 661 | static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) |
662 | { | 662 | { |
663 | struct evdev *evdev; | 663 | struct evdev *evdev; |
664 | struct class_device *cdev; | ||
664 | int minor; | 665 | int minor; |
665 | 666 | ||
666 | for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++); | 667 | for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++); |
@@ -686,9 +687,13 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct | |||
686 | 687 | ||
687 | evdev_table[minor] = evdev; | 688 | evdev_table[minor] = evdev; |
688 | 689 | ||
689 | class_device_create(&input_class, &dev->cdev, | 690 | cdev = class_device_create(&input_class, &dev->cdev, |
690 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), | 691 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), |
691 | dev->cdev.dev, "event%d", minor); | 692 | dev->cdev.dev, evdev->name); |
693 | |||
694 | /* temporary symlink to keep userspace happy */ | ||
695 | sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, | ||
696 | evdev->name); | ||
692 | 697 | ||
693 | return &evdev->handle; | 698 | return &evdev->handle; |
694 | } | 699 | } |
@@ -698,6 +703,7 @@ static void evdev_disconnect(struct input_handle *handle) | |||
698 | struct evdev *evdev = handle->private; | 703 | struct evdev *evdev = handle->private; |
699 | struct evdev_list *list; | 704 | struct evdev_list *list; |
700 | 705 | ||
706 | sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name); | ||
701 | class_device_destroy(&input_class, | 707 | class_device_destroy(&input_class, |
702 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); | 708 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); |
703 | evdev->exist = 0; | 709 | evdev->exist = 0; |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 25f7eba4761f..20e2972b9204 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -448,6 +448,7 @@ static struct file_operations joydev_fops = { | |||
448 | static struct input_handle *joydev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) | 448 | static struct input_handle *joydev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) |
449 | { | 449 | { |
450 | struct joydev *joydev; | 450 | struct joydev *joydev; |
451 | struct class_device *cdev; | ||
451 | int i, j, t, minor; | 452 | int i, j, t, minor; |
452 | 453 | ||
453 | for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); | 454 | for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); |
@@ -513,9 +514,13 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct | |||
513 | 514 | ||
514 | joydev_table[minor] = joydev; | 515 | joydev_table[minor] = joydev; |
515 | 516 | ||
516 | class_device_create(&input_class, &dev->cdev, | 517 | cdev = class_device_create(&input_class, &dev->cdev, |
517 | MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), | 518 | MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), |
518 | dev->cdev.dev, "js%d", minor); | 519 | dev->cdev.dev, joydev->name); |
520 | |||
521 | /* temporary symlink to keep userspace happy */ | ||
522 | sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, | ||
523 | joydev->name); | ||
519 | 524 | ||
520 | return &joydev->handle; | 525 | return &joydev->handle; |
521 | } | 526 | } |
@@ -525,6 +530,7 @@ static void joydev_disconnect(struct input_handle *handle) | |||
525 | struct joydev *joydev = handle->private; | 530 | struct joydev *joydev = handle->private; |
526 | struct joydev_list *list; | 531 | struct joydev_list *list; |
527 | 532 | ||
533 | sysfs_remove_link(&input_class.subsys.kset.kobj, joydev->name); | ||
528 | class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); | 534 | class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); |
529 | joydev->exist = 0; | 535 | joydev->exist = 0; |
530 | 536 | ||
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index de2808fc85b3..2d0af44ac4b9 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -620,6 +620,7 @@ static struct file_operations mousedev_fops = { | |||
620 | static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) | 620 | static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) |
621 | { | 621 | { |
622 | struct mousedev *mousedev; | 622 | struct mousedev *mousedev; |
623 | struct class_device *cdev; | ||
623 | int minor = 0; | 624 | int minor = 0; |
624 | 625 | ||
625 | for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); | 626 | for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); |
@@ -648,9 +649,13 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru | |||
648 | 649 | ||
649 | mousedev_table[minor] = mousedev; | 650 | mousedev_table[minor] = mousedev; |
650 | 651 | ||
651 | class_device_create(&input_class, &dev->cdev, | 652 | cdev = class_device_create(&input_class, &dev->cdev, |
652 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 653 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
653 | dev->cdev.dev, "mouse%d", minor); | 654 | dev->cdev.dev, mousedev->name); |
655 | |||
656 | /* temporary symlink to keep userspace happy */ | ||
657 | sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, | ||
658 | mousedev->name); | ||
654 | 659 | ||
655 | return &mousedev->handle; | 660 | return &mousedev->handle; |
656 | } | 661 | } |
@@ -660,6 +665,7 @@ static void mousedev_disconnect(struct input_handle *handle) | |||
660 | struct mousedev *mousedev = handle->private; | 665 | struct mousedev *mousedev = handle->private; |
661 | struct mousedev_list *list; | 666 | struct mousedev_list *list; |
662 | 667 | ||
668 | sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); | ||
663 | class_device_destroy(&input_class, | 669 | class_device_destroy(&input_class, |
664 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | 670 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); |
665 | mousedev->exist = 0; | 671 | mousedev->exist = 0; |
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index 75e165736655..ca1547929d62 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c | |||
@@ -368,6 +368,7 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
368 | struct input_device_id *id) | 368 | struct input_device_id *id) |
369 | { | 369 | { |
370 | struct tsdev *tsdev; | 370 | struct tsdev *tsdev; |
371 | struct class_device *cdev; | ||
371 | int minor, delta; | 372 | int minor, delta; |
372 | 373 | ||
373 | for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; | 374 | for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; |
@@ -409,9 +410,13 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
409 | 410 | ||
410 | tsdev_table[minor] = tsdev; | 411 | tsdev_table[minor] = tsdev; |
411 | 412 | ||
412 | class_device_create(&input_class, &dev->cdev, | 413 | cdev = class_device_create(&input_class, &dev->cdev, |
413 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), | 414 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), |
414 | dev->cdev.dev, "ts%d", minor); | 415 | dev->cdev.dev, tsdev->name); |
416 | |||
417 | /* temporary symlink to keep userspace happy */ | ||
418 | sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, | ||
419 | tsdev->name); | ||
415 | 420 | ||
416 | return &tsdev->handle; | 421 | return &tsdev->handle; |
417 | } | 422 | } |
@@ -421,6 +426,7 @@ static void tsdev_disconnect(struct input_handle *handle) | |||
421 | struct tsdev *tsdev = handle->private; | 426 | struct tsdev *tsdev = handle->private; |
422 | struct tsdev_list *list; | 427 | struct tsdev_list *list; |
423 | 428 | ||
429 | sysfs_remove_link(&input_class.subsys.kset.kobj, tsdev->name); | ||
424 | class_device_destroy(&input_class, | 430 | class_device_destroy(&input_class, |
425 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); | 431 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); |
426 | tsdev->exist = 0; | 432 | tsdev->exist = 0; |