aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 00:15:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:48 -0400
commit7521803dcc0137668bb30483383092a647671d8b (patch)
treeab260e1d91991fa6d8bf5fd78321bb9c163a6b13 /drivers/usb
parent17a882fc0c91477b2582a6dfd4ca93ae7eb58cd3 (diff)
[PATCH] USB: always export interface information for modalias
This fixes a problem with some cdc acm devices that were not getting automatically loaded as the module alias was not being reported properly. This check was for back in the days when we only reported hotplug events for the main usb device, not the interfaces. We should always give the interface information for MODALIAS/modalias as it can be needed. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/sysfs.c35
-rw-r--r--drivers/usb/core/usb.c63
2 files changed, 37 insertions, 61 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index eae413bf8c2a..4bdbc9df6e03 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -462,30 +462,23 @@ static ssize_t show_modalias(struct device *dev, struct device_attribute *attr,
462{ 462{
463 struct usb_interface *intf; 463 struct usb_interface *intf;
464 struct usb_device *udev; 464 struct usb_device *udev;
465 int len; 465 struct usb_host_interface *alt;
466 466
467 intf = to_usb_interface(dev); 467 intf = to_usb_interface(dev);
468 udev = interface_to_usbdev(intf); 468 udev = interface_to_usbdev(intf);
469 469 alt = intf->cur_altsetting;
470 len = sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic", 470
471 le16_to_cpu(udev->descriptor.idVendor), 471 return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02X"
472 le16_to_cpu(udev->descriptor.idProduct), 472 "ic%02Xisc%02Xip%02X\n",
473 le16_to_cpu(udev->descriptor.bcdDevice), 473 le16_to_cpu(udev->descriptor.idVendor),
474 udev->descriptor.bDeviceClass, 474 le16_to_cpu(udev->descriptor.idProduct),
475 udev->descriptor.bDeviceSubClass, 475 le16_to_cpu(udev->descriptor.bcdDevice),
476 udev->descriptor.bDeviceProtocol); 476 udev->descriptor.bDeviceClass,
477 buf += len; 477 udev->descriptor.bDeviceSubClass,
478 478 udev->descriptor.bDeviceProtocol,
479 if (udev->descriptor.bDeviceClass == 0) { 479 alt->desc.bInterfaceClass,
480 struct usb_host_interface *alt = intf->cur_altsetting; 480 alt->desc.bInterfaceSubClass,
481 481 alt->desc.bInterfaceProtocol);
482 return len + sprintf(buf, "%02Xisc%02Xip%02X\n",
483 alt->desc.bInterfaceClass,
484 alt->desc.bInterfaceSubClass,
485 alt->desc.bInterfaceProtocol);
486 } else {
487 return len + sprintf(buf, "*isc*ip*\n");
488 }
489} 482}
490static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); 483static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
491 484
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 2493e7d9f5b3..4eca4904938f 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -569,6 +569,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
569{ 569{
570 struct usb_interface *intf; 570 struct usb_interface *intf;
571 struct usb_device *usb_dev; 571 struct usb_device *usb_dev;
572 struct usb_host_interface *alt;
572 int i = 0; 573 int i = 0;
573 int length = 0; 574 int length = 0;
574 575
@@ -585,7 +586,8 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
585 586
586 intf = to_usb_interface(dev); 587 intf = to_usb_interface(dev);
587 usb_dev = interface_to_usbdev (intf); 588 usb_dev = interface_to_usbdev (intf);
588 589 alt = intf->cur_altsetting;
590
589 if (usb_dev->devnum < 0) { 591 if (usb_dev->devnum < 0) {
590 pr_debug ("usb %s: already deleted?\n", dev->bus_id); 592 pr_debug ("usb %s: already deleted?\n", dev->bus_id);
591 return -ENODEV; 593 return -ENODEV;
@@ -627,46 +629,27 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
627 usb_dev->descriptor.bDeviceProtocol)) 629 usb_dev->descriptor.bDeviceProtocol))
628 return -ENOMEM; 630 return -ENOMEM;
629 631
630 if (usb_dev->descriptor.bDeviceClass == 0) { 632 if (add_hotplug_env_var(envp, num_envp, &i,
631 struct usb_host_interface *alt = intf->cur_altsetting; 633 buffer, buffer_size, &length,
634 "INTERFACE=%d/%d/%d",
635 alt->desc.bInterfaceClass,
636 alt->desc.bInterfaceSubClass,
637 alt->desc.bInterfaceProtocol))
638 return -ENOMEM;
632 639
633 /* 2.4 only exposed interface zero. in 2.5, hotplug 640 if (add_hotplug_env_var(envp, num_envp, &i,
634 * agents are called for all interfaces, and can use 641 buffer, buffer_size, &length,
635 * $DEVPATH/bInterfaceNumber if necessary. 642 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
636 */ 643 le16_to_cpu(usb_dev->descriptor.idVendor),
637 if (add_hotplug_env_var(envp, num_envp, &i, 644 le16_to_cpu(usb_dev->descriptor.idProduct),
638 buffer, buffer_size, &length, 645 le16_to_cpu(usb_dev->descriptor.bcdDevice),
639 "INTERFACE=%d/%d/%d", 646 usb_dev->descriptor.bDeviceClass,
640 alt->desc.bInterfaceClass, 647 usb_dev->descriptor.bDeviceSubClass,
641 alt->desc.bInterfaceSubClass, 648 usb_dev->descriptor.bDeviceProtocol,
642 alt->desc.bInterfaceProtocol)) 649 alt->desc.bInterfaceClass,
643 return -ENOMEM; 650 alt->desc.bInterfaceSubClass,
644 651 alt->desc.bInterfaceProtocol))
645 if (add_hotplug_env_var(envp, num_envp, &i, 652 return -ENOMEM;
646 buffer, buffer_size, &length,
647 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
648 le16_to_cpu(usb_dev->descriptor.idVendor),
649 le16_to_cpu(usb_dev->descriptor.idProduct),
650 le16_to_cpu(usb_dev->descriptor.bcdDevice),
651 usb_dev->descriptor.bDeviceClass,
652 usb_dev->descriptor.bDeviceSubClass,
653 usb_dev->descriptor.bDeviceProtocol,
654 alt->desc.bInterfaceClass,
655 alt->desc.bInterfaceSubClass,
656 alt->desc.bInterfaceProtocol))
657 return -ENOMEM;
658 } else {
659 if (add_hotplug_env_var(envp, num_envp, &i,
660 buffer, buffer_size, &length,
661 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*",
662 le16_to_cpu(usb_dev->descriptor.idVendor),
663 le16_to_cpu(usb_dev->descriptor.idProduct),
664 le16_to_cpu(usb_dev->descriptor.bcdDevice),
665 usb_dev->descriptor.bDeviceClass,
666 usb_dev->descriptor.bDeviceSubClass,
667 usb_dev->descriptor.bDeviceProtocol))
668 return -ENOMEM;
669 }
670 653
671 envp[i] = NULL; 654 envp[i] = NULL;
672 655